We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ef4a6a commit 04b789dCopy full SHA for 04b789d
puppet-pkg
@@ -0,0 +1,33 @@
1
+#!/usr/bin/ruby
2
+require 'puppet'
3
+
4
+# simple example of using a puppet type and providers
5
+# to hide implementation details.
6
+# This script isn't that robust.
7
8
+pkg_action = ARGV.shift
9
+pkg_name = ARGV.shift
10
11
+# ppp = instance of the puppet package provider
12
+ppp = Puppet::Type.type(:package).new(:name => pkg_name).provider
13
14
+case pkg_action
15
+ when "remove", "delete", "uninstall"
16
+ ppp.purge
17
+ when "install"
18
+ ppp.install
19
+ when "update", "upgrade"
20
+ ppp.update
21
+ when "status"
22
+ if ppp.properties[:ensure] == :absent
23
+ puts "Failed to find #{pkg_name}"
24
+ else
25
+ puts pkg_name
26
+ ppp.properties.each_pair do |k,v|
27
+ puts " - #{k} => #{v}"
28
+ end
29
30
31
+ puts "Don't know how to '#{pkg_action}'"
32
+ exit 1
33
0 commit comments