-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autoloading of files #37
Conversation
Thanks for all this work @dropje86 I appreciate it. In regards to this one I have a couple of thoughts I would like to discuss:
Happy to discuss the points... |
Hi @jrasell Sure, we could also try both yaml (yml) and tf in that order. Regarding the nomad files, what do you suggest? Run every .nomad file in the working directory and loop through it? |
Yeah; looking for either variable file would be perfect. I would say for the job file that Levant would only run without an explicit template on the CLI if there is only one job file in the current directory; not sure what you think about that? |
So here's a commit which implements that. Please let me know if you agree with putting these into the helper pkg, if not feel free to relocate them or let me know. |
@ericwestfall as you requested this feature I would appreciate your feedback on the implementation. |
if len(args) == 1 { | ||
templateFile = args[0] | ||
} else if len(args) == 0 { | ||
if templateFile = helper.GetDefaultTmplFile(); templateFile == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we find more than one template file or no template file, it would be ideal if we returned a detailed error message to the user rather than just dumping them back to the usage information and expecting them to guess what went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
A basic way of implementing issue hashicorp#10 If no argument is given we check for the existence of a levant.nomad jobfile. If no -var-file is given we check for the existence of a levant.tf variable file. This "standardizes" the use of named files and makes pipelines clean in command usage.
* If no TEMPLATE is given as positional arg we scan the working directory for *.nomad files. If only 1 match is found we use that to proceed. * If no -var-file is given we check the working directory for files (in this order) named: - levant.yaml - levant.yml - levant.tf The first match will be used.
* improve debug logging for default variable file lookup * remove redundant extension logging
Looks lovely @dropje86! |
A basic way of implementing issue #10
If no argument is given we check for the existence of a
levant.nomad jobfile.
If no -var-file is given we check for the existence of a
levant.tf variable file.
This "standardizes" the use of named files and makes pipelines
clean in command usage.