Skip to content
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

Nomad client 1.2.x cli does not seem to import variables from file #11560

Closed
johanforssell opened this issue Nov 23, 2021 · 3 comments
Closed

Comments

@johanforssell
Copy link

Nomad version

Nomad v1.1.8 (41cda4c)
Nomad v1.2.0 (0e11f8d)
Nomad v1.2.1 (719c53a)

Operating system and Environment details

macOS Monterey - 12.0.1

Issue

$ > ./nomad-1.1.8 job validate -var-file=../../secrets/se2.secrets.hcl -var-file=../../vars/se2.hcl mongo.nomad                                                                                                             
Job validation successful

$ > ./nomad-1.2.1 job validate -var-file=../../secrets/se2.secrets.hcl -var-file=../../vars/se2.hcl mongo.nomad     
...                                                                                                        
Error getting job struct: Error parsing job file from mongo.nomad:
<nil>: Unset variable "nomad_w3"; A used variable must be set or have a default value; see https://www.nomadproject.io/docs/job-specification/hcl2/variables for details.
<nil>: Unset variable "env"; A used variable must be set or have a default value; see https://www.nomadproject.io/docs/job-specification/hcl2/variables for details.
<nil>: Unset variable "datacenters"; A used variable must be set or have a default value; see https://www.nomadproject.io/docs/job-specification/hcl2/variables for details.
<nil>: Unset variable "nomad_w1"; A used variable must be set or have a default value; see https://www.nomadproject.io/docs/job-specification/hcl2/variables for details.

Expected Result

Job file is supposed to be validated ok.

Actual Result

Nomad 1.2.0 and 1.2.1 no longer validates my job, which 1.1.8 does.

1.2.0 and 1.2.1 complains that the variables defined in external files are not present.

Nomad Client logs (if appropriate)

@jrasell jrasell self-assigned this Nov 23, 2021
@jrasell
Copy link
Member

jrasell commented Nov 23, 2021

Hi @johanforssell; without knowing exactly what the job and variables files contain, I believe this might be related to the two changes within #11165 and #11284. The first fixed an inconsistency with the way errors where generated when running HCLv2 parsing, the second allows for an escape hatch where this behaviour is not desirable for users.

If you could therefore run your 1.2.1 command using the -hcl2-strict=false, it would help identify whether this is a new bug or the result of these changes. If the problem persists, a small redacted reproduction jobspec and variables file would be really useful to help identify the issue.

@johanforssell
Copy link
Author

I forgot about answering this one!

Adding -hcl2-strict=false does indeed solve this issue. Thank you

@jrasell jrasell closed this as completed Jan 27, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

2 participants