Use ::environment on the command line, since that's what your datadir is looking for. environment and ::environment are not normalized to the same value.
On Saturday, September 24, 2016, Jagga Soorma <jagg...@gmail.com> wrote: > Hi Guys, > > I am new to hiera and can't seem to get the debug command to work for > hiera. Seems like it is not picking up the environment variable even when > I specify it on cli: > > -- > [root@resforetst01 ~]# grep -i testkey /etc/puppet/environments/ > production/hieradata/common.yaml > testkey: hello > > [root@resforetst01 ~]# hiera -c /etc/puppet/hiera.yaml testkey > environment=production --debug > DEBUG: 2016-09-24 16:10:28 -0700: Hiera YAML backend starting > DEBUG: 2016-09-24 16:10:28 -0700: Looking up testkey in YAML backend > DEBUG: 2016-09-24 16:10:28 -0700: Looking for data source common > *DEBUG: 2016-09-24 16:10:28 -0700: Cannot find datafile > /etc/puppet/environments//hieradata/common.yaml, skipping* > nil > > [root@resforetst01 ~]# grep -i datadir /etc/puppet/hiera.yaml | grep -v > '#' > :datadir: "/etc/puppet/environments/%{::environment}/hieradata" > > [root@resforetst01 ~]# cat /etc/puppet/environments/ > production/hieradata/common.yaml | grep -v '#' | sed '/^$/d' > --- > pr_runlevel::default_runlevel: '3' > selinux::mode: 'disabled' > firewall::ensure: 'stopped' > testkey: hello > -- > > Any help would be appreciated. Am I missing some configuration here? > > Thanks! > > -- > 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+unsubscr...@googlegroups.com > <javascript:_e(%7B%7D,'cvml','puppet-users%2bunsubscr...@googlegroups.com');> > . > To view this discussion on the web visit https://groups.google.com/d/ > msgid/puppet-users/CAKyjK53nAWV6G9RPK7G4OGcV% > 3DvpEU%3DmQ6TpoA0bGu6ZLp5GXsA%40mail.gmail.com > <https://groups.google.com/d/msgid/puppet-users/CAKyjK53nAWV6G9RPK7G4OGcV%3DvpEU%3DmQ6TpoA0bGu6ZLp5GXsA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Rob Nelson rnels...@gmail.com -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC76iT_MOu9RBJ7Md5%3Db7pOcqYmdgjfEOWXojckEbwW%2BKjfAvQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.