Ask Your Question
0

Hiera lookup truncates value

asked 2017-02-02 10:25:37 -0500

Hello,

I have defined a value in my hierarchy that contains the version number for a GPU driver. In this particular case, the driver number ends in a 0 (375.20). When I lookup the hiera value, hiera is truncating the value (reports 375.2).

Here is the entry in my yaml hierarchy:

gpu_driver: 375.20

And here it the output from hiera:

hiera gpu_driver

375.2

Is there anyway to force hiera to not truncate the number? Other prior driver numbers never showed any truncation issue. I don't believe this is a locale display issue either as my puppet code that uses this value (using a hiera() lookup in the code) is also receiving the truncated value.

Thank you

-Mike

edit retag flag offensive close merge delete

Comments

I have another driver value that ends in .0 that is not being truncated. At this point, I am at a loss on what I can do to fix it. Some of the yaml files are being generated from a perl script using the YAML::Tiny module.

Mike Moore gravatar imageMike Moore ( 2017-02-02 12:01:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-02-05 15:46:39 -0500

Josh gravatar image

Quote the values and hiera won't truncate them. Example - passing this to hiera_explain:

---
unquoted: 375.20
quoted: '375.20'

produces this:

Priority lookup results:
* hiera('unquoted') => 375.2
* hiera('quoted') => 375.20
edit flag offensive delete link more

Comments

I was going to answer the same thing, +1

DarylW gravatar imageDarylW ( 2017-02-06 08:00:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-02-02 10:22:51 -0500

Seen: 23 times

Last updated: Feb 05