Turns out the problem isn't so much with the yaml, but with the 'yq' that I
use to fetch some values from it.
That yq is the one from PyPI, and interprets the string 036001814778 as an
int and then chokes on it:

dick.visser@GA dick$ cat foo.yml
state:
  owner_id: 036001814778
dick.visser@GA dick$ yq -r . foo.yml
yq: Error running jq: ValueError: invalid literal for int() with base 8:
'036001814778'.

There is an issue about this (https://github.com/kislyuk/yq/issues/152) and
that seems to have been fixed this very week.
I could wait for that.
But, for my use case (a state file that contains some AWS infra), I figured
I'd rather avoid any more YAML issues and just use a JSON file instead
(which works).

thx!


On Fri, 3 Nov 2023 at 16:45, Andrew Latham <[email protected]> wrote:

> I saw https://github.com/ansible/proposals/issues/72 and thought that
> maybe the history may help.
>
> I can remember padding with a space to keep an ID a string that the
> consumer filters out but YMMV
>
> On Fri, Nov 3, 2023 at 6:57 AM Dick Visser <[email protected]> wrote:
>
>> Hii,
>>
>> I have a structure like this:
>>
>> ---
>> state:
>>   owner_id: 036001814778
>>   environments:
>>     - name: prod
>>       owner_id: 036001814778
>>       foo:
>>         bar:
>>           - name: xasdf
>>             owner_id: 036001814778
>>     - name: acc
>>       owner_id: 036001814778
>>       bar: baz
>>       nest:
>>         ed:
>>           struct:
>>             deeper:
>>               too:
>>                 owner_id: 036001814778
>>                 foo: biz
>>                 boz: bar
>>
>> I am looking for a way to have all values for owner_id (no matter what
>> level) be strings rather than integers. So the dict would look like:
>>
>> ---
>> state:
>>   owner_id: '036001814778'
>>   environments:
>>     - name: prod
>>       owner_id: '036001814778'
>>       foo:
>>         bar:
>>           - name: xasdf
>>             owner_id: '036001814778'
>>     - name: acc
>>       owner_id: '036001814778'
>>       bar: baz
>>       nest:
>>         ed:
>>           struct:
>>             deeper:
>>               too:
>>                 owner_id: '036001814778'
>>                 foo: biz
>>                 boz: bar
>>
>> The complication here is that the owner_id keys can appear at any level.
>>
>> Tnx!
>>
>> Dick
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLajtsiYTJtFDqV3-RMHxDrJ83pHdtVW%3Dy%3DkmJ1x%3DeV2SA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLajtsiYTJtFDqV3-RMHxDrJ83pHdtVW%3Dy%3DkmJ1x%3DeV2SA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> - Andrew "lathama" Latham -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2Bqj4S8zpVYs%2BkGgxNBNCHmNnnY7jm1F2jA%3DWB35piy3W%3Dw%3DMg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CA%2Bqj4S8zpVYs%2BkGgxNBNCHmNnnY7jm1F2jA%3DWB35piy3W%3Dw%3DMg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLYRZQHRhpNhv56Czciy5Rim5kLeA6XQypfDSBk53wSeUA%40mail.gmail.com.

Reply via email to