Issue #8757 has been updated by Matt Dainty.
I've just hit this bug with 2.7.12 trying to use the resources type to purge
unwanted mailaliases and then rebuild the alias database. The following example
seems enough to trigger it:
<pre>
exec { "newaliases":
refreshonly => true,
}
# Catch mailaliases defined elsewhere
Mailalias <||> ~> Exec["newaliases"]
# Keep the couple of aliases that should be present
mailalias { "postmaster":
ensure => present,
recipient => "root",
}
mailalias { "mailer-daemon":
ensure => present,
recipient => "postmaster",
}
# Purge everything else
resources { "mailalias":
purge => true,
notify => Exec["newaliases"],
}
</pre>
The resources resource neither triggers the exec nor obeys the ordering, the
exec will correctly fire after an alias is added but while unwanted aliases are
still being purged.
----------------------------------------
Bug #8757: Resources type and metaparameters don't seem to work, specifically
notify.
https://projects.puppetlabs.com/issues/8757#change-59771
Author: Matt Pascoe
Status: Needs More Information
Priority: Normal
Assignee: Matt Pascoe
Category: metaparameters
Target version:
Affected Puppet version: 0.25.0
Keywords: resources purge a2mod apache
Branch:
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.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.