Skip to content

(#13860) Autorequire Package['httpd'] #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/puppet/provider/a2mod/a2mod.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Puppet::Type.type(:a2mod).provide(:a2mod) do
desc "Manage Apache 2 modules on Debian and Ubuntu"
commands :encmd => "a2enmod"
commands :discmd => "a2dismod"

optional_commands :encmd => "a2enmod"
optional_commands :discmd => "a2dismod"

defaultfor :operatingsystem => [:debian, :ubuntu]

def create
encmd resource[:name]
end

def destroy
discmd resource[:name]
end

def exists?
mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load"
mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load"
File.exists?(mod)
end
end
8 changes: 6 additions & 2 deletions lib/puppet/type/a2mod.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Puppet::Type.newtype(:a2mod) do
@doc = "Manage Apache 2 modules on Debian and Ubuntu"

ensurable

newparam(:name) do
desc "The name of the module to be managed"

isnamevar

end
end

autorequire(:package) { catalog.resource(:package, 'httpd')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason that you can't just use:

autorequire(:package) { ['httpd'] }

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that was possible. I can change it to that if you'd prefer


end
end