Ask Your Question
0

Hiera modifies input data

asked 2015-10-30 04:34:17 -0500

mf gravatar image

Hiera removes ${Variable} from the input data.

I have following common.yaml:

#
mystr: 'RewriteCond %{REQUEST_METHOD} OPTIONS'

When i run:
hiera --config /var/tmp/hiera.yaml mystr

Output is: RewriteCond OPTIONS

Same result if I use the hiera file backend from adrienthebo/hiera-file

/var/tmp/hiera.yaml:

:hierarchy: - common

:backends:
    - yaml
    - file

:yaml:
    :datadir: '/var/tmp/hieradata'

:file:
    :datadir: '/var/tmp/hieradata'

hiera 1.3.4
ruby 1.8.7
centos 6.7

Have anybody had the same problem?
Greatful for any help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-10-30 06:11:09 -0500

lupin gravatar image

Try this.

[root@localhost vagrant]# hiera mystr
RewriteCond %{REQUEST_METHOD} OPTIONS

[root@localhost vagrant]# grep mystr /var/lib/hiera/global.yaml 
mystr:  RewriteCond %%{}{REQUEST_METHOD} OPTIONS
edit flag offensive delete link more

Comments

Thanks this works fine, but the vhost i hiera will look a bit odd. Is this a bug in hiera or is there a reason for this substitution ?

mf gravatar imagemf ( 2015-11-02 01:41:41 -0500 )edit

In the YAML world, the % symbol is the variable delimiter. To escape this, when you want a real %, type %% instead.

WhatsARanjit gravatar imageWhatsARanjit ( 2015-11-02 19:48:01 -0500 )edit

it's a bug I believed and been there for quite sometime putting that extra {} is just a work-around.

lupin gravatar imagelupin ( 2015-11-03 02:13:26 -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: 2015-10-30 04:34:17 -0500

Seen: 94 times

Last updated: Oct 30 '15