I have come across a problem trying to use version numbers as a string that are being interpreted as floating point numbers - whereby any trailing zeros are being stripped off
e.g. I have set up a grain and pillar as 'version' strings:
grain_ver: '123.40'
pillar_ver: '678.900'
and then use the following sls to test:
{% set g = salt['grains.get']('grain_ver') -%}
{% set p = salt['pillar.get']('pillar_ver') -%}
tester:
test.nop:
- grain: {{ g }}
- pillar: {{ p }}
- grain_with_string: {{ g ~ ' some string' }}
- pillar_with_space: {{ p ~ ' ' }}
- both: {{ g ~ p }}
- both_with_space: {{ g ~ ' ' ~ p }}
when run through state.show_sls it gives:
test:
|_
----------
grain:
123.4
|_
----------
pillar:
678.9
|_
----------
grain_with_string:
123.40 some string
|_
----------
pillar_with_space:
678.9
|_
----------
both:
123.40678.900
|_
----------
both_with_space:
123.40 678.900
i.e. in some cases it strips off the trailing zeros - but in other cases, its doesn't ?
Is there a 'better' way to prevent trailing zeros being stripped of when what happens to look like a floating point number is actually a string ?
In case it's relevant, I'm using 3006.4 on CentOS 7
Thanks
James Pearson