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

regression: Code that doesn't compile with app_management=false does with app_management=true

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.7.0
    • Fix Version/s: PUP 4.8.0
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      2
    • Sprint:
      PDS 2016-10-05
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      A regression was found when app_management was turned on regarding testing if a file resource was defined or not and ending (or not ending) with a slash. The regression caused compilation with app_management to behave differently than when it was turned off. Now it behaves the same way.
      Show
      A regression was found when app_management was turned on regarding testing if a file resource was defined or not and ending (or not ending) with a slash. The regression caused compilation with app_management to behave differently than when it was turned off. Now it behaves the same way.

      Description

      app_management defaults to false, but when set to true, code that didn't compile previously now does.

      test.pp

      $dir='/tmp/test'
      $same_dir='/tmp/test/'
       
      file {$dir:
        ensure => directory
      }
       
      if !defined(File["${same_dir}"]) {
        file { $same_dir:
          ensure => directory
        }
      }
      

      alex@alex-VirtualBox:~$ puppet --version
      4.7.0
      

      Runs as expected:

      alex@alex-VirtualBox:~$ puppet apply test.pp --noop
      Notice: Compiled catalog for alex-virtualbox.example.com in environment production in 0.09 seconds
      Error: Cannot alias File[/tmp/test/] to ["/tmp/test"] at /home/alex/test.pp:9; resource ["File", "/tmp/test"] already declared at /home/alex/test.pp:4
      

      Runs as expected:

      alex@alex-VirtualBox:~$ puppet apply --no-app_management test.pp --noop
      Notice: Compiled catalog for alex-virtualbox.example.com in environment production in 0.09 seconds
      Error: Cannot alias File[/tmp/test/] to ["/tmp/test"] at /home/alex/test.pp:9; resource ["File", "/tmp/test"] already declared at /home/alex/test.pp:4
      

      Fails by not flagging the error:

      alex@alex-VirtualBox:~$ puppet apply --app_management test.pp --noop
      Notice: Compiled catalog for alex-virtualbox.example.com in environment production in 0.09 seconds
      Notice: /Stage[main]/Main/File[/tmp/test]/ensure: current_value absent, should be directory (noop)
      Notice: Class[Main]: Would have triggered 'refresh' from 1 events
      Notice: Stage[main]: Would have triggered 'refresh' from 1 events
      

      This is problematic as rspec-puppet now turns on this option even though most users will have it turned off. Code that should fail for most users passes spec testing.

      See https://github.com/rodjek/rspec-puppet/issues/417 and https://github.com/voxpupuli/puppet-staging/pull/113

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  alexjfisher Alexander Fisher
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: