puppet 0.16.0 → 0.18.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +98 -0
- data/Rakefile +5 -1
- data/bin/puppet +1 -1
- data/bin/puppetca +25 -11
- data/bin/puppetd +189 -66
- data/bin/puppetdoc +79 -62
- data/bin/puppetmasterd +93 -49
- data/bin/puppetrun +385 -0
- data/conf/redhat/client.init +5 -2
- data/conf/redhat/fileserver.conf +1 -1
- data/conf/redhat/lsb-config.patch +51 -0
- data/conf/redhat/puppet.spec +45 -18
- data/conf/redhat/puppetd.conf +32 -4
- data/conf/redhat/server.init +5 -2
- data/conf/solaris/pkginfo +7 -0
- data/conf/solaris/smf/puppetd.xml +77 -0
- data/conf/solaris/smf/puppetmasterd.xml +77 -0
- data/conf/solaris/smf/svc-puppetd +66 -0
- data/conf/solaris/smf/svc-puppetmasterd +62 -0
- data/examples/code/failers/noobjectrvalue +1 -0
- data/examples/code/snippets/deepclassheirarchy.pp +23 -0
- data/examples/code/snippets/defineoverrides.pp +17 -0
- data/examples/code/snippets/emptyexec.pp +3 -0
- data/examples/code/snippets/selectorvalues.pp +6 -1
- data/examples/code/snippets/tagged.pp +35 -0
- data/ext/ldap/puppet.schema +2 -2
- data/install.rb +4 -2
- data/lib/puppet.rb +206 -15
- data/lib/puppet/client.rb +30 -20
- data/lib/puppet/client/ca.rb +2 -2
- data/lib/puppet/client/dipper.rb +5 -9
- data/lib/puppet/client/master.rb +224 -44
- data/lib/puppet/client/pelement.rb +54 -9
- data/lib/puppet/client/proxy.rb +3 -2
- data/lib/puppet/client/reporter.rb +34 -0
- data/lib/puppet/client/runner.rb +17 -0
- data/lib/puppet/config.rb +136 -55
- data/lib/puppet/daemon.rb +59 -37
- data/lib/puppet/element.rb +2 -1
- data/lib/puppet/event.rb +14 -3
- data/lib/puppet/filetype.rb +28 -19
- data/lib/puppet/log.rb +297 -132
- data/lib/puppet/metric.rb +31 -131
- data/lib/puppet/networkclient.rb +73 -46
- data/lib/puppet/parameter.rb +49 -1
- data/lib/puppet/parsedfile.rb +32 -12
- data/lib/puppet/parser/ast.rb +6 -1
- data/lib/puppet/parser/ast/astarray.rb +32 -6
- data/lib/puppet/parser/ast/collection.rb +91 -0
- data/lib/puppet/parser/ast/compdef.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +24 -11
- data/lib/puppet/parser/ast/function.rb +50 -0
- data/lib/puppet/parser/ast/hostclass.rb +70 -22
- data/lib/puppet/parser/ast/node.rb +17 -8
- data/lib/puppet/parser/ast/nodedef.rb +1 -1
- data/lib/puppet/parser/ast/objectdef.rb +28 -10
- data/lib/puppet/parser/ast/selector.rb +4 -1
- data/lib/puppet/parser/functions.rb +145 -0
- data/lib/puppet/parser/interpreter.rb +243 -86
- data/lib/puppet/parser/lexer.rb +5 -4
- data/lib/puppet/parser/parser.rb +586 -505
- data/lib/puppet/parser/scope.rb +337 -187
- data/lib/puppet/rails.rb +115 -0
- data/lib/puppet/rails/database.rb +40 -0
- data/lib/puppet/rails/host.rb +83 -0
- data/lib/puppet/rails/rails_object.rb +42 -0
- data/lib/puppet/rails/rails_parameter.rb +5 -0
- data/lib/puppet/reports/rrdgraph.rb +20 -0
- data/lib/puppet/reports/tagmail.rb +94 -0
- data/lib/puppet/server.rb +20 -4
- data/lib/puppet/server/authconfig.rb +14 -3
- data/lib/puppet/server/authstore.rb +2 -2
- data/lib/puppet/server/ca.rb +23 -11
- data/lib/puppet/server/filebucket.rb +10 -10
- data/lib/puppet/server/fileserver.rb +4 -8
- data/lib/puppet/server/master.rb +19 -22
- data/lib/puppet/server/pelement.rb +28 -16
- data/lib/puppet/server/report.rb +184 -0
- data/lib/puppet/server/runner.rb +62 -0
- data/lib/puppet/server/servlet.rb +23 -9
- data/lib/puppet/sslcertificates/ca.rb +25 -1
- data/lib/puppet/statechange.rb +34 -53
- data/lib/puppet/storage.rb +1 -2
- data/lib/puppet/transaction.rb +305 -133
- data/lib/puppet/transaction/report.rb +42 -0
- data/lib/puppet/transportable.rb +57 -33
- data/lib/puppet/type.rb +260 -127
- data/lib/puppet/type/component.rb +9 -21
- data/lib/puppet/type/cron.rb +367 -116
- data/lib/puppet/type/exec.rb +15 -16
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/nameservice.rb +2 -5
- data/lib/puppet/type/nameservice/netinfo.rb +3 -0
- data/lib/puppet/type/nameservice/objectadd.rb +23 -10
- data/lib/puppet/type/nameservice/pw.rb +16 -3
- data/lib/puppet/type/package.rb +25 -75
- data/lib/puppet/type/package/apple.rb +15 -1
- data/lib/puppet/type/package/apt.rb +37 -2
- data/lib/puppet/type/package/blastwave.rb +136 -0
- data/lib/puppet/type/package/dpkg.rb +4 -4
- data/lib/puppet/type/package/gem.rb +119 -0
- data/lib/puppet/type/package/openbsd.rb +7 -6
- data/lib/puppet/type/package/ports.rb +7 -2
- data/lib/puppet/type/package/rpm.rb +1 -1
- data/lib/puppet/type/package/sun.rb +23 -9
- data/lib/puppet/type/package/sunfreeware.rb +7 -0
- data/lib/puppet/type/package/yum.rb +16 -9
- data/lib/puppet/type/parsedtype.rb +7 -5
- data/lib/puppet/type/parsedtype/mount.rb +55 -34
- data/lib/puppet/type/parsedtype/port.rb +7 -1
- data/lib/puppet/type/parsedtype/sshkey.rb +6 -16
- data/lib/puppet/type/pfile.rb +115 -23
- data/lib/puppet/type/pfile/checksum.rb +18 -5
- data/lib/puppet/type/pfile/content.rb +2 -2
- data/lib/puppet/type/pfile/ensure.rb +3 -3
- data/lib/puppet/type/pfile/group.rb +2 -2
- data/lib/puppet/type/pfile/source.rb +28 -17
- data/lib/puppet/type/pfile/target.rb +25 -17
- data/lib/puppet/type/pfilebucket.rb +25 -6
- data/lib/puppet/type/schedule.rb +6 -6
- data/lib/puppet/type/service.rb +24 -14
- data/lib/puppet/type/service/debian.rb +1 -1
- data/lib/puppet/type/service/redhat.rb +13 -10
- data/lib/puppet/type/service/smf.rb +3 -3
- data/lib/puppet/type/state.rb +1 -2
- data/lib/puppet/type/symlink.rb +3 -4
- data/lib/puppet/type/user.rb +22 -10
- data/lib/puppet/type/yumrepo.rb +6 -1
- data/lib/puppet/type/zone.rb +595 -0
- data/lib/puppet/util.rb +58 -12
- data/test/client/client.rb +2 -2
- data/test/client/master.rb +92 -3
- data/test/client/pelement.rb +99 -0
- data/test/executables/puppetbin.rb +3 -4
- data/test/executables/puppetca.rb +3 -3
- data/test/executables/puppetd.rb +3 -3
- data/test/executables/puppetmasterd.rb +1 -5
- data/test/executables/puppetmodule.rb +2 -2
- data/test/language/ast.rb +200 -11
- data/test/language/functions.rb +245 -0
- data/test/language/interpreter.rb +155 -6
- data/test/language/lexer.rb +35 -2
- data/test/language/node.rb +48 -1
- data/test/language/parser.rb +250 -1
- data/test/language/rails.rb +105 -0
- data/test/language/scope.rb +304 -10
- data/test/language/snippets.rb +54 -5
- data/test/language/transportable.rb +60 -28
- data/test/other/config.rb +214 -1
- data/test/other/events.rb +67 -9
- data/test/other/log.rb +31 -5
- data/test/other/metrics.rb +23 -21
- data/test/other/parsedfile.rb +29 -2
- data/test/other/puppet.rb +79 -0
- data/test/other/report.rb +106 -0
- data/test/other/storage.rb +2 -2
- data/test/other/transactions.rb +128 -2
- data/test/puppet/utiltest.rb +10 -5
- data/test/puppettest.rb +193 -21
- data/test/server/authstore.rb +13 -4
- data/test/server/bucket.rb +33 -8
- data/test/server/ca.rb +44 -6
- data/test/server/master.rb +6 -7
- data/test/server/pelement.rb +15 -5
- data/test/server/report.rb +93 -0
- data/test/server/runner.rb +107 -0
- data/test/server/server.rb +28 -1
- data/test/types/cron.rb +339 -31
- data/test/types/file.rb +256 -24
- data/test/types/filebucket.rb +6 -2
- data/test/types/filesources.rb +41 -92
- data/test/types/group.rb +31 -1
- data/test/types/host.rb +2 -1
- data/test/types/mount.rb +18 -1
- data/test/types/package.rb +200 -18
- data/test/types/service.rb +5 -1
- data/test/types/sshkey.rb +2 -1
- data/test/types/symlink.rb +3 -2
- data/test/types/type.rb +180 -1
- data/test/types/user.rb +65 -27
- data/test/types/yumrepo.rb +15 -0
- data/test/types/zone.rb +437 -0
- metadata +43 -4
- data/bin/cf2puppet +0 -186
- data/conf/redhat/puppetmasterd.conf +0 -5
@@ -1,14 +1,41 @@
|
|
1
1
|
module Puppet
|
2
2
|
Puppet.type(:package).newpkgtype(:apt, :dpkg) do
|
3
|
+
ENV['DEBIAN_FRONTEND'] = "noninteractive"
|
4
|
+
|
5
|
+
|
6
|
+
|
3
7
|
# A derivative of DPKG; this is how most people actually manage
|
4
8
|
# Debian boxes, and the only thing that differs is that it can
|
5
9
|
# install packages from remote sites.
|
6
10
|
|
11
|
+
def checkforcdrom
|
12
|
+
unless defined? @@checkedforcdrom
|
13
|
+
if FileTest.exists? "/etc/apt/sources.list"
|
14
|
+
if File.read("/etc/apt/sources.list") =~ /^[^#]*cdrom:/
|
15
|
+
@@checkedforcdrom = true
|
16
|
+
else
|
17
|
+
@@checkedforcdrom = false
|
18
|
+
end
|
19
|
+
else
|
20
|
+
# This is basically a pathalogical case, but we'll just
|
21
|
+
# ignore it
|
22
|
+
@@checkedforcdrom = false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if @@checkedforcdrom and self[:allowcdrom] != :true
|
27
|
+
raise Puppet::Error,
|
28
|
+
"/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
7
32
|
# Install a package using 'apt-get'. This function needs to support
|
8
33
|
# installing a specific version.
|
9
34
|
def install
|
10
35
|
should = self.should(:ensure)
|
11
36
|
|
37
|
+
checkforcdrom()
|
38
|
+
|
12
39
|
str = self[:name]
|
13
40
|
case should
|
14
41
|
when true, false, Symbol
|
@@ -17,7 +44,7 @@ module Puppet
|
|
17
44
|
# Add the package version
|
18
45
|
str += "=%s" % should
|
19
46
|
end
|
20
|
-
cmd = "apt-get -q -y install %s" % str
|
47
|
+
cmd = "/usr/bin/apt-get -q -y install %s" % str
|
21
48
|
|
22
49
|
self.info "Executing %s" % cmd.inspect
|
23
50
|
output = %x{#{cmd} 2>&1}
|
@@ -29,7 +56,7 @@ module Puppet
|
|
29
56
|
|
30
57
|
# What's the latest package version available?
|
31
58
|
def latest
|
32
|
-
cmd = "apt-cache showpkg %s" % self[:name]
|
59
|
+
cmd = "/usr/bin/apt-cache showpkg %s" % self[:name]
|
33
60
|
self.info "Executing %s" % cmd.inspect
|
34
61
|
output = %x{#{cmd} 2>&1}
|
35
62
|
|
@@ -65,6 +92,14 @@ module Puppet
|
|
65
92
|
self.install
|
66
93
|
end
|
67
94
|
|
95
|
+
def uninstall
|
96
|
+
cmd = "/usr/bin/apt-get -y -q remove %s" % self[:name]
|
97
|
+
output = %x{#{cmd} 2>&1}
|
98
|
+
if $? != 0
|
99
|
+
raise Puppet::PackageError.new(output)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
68
103
|
def versionable?
|
69
104
|
true
|
70
105
|
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Puppet
|
2
|
+
Puppet.type(:package).newpkgtype(:blastwave, :sun) do
|
3
|
+
if pkgget = %x{which pkg-get 2>/dev/null}.chomp and pkgget != ""
|
4
|
+
@@pkgget = pkgget
|
5
|
+
else
|
6
|
+
@@pkgget = nil
|
7
|
+
end
|
8
|
+
|
9
|
+
# This is so stupid
|
10
|
+
ENV["PAGER"] = "/usr/bin/cat"
|
11
|
+
|
12
|
+
def self.extended(mod)
|
13
|
+
unless @@pkgget
|
14
|
+
raise Puppet::Error,
|
15
|
+
"The pkg-get command is missing; blastwave packaging unavailable"
|
16
|
+
end
|
17
|
+
|
18
|
+
unless FileTest.exists?("/var/pkg-get/admin")
|
19
|
+
Puppet.notice "It is highly recommended you create '/var/pkg-get/admin'."
|
20
|
+
Puppet.notice "See /var/pkg-get/admin-fullauto"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Turn our blastwave listing into a bunch of hashes.
|
25
|
+
def blastlist(hash)
|
26
|
+
command = "#{@@pkgget} -c"
|
27
|
+
|
28
|
+
if hash[:justme]
|
29
|
+
command += " " + self[:name]
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
output = execute(command)
|
34
|
+
rescue ExecutionFailure => detail
|
35
|
+
raise Puppet::Error, "Could not get package listing: %s" %
|
36
|
+
detail
|
37
|
+
end
|
38
|
+
|
39
|
+
list = output.split("\n").collect do |line|
|
40
|
+
next if line =~ /^#/
|
41
|
+
next if line =~ /^WARNING/
|
42
|
+
next if line =~ /localrev\s+remoterev/
|
43
|
+
|
44
|
+
blastsplit(line)
|
45
|
+
end.reject { |h| h.nil? }
|
46
|
+
|
47
|
+
if hash[:justme]
|
48
|
+
return list[0]
|
49
|
+
else
|
50
|
+
list.reject! { |h|
|
51
|
+
h[:ensure] == :absent
|
52
|
+
}
|
53
|
+
return list
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# Split the different lines into hashes.
|
59
|
+
def blastsplit(line)
|
60
|
+
if line =~ /\s*(\S+)\s+((\[Not installed\])|(\S+))\s+(\S+)/
|
61
|
+
hash = {}
|
62
|
+
hash[:name] = $1
|
63
|
+
hash[:ensure] = if $2 == "[Not installed]"
|
64
|
+
:absent
|
65
|
+
else
|
66
|
+
$2
|
67
|
+
end
|
68
|
+
hash[:avail] = $5
|
69
|
+
|
70
|
+
if hash[:avail] == "SAME"
|
71
|
+
hash[:avail] = hash[:ensure]
|
72
|
+
end
|
73
|
+
hash[:type] = :blastwave
|
74
|
+
|
75
|
+
return hash
|
76
|
+
else
|
77
|
+
Puppet.warning "Cannot match %s" % line
|
78
|
+
return nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
module_function :blastlist, :blastsplit
|
83
|
+
|
84
|
+
def install
|
85
|
+
begin
|
86
|
+
execute("#{@@pkgget} -f install #{self[:name]}")
|
87
|
+
rescue ExecutionFailure => detail
|
88
|
+
raise Puppet::Error,
|
89
|
+
"Could not install %s: %s" %
|
90
|
+
[self[:name], detail]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Retrieve the version from the current package file.
|
95
|
+
def latest
|
96
|
+
hash = blastlist(:justme => true)
|
97
|
+
hash[:avail]
|
98
|
+
end
|
99
|
+
|
100
|
+
def list(hash = {})
|
101
|
+
blastlist(hash).each do |bhash|
|
102
|
+
bhash.delete(:avail)
|
103
|
+
Puppet::Type.type(:package).installedpkg(bhash)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def query
|
108
|
+
hash = blastlist(:justme => true)
|
109
|
+
|
110
|
+
{:ensure => hash[:ensure]}
|
111
|
+
end
|
112
|
+
|
113
|
+
# Remove the old package, and install the new one
|
114
|
+
def update
|
115
|
+
begin
|
116
|
+
execute("#{@@pkgget} -f upgrade #{self[:name]}")
|
117
|
+
rescue ExecutionFailure => detail
|
118
|
+
raise Puppet::Error,
|
119
|
+
"Could not upgrade %s: %s" %
|
120
|
+
[self[:name], detail]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def uninstall
|
125
|
+
begin
|
126
|
+
execute("#{@@pkgget} -f remove #{self[:name]}")
|
127
|
+
rescue ExecutionFailure => detail
|
128
|
+
raise Puppet::Error,
|
129
|
+
"Could not remove %s: %s" %
|
130
|
+
[self[:name], detail]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# $Id: blastwave.rb 1382 2006-07-11 16:27:42Z luke $
|
@@ -12,7 +12,7 @@ module Puppet
|
|
12
12
|
|
13
13
|
hash = {}
|
14
14
|
# list out our specific package
|
15
|
-
open("| dpkg -l %s 2>/dev/null" % self[:name]) { |process|
|
15
|
+
open("| /usr/bin/dpkg -l %s 2>/dev/null" % self[:name]) { |process|
|
16
16
|
# our regex for matching dpkg output
|
17
17
|
regex = %r{^(.)(.)(.)\s(\S+)\s+(\S+)\s+(.+)$}
|
18
18
|
|
@@ -64,7 +64,7 @@ module Puppet
|
|
64
64
|
ENV["COLUMNS"] = "500"
|
65
65
|
|
66
66
|
# list out all of the packages
|
67
|
-
open("| dpkg -l") { |process|
|
67
|
+
open("| /usr/bin/dpkg -l") { |process|
|
68
68
|
# our regex for matching dpkg output
|
69
69
|
regex = %r{^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$}
|
70
70
|
fields = [:status, :name, :version, :description]
|
@@ -101,7 +101,7 @@ module Puppet
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def uninstall
|
104
|
-
cmd = "dpkg -r %s" % self[:name]
|
104
|
+
cmd = "/usr/bin/dpkg -r %s" % self[:name]
|
105
105
|
output = %x{#{cmd} 2>&1}
|
106
106
|
if $? != 0
|
107
107
|
raise Puppet::PackageError.new(output)
|
@@ -110,4 +110,4 @@ module Puppet
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
# $Id: dpkg.rb
|
113
|
+
# $Id: dpkg.rb 1256 2006-06-13 15:57:06Z luke $
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module Puppet
|
2
|
+
Puppet.type(:package).newpkgtype(:gem) do
|
3
|
+
if gem = %x{which gem 2>/dev/null}.chomp and gem != "" and gem !~ /^no /
|
4
|
+
@@gem = gem
|
5
|
+
else
|
6
|
+
@@gem = nil
|
7
|
+
end
|
8
|
+
def self.extended(mod)
|
9
|
+
unless @@gem
|
10
|
+
raise Puppet::Error,
|
11
|
+
"The gem command is missing; gems unavailable"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def gemlist(hash)
|
16
|
+
command = "#{@@gem} list "
|
17
|
+
|
18
|
+
if hash[:local]
|
19
|
+
command += "--local "
|
20
|
+
else
|
21
|
+
command += "--remote "
|
22
|
+
end
|
23
|
+
|
24
|
+
if hash[:justme]
|
25
|
+
command += self[:name]
|
26
|
+
end
|
27
|
+
begin
|
28
|
+
list = execute(command).split("\n\n").collect do |set|
|
29
|
+
if gemhash = gemsplit(set)
|
30
|
+
gemhash[:type] = :gem
|
31
|
+
gemhash[:ensure] = gemhash[:version][0]
|
32
|
+
gemhash
|
33
|
+
else
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
end.reject { |p| p.nil? }
|
37
|
+
rescue ExecutionFailure => detail
|
38
|
+
raise Puppet::Error, "Could not list gems: %s" % detail
|
39
|
+
end
|
40
|
+
|
41
|
+
if hash[:justme]
|
42
|
+
return list.shift
|
43
|
+
else
|
44
|
+
return list
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module_function :gemlist
|
49
|
+
|
50
|
+
def gemsplit(desc)
|
51
|
+
case desc
|
52
|
+
when /^\*\*\*/: return nil
|
53
|
+
when /^(\S+)\s+\((.+)\)\n/
|
54
|
+
name = $1
|
55
|
+
version = $2.split(/,\s*/)
|
56
|
+
return {
|
57
|
+
:name => name,
|
58
|
+
:version => version
|
59
|
+
}
|
60
|
+
else
|
61
|
+
Puppet.warning "Could not match %s" % desc
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
module_function :gemsplit
|
67
|
+
|
68
|
+
def install(useversion = true)
|
69
|
+
command = "#{@@gem} install "
|
70
|
+
if self[:version] and useversion
|
71
|
+
command += "-v %s " % self[:version]
|
72
|
+
end
|
73
|
+
if source = self[:source]
|
74
|
+
command += source
|
75
|
+
else
|
76
|
+
command += self[:name]
|
77
|
+
end
|
78
|
+
begin
|
79
|
+
execute(command)
|
80
|
+
rescue ExecutionFailure => detail
|
81
|
+
raise Puppet::Error, "Could not install %s: %s" %
|
82
|
+
[self[:name], detail]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def latest
|
87
|
+
# This always gets the latest version available.
|
88
|
+
hash = gemlist(:justme => true)
|
89
|
+
|
90
|
+
return hash[:version][0]
|
91
|
+
end
|
92
|
+
|
93
|
+
def list(justme = false)
|
94
|
+
gemlist(:local => true).each do |hash|
|
95
|
+
Puppet::Type.type(:package).installedpkg(hash)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def query
|
100
|
+
gemlist(:justme => true, :local => true)
|
101
|
+
end
|
102
|
+
|
103
|
+
def uninstall
|
104
|
+
begin
|
105
|
+
# Remove everything, including the binaries.
|
106
|
+
execute("#{@@gem} uninstall -x -a #{self[:name]}")
|
107
|
+
rescue ExecutionFailure => detail
|
108
|
+
raise Puppet::Error, "Could not uninstall %s: %s" %
|
109
|
+
[self[:name], detail]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def update
|
114
|
+
self.install(false)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# $Id: gem.rb 1422 2006-07-22 03:32:56Z luke $
|
@@ -55,8 +55,8 @@ module Puppet
|
|
55
55
|
end
|
56
56
|
# list out all of the packages
|
57
57
|
open("| #{listcmd()}") { |process|
|
58
|
-
# our regex for matching
|
59
|
-
regex = %r{^(\S+)-(
|
58
|
+
# our regex for matching pkg_info output
|
59
|
+
regex = %r{^(\S+)-([^-\s]+)\s+(.+)}
|
60
60
|
fields = [:name, :version, :description]
|
61
61
|
hash = {}
|
62
62
|
|
@@ -82,13 +82,14 @@ module Puppet
|
|
82
82
|
pkg = Puppet.type(:package).installedpkg(hash)
|
83
83
|
packages << pkg
|
84
84
|
else
|
85
|
-
|
86
|
-
|
85
|
+
# Print a warning on lines we can't match, but move
|
86
|
+
# on, since it should be non-fatal
|
87
|
+
warning("Failed to match line %s" % line)
|
87
88
|
end
|
88
89
|
}
|
89
90
|
}
|
90
91
|
|
91
|
-
# Mark any packages we didn't find
|
92
|
+
# Mark as absent any packages we didn't find
|
92
93
|
Puppet.type(:package).each do |pkg|
|
93
94
|
unless packages.include? pkg
|
94
95
|
pkg.is = [:ensure, :absent]
|
@@ -108,4 +109,4 @@ module Puppet
|
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
111
|
-
# $Id: openbsd.rb
|
112
|
+
# $Id: openbsd.rb 1182 2006-05-09 16:39:16Z luke $
|
@@ -13,7 +13,12 @@ module Puppet
|
|
13
13
|
cmd = "/usr/local/sbin/portupgrade -p -N -P #{self[:name]}"
|
14
14
|
|
15
15
|
self.debug "Executing %s" % cmd.inspect
|
16
|
-
output = %x{#{cmd} 2>&1}
|
16
|
+
output = %x{#{cmd} 2>&1 1>/dev/null}
|
17
|
+
|
18
|
+
if output =~ /\*\* No such /
|
19
|
+
raise Puppet::PackageError, "Could not find package %s" % self[:name]
|
20
|
+
end
|
21
|
+
#output = %x{#{cmd} 2>&1}
|
17
22
|
|
18
23
|
unless $? == 0
|
19
24
|
raise Puppet::PackageError.new(output)
|
@@ -95,4 +100,4 @@ module Puppet
|
|
95
100
|
end
|
96
101
|
end
|
97
102
|
|
98
|
-
# $Id: ports.rb
|
103
|
+
# $Id: ports.rb 1133 2006-04-22 19:22:33Z luke $
|
@@ -47,7 +47,7 @@ module Puppet
|
|
47
47
|
self.fail "RPMs must specify a package source"
|
48
48
|
end
|
49
49
|
|
50
|
-
cmd = "rpm -
|
50
|
+
cmd = "rpm -q --qf '#{VERSIONSTRING}' -p #{self[:source]}"
|
51
51
|
self.debug "Executing %s" % cmd.inspect
|
52
52
|
version = %x{#{cmd}}
|
53
53
|
|
@@ -62,13 +62,13 @@ module Puppet
|
|
62
62
|
raise Puppet::Error, "Sun packages must specify a package source"
|
63
63
|
end
|
64
64
|
cmd = ["pkgadd"]
|
65
|
-
|
65
|
+
|
66
66
|
if self[:adminfile]
|
67
|
-
cmd
|
67
|
+
cmd << " -a " + self[:adminfile]
|
68
68
|
end
|
69
69
|
|
70
70
|
if self[:responsefile]
|
71
|
-
cmd
|
71
|
+
cmd << " -r " + self[:responsefile]
|
72
72
|
end
|
73
73
|
|
74
74
|
cmd += ["-d", self[:source]]
|
@@ -76,7 +76,7 @@ module Puppet
|
|
76
76
|
cmd << "2>&1"
|
77
77
|
cmd = cmd.join(" ")
|
78
78
|
|
79
|
-
self.
|
79
|
+
self.debug "Executing %s" % cmd.inspect
|
80
80
|
output = %x{#{cmd} 2>&1}
|
81
81
|
|
82
82
|
unless $? == 0
|
@@ -117,6 +117,8 @@ module Puppet
|
|
117
117
|
process.each { |line|
|
118
118
|
case line
|
119
119
|
when /^$/:
|
120
|
+
hash[:type] = :sun
|
121
|
+
|
120
122
|
packages.push Puppet.type(:package).installedpkg(hash)
|
121
123
|
hash.clear
|
122
124
|
when /\s*(\w+):\s+(.+)/:
|
@@ -142,14 +144,24 @@ module Puppet
|
|
142
144
|
end
|
143
145
|
|
144
146
|
def uninstall
|
145
|
-
|
146
|
-
|
147
|
-
if
|
148
|
-
|
147
|
+
command = "/usr/sbin/pkgrm -n "
|
148
|
+
|
149
|
+
if self[:adminfile]
|
150
|
+
command += " -a " + self[:adminfile]
|
151
|
+
end
|
152
|
+
|
153
|
+
command += " " + self[:name]
|
154
|
+
begin
|
155
|
+
execute(command)
|
156
|
+
rescue ExecutionFailure => detail
|
157
|
+
raise Puppet::Error,
|
158
|
+
"Could not uninstall %s: %s" %
|
159
|
+
[self[:name], detail]
|
149
160
|
end
|
150
161
|
end
|
151
162
|
|
152
|
-
# Remove the old package, and install the new one
|
163
|
+
# Remove the old package, and install the new one. This will probably
|
164
|
+
# often fail.
|
153
165
|
def update
|
154
166
|
if @states[:ensure].is != :absent
|
155
167
|
self.uninstall
|
@@ -158,3 +170,5 @@ module Puppet
|
|
158
170
|
end
|
159
171
|
end
|
160
172
|
end
|
173
|
+
|
174
|
+
# $Id: sun.rb 1356 2006-07-04 05:45:28Z luke $
|