Jira (PUP-2757) Apply parses everything twice
Title: Message Title Kurt Wall updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Kurt Wall QA Status: Reviewed 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Kurt Wall commented on an issue Re: Apply parses everything twice Verified in master at SHA=NN. apply does not appear to evaluate things twice: breve:puppet kwall$ be puppet apply -e 'notify {jenny i got your number:}' --debug --trace --verbose Debug: Runtime environment: puppet_version=3.6.2, ruby_version=2.0.0, run_mode=user, default_encoding=UTF-8 Info: Loading external facts from /Users/kwall/.puppet/var/facts.d Already evaluated rest at /Users/kwall/repos/puppet/.bundle/ruby/2.0.0/gems/facter-2.1.0-universal-darwin/lib/facter/ec2.rb:4, reevaluating anyways Already evaluated rest at /Users/kwall/repos/puppet/.bundle/ruby/2.0.0/gems/facter-2.1.0-universal-darwin/lib/facter/ec2.rb:21, reevaluating anyways Already evaluated rest at /Users/kwall/repos/puppet/.bundle/ruby/2.0.0/gems/facter-2.1.0-universal-darwin/lib/facter/gce.rb:4, reevaluating anyways Notice: Compiled catalog for breve.corp.puppetlabs.net in environment production in 0.03 seconds Debug: Creating default schedules Debug: Failed to load library 'selinux' for feature 'selinux' Debug: Using settings: adding file resource 'confdir': 'File[/Users/kwall/.puppet]{:path=/Users/kwall/.puppet, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'vardir': 'File[/Users/kwall/.puppet/var]{:path=/Users/kwall/.puppet/var, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'logdir': 'File[/Users/kwall/.puppet/var/log]{:path=/Users/kwall/.puppet/var/log, :mode=750, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'statedir': 'File[/Users/kwall/.puppet/var/state]{:path=/Users/kwall/.puppet/var/state, :mode=1755, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'rundir': 'File[/Users/kwall/.puppet/var/run]{:path=/Users/kwall/.puppet/var/run, :mode=755, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'libdir': 'File[/Users/kwall/.puppet/var/lib]{:path=/Users/kwall/.puppet/var/lib, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'certdir': 'File[/Users/kwall/.puppet/ssl/certs]{:path=/Users/kwall/.puppet/ssl/certs, :mode=755, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'ssldir': 'File[/Users/kwall/.puppet/ssl]{:path=/Users/kwall/.puppet/ssl, :mode=771, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'publickeydir': 'File[/Users/kwall/.puppet/ssl/public_keys]{:path=/Users/kwall/.puppet/ssl/public_keys, :mode=755, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'requestdir': 'File[/Users/kwall/.puppet/ssl/certificate_requests]{:path=/Users/kwall/.puppet/ssl/certificate_requests, :mode=755, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'privatekeydir': 'File[/Users/kwall/.puppet/ssl/private_keys]{:path=/Users/kwall/.puppet/ssl/private_keys, :mode=750, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'privatedir': 'File[/Users/kwall/.puppet/ssl/private]{:path=/Users/kwall/.puppet/ssl/private, :mode=750, :ensure=:directory, :loglevel=:debug, :links=:follow, :backup=false}' Debug: Using settings: adding file resource 'localcacert': 'File[/Users/kwall/.puppet/ssl/certs/ca.pem]{:path=/Users/kwall/.puppet/ssl/certs/ca.pem, :mode=644, :ensure=:file,
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg commented on an issue Re: Apply parses everything twice PR 2905 merged to master 19557f1 Add Comment Puppet / PUP-2757 Apply parses everything twice When the runtime creates {{Puppet::Resource}} instances, an attempt is made to lookup its type. This means that code will attempt to lookup the type in {{known_resource_types}}. If {{known_resource_type}} is nil, the runtime will issue a call to {{initial_import}} which is the starting point of parsing and evaluating code. The {{Puppet::Resource#envron... 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Charlie Sharpsteen updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Charlie Sharpsteen Assignee: CharlieSharpsteen 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Charlie Sharpsteen commented on an issue Re: Apply parses everything twice Tested by applying a tracing patch to track the invocations of perform_initial_import: trace_env_import.patch diff --git a/bin/puppet b/bin/puppet index c80174f..933e034 100755 --- a/bin/puppet +++ b/bin/puppet @@ -4,5 +4,21 @@ # This is primarily for 1.8.7 since 1.9.2+ doesn't put '.' on the load path $LOAD_PATH.delete '.' +set_trace_func proc {|event, file, line, id, binding, classname| + # Sometimes we get a nil binding for strange reasons... + next if binding.nil? + # Only process method calls + next unless event == 'call' + # Only process calls to load or require. + next unless [:perform_initial_import].include? id + + env_name = binding.eval('self.name') + + # Print tracing information. + puts debug #{event}: #{id} #{file}:#{line} + puts \t Environment name: #{env_name} + caller.each{|l| puts \t#{l}} +} + require 'puppet/util/command_line' Puppet::Util::CommandLine.new.execute The initial behavior of puppet apply contained two imports during the compile phase: Puppet Commit 7e69be3 [root@poss-head-centos ~]# puppet apply -e 'notify{hello, world!:}' debug call: perform_initial_import /puppetlabs/puppet/lib/puppet/node/environment.rb:518 Environment name: production /puppetlabs/puppet/lib/puppet/node/environment.rb:518:in `perform_initial_import' /puppetlabs/puppet/lib/puppet/node/environment.rb:255:in `known_resource_types' /puppetlabs/puppet/lib/puppet/resource/type_collection_helper.rb:5:in `known_resource_types' /puppetlabs/puppet/lib/puppet/parser/compiler.rb:543:in `block in initvars' /puppetlabs/puppet/lib/puppet/context.rb:64:in `override' /puppetlabs/puppet/lib/puppet.rb:237:in `override' /puppetlabs/puppet/lib/puppet/parser/compiler.rb:541:in `initvars' /puppetlabs/puppet/lib/puppet/parser/compiler.rb:239:in `initialize' /puppetlabs/puppet/lib/puppet/parser/compiler.rb:23:in `new' /puppetlabs/puppet/lib/puppet/parser/compiler.rb:23:in `compile' /puppetlabs/puppet/lib/puppet/indirector/catalog/compiler.rb:95:in `block (2 levels) in compile' /puppetlabs/puppet/lib/puppet/util/profiler/around_profiler.rb:58:in `profile' /puppetlabs/puppet/lib/puppet/util/profiler.rb:51:in `profile' /puppetlabs/puppet/lib/puppet/indirector/catalog/compiler.rb:93:in `block in compile' /puppetlabs/puppet/lib/puppet/util.rb:161:in `block in benchmark' /opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:295:in `realtime' /puppetlabs/puppet/lib/puppet/util.rb:160:in `benchmark' /puppetlabs/puppet/lib/puppet/indirector/catalog/compiler.rb:92:in `compile' /puppetlabs/puppet/lib/puppet/indirector/catalog/compiler.rb:52:in `find' /puppetlabs/puppet/lib/puppet/indirector/indirection.rb:201:in `find' /puppetlabs/puppet/lib/puppet/application/apply.rb:215:in `block in main' /puppetlabs/puppet/lib/puppet/context.rb:64:in `override' /puppetlabs/puppet/lib/puppet.rb:237:in `override' /puppetlabs/puppet/lib/puppet/application/apply.rb:191:in `main'
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Joshua Partlow assigned an issue to Joshua Partlow Puppet / PUP-2757 Apply parses everything twice Change By: Joshua Partlow Assignee: JoshuaPartlow 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Kylo Ginsberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Kylo Ginsberg Sprint: 2014-07-23 ,2014-08-06 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Joshua Partlow commented on an issue Re: Apply parses everything twice Updated the PR to check whether the environment is truly new before pushing it onto the context. Add Comment Puppet / PUP-2757 Apply parses everything twice When the runtime creates {{Puppet::Resource}} instances, an attempt is made to lookup its type. This means that code will attempt to lookup the type in {{known_resource_types}}. If {{known_resource_type}} is nil, the runtime will issue a call to {{initial_import}} which is the starting point of parsing and evaluating code. The {{Puppet::Resource#envron... 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Joshua Partlow assigned an issue to Joshua Partlow Puppet / PUP-2757 Apply parses everything twice Change By: Joshua Partlow Assignee: JoshuaPartlow 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg assigned an issue to Henrik Lindberg Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Assignee: HenrikLindberg 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Assignee: HenrikLindberg JoshuaPartlow 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Charlie Sharpsteen assigned an issue to Charlie Sharpsteen Puppet / PUP-2757 Apply parses everything twice Change By: Charlie Sharpsteen Assignee: CharlieSharpsteen 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Joshua Partlow commented on an issue Re: Apply parses everything twice Merged to master in a50a64b Add Comment Puppet / PUP-2757 Apply parses everything twice When the runtime creates {{Puppet::Resource}} instances, an attempt is made to lookup its type. This means that code will attempt to lookup the type in {{known_resource_types}}. If {{known_resource_type}} is nil, the runtime will issue a call to {{initial_import}} which is the starting point of parsing and evaluating code. The {{Puppet::Resource#envron... 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Assignee: JoshuaPartlow 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Story Points: 0 1 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Josh Cooper updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Josh Cooper Assignee: HenrikLindberg 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Andy Parker updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Andy Parker Story Points: 0 1 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Andy Parker updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Andy Parker Story Points: 1 0 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Sprint: Week2014-7-9to2014-7-23 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-2757 Apply parses everything twice Change By: Henrik Lindberg Story Points: 0 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg commented on an issue Re: Apply parses everything twice Ready for merge as part of PR-2749 for PUP-2714 Add Comment Puppet / PUP-2757 Apply parses everything twice When the runtime creates {{Puppet::Resource}} instances, an attempt is made to lookup its type. This means that code will attempt to lookup the type in {{known_resource_types}}. If {{known_resource_type}} is nil, the runtime will issue a call to {{initial_import}} which is the starting point of parsing and evaluating code. The {{Puppet::Resource#envron... 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/d/optout.
Jira (PUP-2757) Apply parses everything twice
Title: Message Title Henrik Lindberg created an issue Puppet / PUP-2757 Apply parses everything twice Issue Type: Bug Assignee: Andy Parker Components: DSL Created: 11/Jun/14 1:27 PM Fix Versions: 3.7.0 Priority: Normal Reporter: Henrik Lindberg When the runtime creates Puppet::Resource instances, an attempt is made to lookup its type. This means that code will attempt to lookup the type in known_resource_types. If known_resource_type is nil, the runtime will issue a call to initial_import which is the starting point of parsing and evaluating code. The Puppet::Resource#envronment method attempts to figure out which environment to use (since that hold on to known_resource_type by looking at the resource instance's catalog's environment. The problem is when resource instances are created for the purpose of acting as a reference to a resource (rather than the instance itself), since such references are never contained in a Catalog per se. The environment method used a synthetic environment called NONE internally, and when NONE is not initialized the initial_import ill be called to again perform parsing. This is fixed in this commit: https://github.com/hlindberg/puppet/commit/3ab10bc6ffe724a204e0fd2d1df0e651c9d93d66 as part of PUP-2714, where this problem was detected. Currently, the fix is is part