Hiera lookup

31 views
Skip to first unread message

Sergiu Cornea

unread,
Aug 5, 2015, 6:41:39 AM8/5/15
to Puppet Users
Hello guys,

I am trying to specify in the Hiera file which website should be a CMS like wordpress and which should just be a static website, however, doesn't matter what value I am having in the Hiera, my code always resolves to false. It is this a bug or I am doing something wrong?

Below is the code I am using:

$static      = hiera("website_type::${uid}::cms"    , 'false')

 if $cms {

#   install wordpress

}

else {

#create only the dirs

}

hiera:

website:
  1000: 
 2000:
website_type:
  2000: 
    cms: 'yes'


Thank you,

Regards,
Sergiu

R.I.Pienaar

unread,
Aug 5, 2015, 6:45:18 AM8/5/15
to puppet-users


----- Original Message -----
> From: "Sergiu Cornea" <s.co...@my.westminster.ac.uk>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Wednesday, August 5, 2015 11:41:38 AM
> Subject: [Puppet Users] Hiera lookup

> Hello guys,
>
> I am trying to specify in the Hiera file which website should be a CMS like
> wordpress and which should just be a static website, however, doesn't
> matter what value I am having in the Hiera, my code always resolves to
> false. It is this a bug or I am doing something wrong?
>
> Below is the code I am using:
>
> $static = hiera("website_type::${uid}::cms" , 'false')
>
> if $cms {

You're assinign $static and checking $cms.

R.I.Pienaar

unread,
Aug 5, 2015, 6:47:06 AM8/5/15
to puppet-users


----- Original Message -----
> From: "Sergiu Cornea" <s.co...@my.westminster.ac.uk>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Wednesday, August 5, 2015 11:41:38 AM
> Subject: [Puppet Users] Hiera lookup

> Hello guys,
>
> I am trying to specify in the Hiera file which website should be a CMS like
> wordpress and which should just be a static website, however, doesn't
> matter what value I am having in the Hiera, my code always resolves to
> false. It is this a bug or I am doing something wrong?
>
> Below is the code I am using:
>
> $static = hiera("website_type::${uid}::cms" , 'false')

Your data also does not match this.

website_type::foo::cms is exactly that in hiera not:

website_type:
foo:
cms

depending on version I think you could do hiera("website_type.foo.cms")

>
> if $cms {
>
> # install wordpress
>
> }
>
> else {
>
> #create only the dirs
>
> }
>
> hiera:
>
> website:
> 1000:
> example.com
> 2000:
> example1.com
> website_type:
> 2000:
> cms: 'yes'
>
>
> Thank you,
>
> Regards,
> Sergiu
>
>
> --
>
>
> This message and its attachments are private and confidential. If you have
> received this message in error, please notify the sender and remove it and
> its attachments from your system.
>
> The University of Westminster is a charity and a company
> limited by guarantee. Registration number: 977818 England.
> Registered Office: 309 Regent Street, London W1B 2UW.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/0423d1f7-682c-45e8-9841-8bff5c23b3c0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sergiu Cornea

unread,
Aug 5, 2015, 6:47:12 AM8/5/15
to Puppet Users
Oh I beg your pardon, typo mistake yes it should be $static instead of $cms

Sergiu Cornea

unread,
Aug 5, 2015, 9:24:35 AM8/5/15
to Puppet Users
Hi,

I have tried the solution that you've proposed but with no luck :( now it is complaining that couldn't find any 'cms' item in the hiera file.

Also, I am running Puppet 3.7 (master & agent) on CentOS 6.5

Thank you,

Regards,
Sergiu
Reply all
Reply to author
Forward
0 new messages