diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-06 04:49:45 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-06 04:49:45 +0000 |
| commit | e309b76e168f83e27cf541dc19a02c5b25c1e47c (patch) | |
| tree | f5849a38377df2d719646c438d43ccdb9a99702f /lib/puppet/provider/package/apt.rb | |
| parent | c5ce953462f424138f0009ce978eb9620aff84a7 (diff) | |
| download | puppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.tar.gz puppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.tar.xz puppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.zip | |
Modifying the provider base class so that it defines a method for every used command (e.g., you call "commands :rpm => 'rpm'", and it defines an "rpm" method. I then pushed this throughout the package providers, which are the heaviest users of commands.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1571 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/package/apt.rb')
| -rwxr-xr-x | lib/puppet/provider/package/apt.rb | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index a31fbda2b..b4f94fb0c 100755 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -15,8 +15,8 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do # Debian boxes, and the only thing that differs is that it can # install packages from remote sites. - def apt - command(:aptget) + def aptcmd(arg) + aptget(arg) end def checkforcdrom @@ -55,23 +55,12 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do # Add the package version str += "=%s" % should end - cmd = "#{apt()} -q -y install %s" % str - - begin - output = execute(cmd) - rescue Puppet::ExecutionFailure - raise Puppet::PackageError.new(output) - end + aptcmd("-q -y install %s" % str) end # What's the latest package version available? def latest - cmd = "#{command(:aptcache)} showpkg %s" % @model[:name] - begin - output = execute(cmd) - rescue Puppet::ExecutionFailure - raise Puppet::PackageError.new(output) - end + output = aptcache("showpkg %s" % @model[:name] ) if output =~ /Versions:\s*\n((\n|.)+)^$/ versions = $1 @@ -104,12 +93,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do end def uninstall - cmd = "#{apt()} -y -q remove %s" % @model[:name] - begin - output = execute(cmd) - rescue Puppet::ExecutionFailure - raise Puppet::PackageError.new(output) - end + aptcmd("-y -q remove %s" % @model[:name]) end def versionable? |
