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

Generated resources never receive dependency edges

    Details

    • Template:
    • Story Points:
      3
    • Sprint:
      Client 2015-09-16, Client 2015-09-30, Client 2015-10-14, Client 2015-10-28, Client 2015-11-11
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Resources created by another type (via the `generate` method) will now have any relationship metaparams respected, and will participate in `autorequire`

      Description

      I've preserved the original description below for posterity. Note however that this issue is now tracking only the first (of two) issues described in the original problem report.


      First off I will quickly explain what it is I'm trying to do. I have installed the puppetlabs-apache-0.0.3 module that provides a new type called a2mod. My goal is to use virtual resources to collect a list of modules to enable/disable on a node. I would also however, like to ensure that all other apache modules are disabled on the system. I found the resources type has a purge option. I then updated the provider to have an instances section since it did not have one. It looks like this:

          class << self
              attr_accessor :defpath
          end
       
          @defpath = "/etc/apache2/mods-available/"
       
          def self.instances
              self.defpath = [self.defpath] unless self.defpath.is_a? Array
       
              instances = []
       
              self.defpath.each do |path|
                  unless FileTest.directory?(path)
                      Puppet.debug "Apache module path %s does not exist" % path
                      next
                  end
       
                  check = [:ensure]
       
                  if public_method_defined? :enabled?
                      check << :enable
                  end
       
                  Dir.entries(path).each do |name|
                      if name =~ /.load/
                          name = name.sub(".load","")
                          instances << new(:name => name, :path => path)
                      end
                  end
              end
              instances
          end
      

      I then used the resources type to purge out unused apache modules. This seemingly does the job I wanted it to do. However, I wanted to notify my apache to restart if it had disabled any modules. I added the notify metaparameter to the configuration but it would never notify.

          resources { 'a2mod': tag => 'modtest', notify => Exec['apache2reload'], purge => true, loglevel => 'notice' }
      

      I then tried to add a tag for testing purposes and it would not see the tag being set. I could however use loglevel but it would seem other metaparameters would not work properly. I'm assuming that all parameters on http://docs.puppetlabs.com/references/stable/metaparameter.html should be available to the resources type as indicated by the documentation for the resources type.

      So, I'm wanting to understand if "all" metaparameters should work with the resources type or not. And, is there any possible way to do a purge that would allow me to do a notify of another resource.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  redmine.exporter redmine.exporter
                  QA Contact:
                  Eric Thompson
                • Votes:
                  4 Vote for this issue
                  Watchers:
                  24 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: