Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-2638

Puppet apply fails to write the graph if puppet agent has never run

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.2.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-06-10
    • Release Notes:
      Bug Fix

      Description

      Via ENTERPRISE-181:
      This is a general puppet platform issue. It can occur (on any platform) when all of the following are true:

      1. The `$vardir/state/graphs` directory doesn't exist
      2. The `graph` setting is true
      3. The agent has never run before

      Executing `puppet apply` will fail to write the catalog.

      On Windows (PE only), we set `graph` to true: https://github.com/puppetlabs/puppet_for_the_win/blob/master/wix/puppet.wxs#L302-L306.

      On *nix (PE only), we set `graph` to true: https://github.com/puppetlabs/enterprise-dist/blob/3.3.x/ext/erb/puppet.conf.erb#L52

      $ bundle exec puppet apply -e "notice 'foo'" --graphNotice: Scope(Class[main]): foo
      Notice: Compiled catalog for arcturus.luna.lan in environment production in 0.01 seconds
      Error: No such file or directory - /Users/josh/.puppet/var/state/graphs/resources.dot
      

      On Windows:

      C:\work\puppet [stable +1 ~0 -0 !]> bundle exec puppet apply -e "notice 'foo'" --graph --trace
      Notice: Scope(Class[main]): foo
      Notice: Compiled catalog for win-qp47voha2p4.solar.lan in environment production in 0.05 seconds
      Error: No such file or directory - C:/ProgramData/PuppetLabs/puppet/var/state/graphs/resources.dot
      C:/work/puppet/lib/puppet/graph/simple_graph.rb:474:in `initialize'
      C:/work/puppet/lib/puppet/graph/simple_graph.rb:474:in `open'
      C:/work/puppet/lib/puppet/graph/simple_graph.rb:474:in `write_graph'
      C:/work/puppet/lib/puppet/resource/catalog.rb:448:in `write_graph'
      C:/work/puppet/lib/puppet/resource/catalog.rb:231:in `finalize'
      C:/work/puppet/lib/puppet/application/apply.rb:219:in `block in main'
      C:/work/puppet/lib/puppet/context.rb:56:in `override'
      C:/work/puppet/lib/puppet.rb:234:in `override'
      C:/work/puppet/lib/puppet/application/apply.rb:190:in `main'
      C:/work/puppet/lib/puppet/application/apply.rb:151:in `run_command'
      C:/work/puppet/lib/puppet/application.rb:371:in `block (4 levels) in run'
      C:/work/puppet/lib/puppet/application.rb:479:in `plugin_hook'
      C:/work/puppet/lib/puppet/application.rb:371:in `block (3 levels) in run'
      C:/work/puppet/lib/puppet/util.rb:479:in `exit_on_fail'
      C:/work/puppet/lib/puppet/application.rb:371:in `block (2 levels) in run'
      C:/work/puppet/lib/puppet/context.rb:56:in `override'
      C:/work/puppet/lib/puppet.rb:234:in `override'
      C:/work/puppet/lib/puppet/application.rb:361:in `block in run'
      C:/work/puppet/lib/puppet/context.rb:56:in `override'
      C:/work/puppet/lib/puppet.rb:234:in `override'
      C:/work/puppet/lib/puppet/application.rb:356:in `run'
      C:/work/puppet/lib/puppet/util/command_line.rb:137:in `run'
      C:/work/puppet/lib/puppet/util/command_line.rb:91:in `execute'
      C:/work/puppet/bin/puppet:4:in `<top (required)>'
      C:/work/puppet/.bundle/gems/ruby/1.9.1/bin/puppet:23:in `load'
      C:/work/puppet/.bundle/gems/ruby/1.9.1/bin/puppet:23:in `<main>'
      

      The problem is that the code that writes the graph, Catalog.write_graph, executes before the code that creates the necessary directories, Puppet.settings.use(:agent).

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  l.smith Lindsey Smith
                  QA Contact:
                  Eric Thompson
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 0 minutes
                    0m
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h