Lets add some extra confusion here :

[witjoh@fc20 spec]$ puppet apply -e 'notify { $::os: }'
Notice: Compiled catalog for fc20.koewacht.net in environment production in 0.03 seconds Notice: {"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}} Notice: /Stage[main]/Main/Notify[{"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}}]/message: defined 'message' as '{"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}}'
Notice: Finished catalog run in 0.11 seconds
[witjoh@fc20 spec]$ puppet apply -e 'notify { $::os[name]: }'
Notice: Compiled catalog for fc20.koewacht.net in environment production in 0.02 seconds
Notice: Fedora
Notice: /Stage[main]/Main/Notify[Fedora]/message: defined 'message' as 'Fedora'
Notice: Finished catalog run in 0.12 seconds
[witjoh@fc20 spec]$ puppet apply -e 'notify { $::os["name"]: }'
Notice: Compiled catalog for fc20.koewacht.net in environment production in 0.03 seconds
Notice: Fedora
Notice: /Stage[main]/Main/Notify[Fedora]/message: defined 'message' as 'Fedora'
Notice: Finished catalog run in 0.11 seconds
[witjoh@fc20 spec]$ puppet --version
3.7.4 (Puppet Enterprise 3.7.2)

and when i do the same in my rspec module, it does no work in the same way :

[witjoh@fc20 rspec]$ bundle exec puppet apply --stringify_facts false -e 'notify { $::os["name"]: }' Error: ::os is not a hash or array when accessing it with name at line 1 on node fc20.koewacht.net

[witjoh@fc20 rspec]$ bundle exec puppet apply --stringify_facts false -e 'notify { $::os[name]: }' Error: ::os is not a hash or array when accessing it with name at line 1 on node fc20.koewacht.net

[witjoh@fc20 rspec]$ bundle exec puppet apply --stringify_facts false -e 'notify { $::os: }' Notice: Compiled catalog for fc20.koewacht.net in environment production in 0.03 seconds Notice: {"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}} Notice: /Stage[main]/Main/Notify[{"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}}]/message: defined 'message' as '{"name"=>"Fedora", "family"=>"RedHat", "release"=>{"major"=>"20", "full"=>"20"}}'
Notice: Finished catalog run in 0.10 seconds

[witjoh@fc20 rspec]$ bundle exec puppet apply --stringify_facts false --configprint all | grep stringify
stringify_facts = true

[witjoh@fc20 rspec]$ bundle exec puppet apply --stringify_facts false --configprint all | grep stringify
stringify_facts = true

Defaults are different between my PE and gem puppet :
[witjoh@fc20 rspec]$ puppet apply --configprint stringify_facts
false
[witjoh@fc20 rspec]$ bundle exec puppet apply --configprint stringify_facts
true

Seems PE en gem (os) installation have different defaults since i did not set this config ...




On 09/03/15 16:21, Raphaël Pinson wrote:
Hi Felix,


By default, Puppet 3 stringifies all facts. And apparently, "--stringify_facts false" does not work with puppet apply…


Raphaël


On Monday, March 9, 2015 at 4:13:33 PM UTC+1, Felix Frank wrote:

    Hi,

    me I'm now utterly confused by how this (not) works in the wild.

    $ bundle exec puppet apply -e 'notice $os'
    Notice: Scope(Class[main]): {"name"=>"Debian", "family"=>"Debian",
    "release"=>{"major"=>"jessie/sid", "full"=>"jessie/sid"},
    "lsb"=>{"distcodename"=>"sid", "distid"=>"Debian",
    "distdescription"=>"Debian GNU/Linux unstable (sid)",
    "distrelease"=>"unstable", "majdistrelease"=>"unstable"}}

    OK, but

    $ bundle exec puppet apply -e 'notice $os[name]'
    Error: os is not a hash or array when accessing it with name at
    line 1
    on node hypnos.mpex.net <http://hypnos.mpex.net>

    $ bundle exec puppet apply --parser=future -e 'notice $os["name"]'
    Error: Evaluation Error: The value 'name' cannot be converted to
    Numeric. on node hypnos.mpex.net <http://hypnos.mpex.net>

    This is Puppet 3.7.3. Please tell me I'm Doing It Wrong.

    Thanks,
    Felix

    On 03/09/2015 03:54 PM, Johan De Wit wrote:
    > Again , I'm loosing the fight
    >
    > When i split up my rspec, it works, but the demo test always fails,
    > There is something I overlook.
    >
    > Maybe someone else sees my mistake ??
    >
    > https://github.com/witjoh/rspec <https://github.com/witjoh/rspec>
    >
    > Grts
    >
    > Johan

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com <mailto:puppet-dev+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/902db327-b5fb-4289-9123-20066c0646be%40googlegroups.com <https://groups.google.com/d/msgid/puppet-dev/902db327-b5fb-4289-9123-20066c0646be%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer              (805008667232363)
Puppet Certified Professional 2013/2014 (PCP0000006)
Puppet Certified Intstructor
blog : http://johan.koewacht.net/
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72              Fax       +32 (0)2/255 70 71
3071 KORTENBERG             Mobile    +32 (0)474/42 40 73
BELGIUM                     http://www.open-future.be
_________________________________________________________

Next Events:
Puppet Fundamentals | 
http://www.open-future.be/puppet-fundamentals-training-16th-till-18th-march
Puppet Architect | 
http://www.open-future.be/puppet-architect-training-19th-till-20th-march
Puppet Practitioner | 
http://www.open-future.be/puppet-practitioner-training-14th-till-16th-april
Linux Training | http://www.open-future.be/linux-training-20th-till-24th-april
Bacula Administrator 1 | 
http://www.open-future.be/bacula-administrator-i-training-28th-till-30th-april
Zabbix Certified Specialist | 
http://www.open-future.be/zabbix-certified-specialist-training-4th-till-6th-may
Zabbix Certified Professional | 
http://www.open-future.be/zabbix-certified-professional-training-7th-till-8th-may
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/54FE1238.9070505%40open-future.be.
For more options, visit https://groups.google.com/d/optout.

Reply via email to