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

Augeas fails when run with noop and directory doesn't exist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 3.4.2
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
    • Template:

      Description

      If you're trying to modify a file with augeas in a directory that doesn't exist (but would be created through dependencies), you get an error when run with --noop.

      To replicate, create a file like this:

      t.pp

      file { "/tmp/augtest":
        ensure => "directory",
      }
       
      file { "/tmp/augtest/foobar":
        ensure => "file",
        require => File["/tmp/augtest"],
      }
       
      augeas { "/tmp/augtest/foobar":
        lens    => "Spacevars.lns",
        incl    => "/tmp/augtest/foobar",
        changes => "set foo bar",
        require => File["/tmp/augtest/foobar"],
      }
      

      Then run this:

      rm -rf /tmp/augtest && puppet apply --noop t.pp
      

      And you get this:

      Notice: Compiled catalog for swillis-macbook-pro.local in environment production in 0.13 seconds
      Notice: /Stage[main]/Main/File[/tmp/augtest]/ensure: current_value absent, should be directory (noop)
      Notice: /Stage[main]/Main/File[/tmp/augtest/foobar]/ensure: current_value absent, should be file (noop)
      Error: /Stage[main]/Main/Augeas[/tmp/augtest/foobar]: Could not evaluate: Save failed with return code false, see debug
      Notice: Class[Main]: Would have triggered 'refresh' from 2 events
      Notice: Stage[main]: Would have triggered 'refresh' from 1 events
      Notice: Finished catalog run in 0.03 seconds
      

      When run without --noop you get a successful output:

      Notice: Compiled catalog for swillis-macbook-pro.local in environment production in 0.13 seconds
      Notice: /Stage[main]/Main/File[/tmp/augtest]/ensure: created
      Notice: /Stage[main]/Main/File[/tmp/augtest/foobar]/ensure: created
      Notice: /Stage[main]/Main/Augeas[/tmp/augtest/foobar]/returns: executed successfully
      

      Note that if you use /tmp/foobar as the file being modified by augeas, then you have no such issues, even if the file doesn't exist. Augeas should figure out a way to deal with a missing directory just like it does a missing file.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            swillis@compete.com Steven Willis
            QA Contact:
            Narmadha Perumal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support