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

Whits don't copy tags from the containers they replace

    Details

    • Template:
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      See PUP-6741 for release notes (this is a duplicate)

      Description

      When the agent converts containers (classes, defined types, etc) into Whits, tags that were present on the containers are not copied over to the Whits. This causes events generated by contained resources to be excluded by tag filters even though the container had the appropriate tags.

      Reproduction Case

      • Install Puppet 4.3.2
      • Create the following test manifest which passes a resource event to a refreshonly exec via a class:

      class foo {
        tag 'emitter'
       
        notify{'generating event in foo':}
      }
       
      class receiver {
        exec{'receiver exec':
          command     => '/bin/echo received event',
          logoutput   => true,
          refreshonly => true,
          subscribe   => Class['foo']
        }
      }
       
      include foo
      include receiver
      

      • Apply the manifest with --tags=emitter,receiver.

      Outcome

      All events for Class[foo] are de-scheduled, even though it is tagged with emitter:

      # /usr/local/bin/puppet apply --verbose --tags=emitter,receiver --client_datadir=$PWD --catalog_cache_terminus=json tag_test.pp
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Notice: Compiled catalog for pe-201531-master.puppetdebug.vlan in environment production in 0.09 seconds
      Info: Applying configuration version '1454105744'
      Notice: generating event in foo
      Notice: /Stage[main]/Foo/Notify[generating event in foo]/message: defined 'message' as 'generating event in foo'
      Info: Class[Foo]: Unscheduling all events on Class[Foo]
      Notice: Applied catalog in 0.16 seconds
       
      # cat catalog/$(hostname -f).json | python -c 'import sys, json; print [ c["tags"] for c in json.load(sys.stdin)["resources"] if c["title"] == "Foo" ]'
      [[u'class', u'foo', u'emitter']]
      

      Expected Outcome

      The refresh event is delivered to the exec via Class[foo]:

      # /usr/local/bin/puppet apply --verbose --tags=emitter,receiver tag_test.pp
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Info: Loading facts
      Notice: Compiled catalog for pe-201531-master.puppetdebug.vlan in environment production in 0.08 seconds
      Info: Applying configuration version '1454105856'
      Notice: generating event in foo
      Notice: /Stage[main]/Foo/Notify[generating event in foo]/message: defined 'message' as 'generating event in foo'
      Info: Class[Foo]: Scheduling refresh of Exec[receiver exec]
      Notice: /Stage[main]/Receiver/Exec[receiver exec]/returns: received event
      Notice: /Stage[main]/Receiver/Exec[receiver exec]: Triggered 'refresh' from 1 events
      Info: Stage[main]: Unscheduling all events on Stage[main]
      Notice: Applied catalog in 0.18 seconds
      

      Root Cause

      When the agent replaces Puppet containers (Classes, Stages, Defined Types) with Whits, tags are not copied from the container objects.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  chuck Charlie Sharpsteen
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support