Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Adrien Thebo commented on an issue Re: Provide access to all facts in a single structure Verified against master with the previously given manifest: └> bexec puppet apply --immutable_node_data --no-stringify_facts --parser future facts.pp Notice: Scope(Class[main]): facts data type is Hash Notice: Scope(Class[main]): (looking inside facts hash) ipaddress is 10.16.18.164 Notice: Scope(Class[main]): (structured data in facts hash) processors type is Array Notice: Scope(Class[main]): processors is [Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz, Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz, Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz, Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz] Notice: Scope(Class[main]): next processor is Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Notice: Scope(Class[main]): next processor is Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Notice: Scope(Class[main]): next processor is Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Notice: Scope(Class[main]): next processor is Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Notice: Compiled catalog for grey.somethingsinistral.net in environment production in 0.34 seconds Notice: Finished catalog run in 0.10 seconds Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Adrien Thebo assigned an issue to Adrien Thebo Puppet / PUP-542 Provide access to all facts in a single structure Change By: Adrien Thebo Assignee: Adrien Thebo Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker commented on an issue Re: Provide access to all facts in a single structure Merged the fixed deep_freeze into master in 4d541e Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning. This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker assigned an issue to Andrew Parker Puppet / PUP-542 Provide access to all facts in a single structure Change By: Andrew Parker Assignee: Andrew Parker Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Joshua Cooper assigned an issue to Joshua Cooper Puppet / PUP-542 Provide access to all facts in a single structure Change By: Joshua Cooper Assignee: Joshua Cooper Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Joshua Cooper updated an issue Puppet / PUP-542 Provide access to all facts in a single structure Change By: Joshua Cooper Assignee: Joshua Cooper Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Adrien Thebo commented on an issue Re: Provide access to all facts in a single structure Pull request for the above patch at https://github.com/puppetlabs/puppet/pull/2394 Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning. This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Adrien Thebo commented on an issue Re: Provide access to all facts in a single structure This works well when stringify_facts is enabled. Given the following manifest: $facts_type = inline_template("<%= scope['facts'].class %>") $processor_fact_type = inline_template("<%= scope['facts']['processors'].class %>") notice("facts data type is ${facts_type}") notice("(looking inside facts hash) ipaddress is ${facts['ipaddress']}") notice("(structured data in facts hash) processors type is ${processor_fact_type}") notice("processors is ${facts['processors']}") each($facts['processors']) |$value| { notice("next processor is ${value}") } └> bexec puppet apply --immutable_node_data --stringify_facts --parser future facts.pp --trace Notice: Scope(Class[main]): facts data type is Hash Notice: Scope(Class[main]): (looking inside facts hash) ipaddress is 10.16.18.164 Notice: Scope(Class[main]): (structured data in facts hash) processors type is String Notice: Scope(Class[main]): processors is ["Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz", "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz", "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz", "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz"] # Puppet then iterates over each character in the "processors" string, omitted here for brevity. When fact stringifying is disabled we get this: └> bexec puppet apply --immutable_node_data --no-stringify_facts --parser future facts.pp Failed to load ZFS module stack. Load the module manually by running 'insmod /zfs.ko' as root. Failed to load ZFS module stack. Load the module manually by running 'insmod /zfs.ko' as root. Could not retrieve fact='zpool_version', resolution='': undefined method `captures' for nil:NilClass Failed to load ZFS module stack. Load the module manually by running 'insmod /zfs.ko' as root. Failed to load ZFS module stack. Load the module manually by running 'insmod /zfs.ko' as root. Error: Unsupported data type: 'Array on node grey.somethingsinistral.net Error: Unsupported data type: 'Array on node grey.somethingsinistral.net It appears that the code at (https://github.com/puppetlabs/puppet/blob/3.4.3/lib/puppet/parser/scope.rb#L513-L525) doesn't take into account Numeric, Boolean, and Array values. I added this patch to make my basic case work: diff --git i/lib/puppet/parser/scope.rb w/lib/puppet/parser/scope.rb index 8d557e4..8546dae 100644 --- i/lib/puppet/parser/scope.rb +++ w/lib/puppet/parser/scope.rb @@ -599,15 +599,18 @@ class Puppet::Parser::Scope # def deep_freeze(object) case object +when Array + object.each {|v| deep_freeze(v) } + object.freeze when Hash object.each {|k, v| deep_freeze(k); deep_freeze(v) } object.freeze -when NilClass +when NilClass, Numeric, TrueClass, FalseClass # do nothing when String object.freeze else - raise
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker assigned an issue to Adrien Thebo Adrien Thebo might be the best one to take a look at this for an FR. I looked over it when merging, but Adrien's been working on facter 2 and so is more immediately familiar with facts right now. Puppet / PUP-542 Provide access to all facts in a single structure Change By: Andrew Parker Assignee: Andrew Parker Adrien Thebo Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker commented on an issue Re: Provide access to all facts in a single structure For FR: make sure that interaction with $trusted and --trusted_node_data is sane. Try adding new facts and see them get in. Look over the list and make sure that non-facts (aside from "local facts" of clientcert, clientversion, and clientnoop) don't appear in the structure. Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning. This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker commented on an issue Re: Provide access to all facts in a single structure Merged into master in 6ec652 Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning. This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker assigned an issue to Andrew Parker Puppet / PUP-542 Provide access to all facts in a single structure Change By: Andrew Parker Assignee: Andrew Parker Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Henrik Lindberg commented on an issue Re: Provide access to all facts in a single structure predocs pushed for this feature Add Comment Puppet / PUP-542 Provide access to all facts in a single structure The facts that are reported by the agent should be accessible via a top-scope {{$facts}} hash. The keys are the fact names and the values are the fact values. If this variable is shadowed in a scope the evaluator should emit a warning. This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Henrik Lindberg assigned an issue to Henrik Lindberg Puppet / PUP-542 Provide access to all facts in a single structure Change By: Henrik Lindberg Assignee: Henrik Lindberg Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
Jira (PUP-542) Provide access to all facts in a single structure
Title: Message Title Andrew Parker updated an issue Puppet / PUP-542 Provide access to all facts in a single structure Change By: Andrew Parker Sprint: Week 2014-2-19 to 2014-2-26 Add Comment This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.