Open gabrieltz opened 3 years ago
Good👍🏻
You can escape the $
to work around the invalid HCL2 identifier.
attribute = "$${meta.56net}"
This will be rendered to the proper JSON, because the HCL2 parser will just remove the "escaping" $.
"Constraints": [
{
"LTarget": "${meta.56net}",
"Operand": "=",
"RTarget": "true"
}
],
thank you @angrycub
while that does validate the job propelry , it breaks nomad 0.12.7 which i am currently running in our datacenter.
I was validating all job files against the latest nomad version, to see if my job files would work on both current and latest versions of nomad before upgrading to the latest. This interpolation issue is the only one breaking so far and i have already modified more that 50 jobs to work on both versions.
I guess the only way to make it work on both versions is to rename this meta key to meatballs
or anything else, across the datacenter, that doesn't start with a number :)
If it isn't a bug then you may close this issue.
thank you
Nomad version
Output from
nomad version
Nomad v0.12.7 (6147cb578794cb2d0c35d68fe1791728a09bb081) ( my production env ) Not affected Nomad v1.1.3 (8c0c8140997329136971e66e4c2337dfcf932692) affected Nomad v1.1.4 affected Nomad v1.1.5 (117a23d2cdf26a1837b21c84f30c8c0f3441e927) affectedOperating system and Environment details
Ubuntu 18.04 and 20.04
Issue
hello,
If a client meta key starts with a number, it breaks the hcl2 validator for a job, hcl1 appears to work fine.
Reproduction steps
nomad agent config for this example:
constraint { attribute = "${meta.56net}" / <== this one / value = "true" }
group "ahappylittlegroup" { count = 1 constraint { operator = "distinct_hosts" value = "true" } task "dummy" { driver = "docker" config { image = "whatever" network_mode="host" } resources { memory = 2048 cpu = 400 } } } }
Expected Result
Job validation successful
( with green happy characters )Actual Result
I also posted this at
https://discuss.hashicorp.com/t/extra-characters-after-interpolation-expression/29726
and another user was able to reproduce this as well.Thank you