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

Virtual resources receive resource defaults from scope of realization

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Language
    • Labels:

      Description

      The intent of virtual resources is to define a resource in one place and later be able to reference back to it and realize it.

      This model is broken due to resource defaults in the scope of virtual resource collectors being applied to the realized resources. For example:

      class test {
        include test::scope1
      }
       
      class test::symlinks {
        @file { '/tmp/symlink1':
          ensure => symlink,
          target => '/bin/true',
        }
      }
       
      class test::scope1 {
        File { owner => 'nobody' }
        include test::symlinks
        File <| title == '/tmp/symlink1' |>
      }
       
      include test
      

      The File[/tmp/symlink1] virtual resource is defined in the test::symlinks class and no resource defaults are in scope. It does not specify an owner.

      The test::scope1 class calls include on the test::symlinks class, and then uses a collector to realize file resources with the title "/tmp/symlink1".

      The desired result is that File[/tmp/symlink1] will be realized exactly as it is declared in test::symlinks.

      The actual result is that because test::scope1 has a file resource default for owner=nobody, the file will be created with that owner, and Puppet will enforce that owner if local changes are made on the system.

      Resource defaults should apply only to resources or virtual resources declared, and not to virtual resources realized or collected.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              reid Reid Vandewiele
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support