Closed tamanna2702 closed 4 years ago
This is intended. Cartesian product outputs a string, which in the context you’re generating requires quoting in the yaml file to remain a string, otherwise the output would be a list of yaml objects rather than strings, due to the colon-spca syntax you’re generating
Sent from my iPhone
On Jun 9, 2020, at 12:25 PM, TAnna notifications@github.com wrote:
I am trying the below as I need a space just after the colon:
meta: hosts:
- a.example.com
- b.example.com
- c.example.com port: 8088
hosts: (( cartesian-product meta.hosts ":" " " meta.port )) But Spruce seems to add single quotes to the results:
hosts:
'a.example.com: 8088' 'b.example.com: 8088' 'c.example.com: 8088' Also, I tried the below :
meta: hosts:
- a.example.com
- b.example.com
- c.example.com port: 8088
hosts: (( cartesian-product meta.hosts ": " meta.port )) But I get the below error:
file1.yml: unmarshal []byte to yaml failed: yaml: line 8: mapping values are not → allowed in this context
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
In my use case, I do need a list of yaml objects using the cartesian product. That is why I need the space. Do you reckon this can be done somehow?
I don't believe there is anything that does this in spruce currently. This seems like it's a request identical to #212, so I'm going to close this as a duplicate, but if you want to submit a PR to enable this, it will be more than welcome 😄
I am trying the below as I need a space just after the colon:
But Spruce seems to add single quotes to the results:
hosts:
Also, I tried the below :
But I get the below error:
file1.yml: unmarshal []byte to yaml failed: yaml: line 8: mapping values are not → allowed in this context