puppet 0.24.5 → 0.24.6
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 +206 -0
- data/Rakefile +53 -0
- data/bin/filebucket +0 -0
- data/bin/puppet +32 -11
- data/bin/puppetca +1 -0
- data/bin/puppetd +0 -0
- data/bin/puppetdoc +0 -0
- data/bin/puppetmasterd +0 -0
- data/bin/puppetrun +16 -8
- data/bin/ralsh +0 -0
- data/conf/debian/rules +0 -0
- data/conf/gentoo/init.d/puppetmaster +0 -0
- data/conf/osx/PackageInfo.plist +36 -0
- data/conf/osx/createpackage.sh +167 -0
- data/conf/osx/preflight +12 -0
- data/conf/redhat/client.init +1 -1
- data/conf/redhat/puppet.spec +34 -6
- data/conf/redhat/server.init +42 -7
- data/conf/redhat/server.sysconfig +22 -0
- data/conf/solaris/smf/svc-puppetd +0 -0
- data/conf/solaris/smf/svc-puppetmasterd +0 -0
- data/examples/etc/init.d/sleeper +0 -0
- data/examples/mac_dscl.pp +0 -0
- data/examples/mac_dscl_revert.pp +0 -0
- data/examples/mac_netinfo.pp +0 -0
- data/examples/mac_pkgdmg.pp +0 -0
- data/ext/bin/sleeper +0 -0
- data/ext/module_puppet +0 -0
- data/ext/nagios/check_puppet.rb +0 -0
- data/ext/passenger/README +63 -0
- data/ext/passenger/apache2.conf +29 -0
- data/ext/passenger/config.ru +40 -0
- data/ext/puppet-test +0 -0
- data/ext/puppetlast +6 -31
- data/ext/puppetstoredconfigclean.rb +87 -0
- data/install.rb +75 -20
- data/lib/puppet.rb +1 -1
- data/lib/puppet/daemon.rb +0 -0
- data/lib/puppet/defaults.rb +3 -7
- data/lib/puppet/external/base64.rb +0 -0
- data/lib/puppet/external/nagios.rb +0 -0
- data/lib/puppet/external/nagios/base.rb +0 -0
- data/lib/puppet/file_serving/fileset.rb +2 -2
- data/lib/puppet/file_serving/metadata.rb +3 -3
- data/lib/puppet/indirector/facts/facter.rb +3 -2
- data/lib/puppet/indirector/yaml.rb +10 -1
- data/lib/puppet/module.rb +36 -12
- data/lib/puppet/network/authstore.rb +0 -0
- data/lib/puppet/network/client/master.rb +12 -11
- data/lib/puppet/network/handler/filebucket.rb +0 -0
- data/lib/puppet/network/handler/fileserver.rb +38 -46
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/handler/report.rb +0 -0
- data/lib/puppet/network/handler/resource.rb +0 -0
- data/lib/puppet/network/handler/runner.rb +0 -0
- data/lib/puppet/network/http_server/rack.rb +148 -0
- data/lib/puppet/network/rights.rb +0 -0
- data/lib/puppet/network/xmlrpc/client.rb +5 -5
- data/lib/puppet/node.rb +5 -9
- data/lib/puppet/node/environment.rb +1 -17
- data/lib/puppet/node/facts.rb +0 -0
- data/lib/puppet/parameter.rb +1 -28
- data/lib/puppet/parser/ast.rb +6 -0
- data/lib/puppet/parser/ast/arithmetic_operator.rb +41 -0
- data/lib/puppet/parser/ast/boolean_operator.rb +48 -0
- data/lib/puppet/parser/ast/collexpr.rb +6 -1
- data/lib/puppet/parser/ast/comparison_operator.rb +37 -0
- data/lib/puppet/parser/ast/minus.rb +23 -0
- data/lib/puppet/parser/ast/nop.rb +11 -0
- data/lib/puppet/parser/ast/not.rb +19 -0
- data/lib/puppet/parser/ast/resource_override.rb +23 -16
- data/lib/puppet/parser/ast/resource_reference.rb +10 -6
- data/lib/puppet/parser/ast/vardef.rb +2 -2
- data/lib/puppet/parser/collector.rb +2 -1
- data/lib/puppet/parser/functions.rb +7 -217
- data/lib/puppet/parser/functions/defined.rb +27 -0
- data/lib/puppet/parser/functions/fail.rb +4 -0
- data/lib/puppet/parser/functions/file.rb +21 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +15 -0
- data/lib/puppet/parser/functions/generate.rb +35 -0
- data/lib/puppet/parser/functions/include.rb +26 -0
- data/lib/puppet/parser/functions/realize.rb +14 -0
- data/lib/puppet/parser/functions/search.rb +7 -0
- data/lib/puppet/parser/functions/sha1.rb +6 -0
- data/lib/puppet/parser/functions/tag.rb +6 -0
- data/lib/puppet/parser/functions/tagged.rb +18 -0
- data/lib/puppet/parser/functions/template.rb +22 -0
- data/lib/puppet/parser/lexer.rb +15 -5
- data/lib/puppet/parser/parser.rb +1073 -715
- data/lib/puppet/parser/parser_support.rb +18 -13
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/resource/param.rb +10 -2
- data/lib/puppet/parser/scope.rb +63 -5
- data/lib/puppet/parser/templatewrapper.rb +61 -15
- data/lib/puppet/property.rb +7 -1
- data/lib/puppet/property/keyvalue.rb +96 -0
- data/lib/puppet/property/list.rb +78 -0
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/confine/variable.rb +10 -1
- data/lib/puppet/provider/cron/crontab.rb +0 -0
- data/lib/puppet/provider/mailalias/aliases.rb +0 -0
- data/lib/puppet/provider/maillist/mailman.rb +0 -0
- data/lib/puppet/provider/mount/parsed.rb +0 -0
- data/lib/puppet/provider/nameservice.rb +24 -39
- data/lib/puppet/provider/nameservice/directoryservice.rb +12 -3
- data/lib/puppet/provider/nameservice/netinfo.rb +12 -2
- data/lib/puppet/provider/nameservice/objectadd.rb +1 -10
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +0 -0
- data/lib/puppet/provider/package/apt.rb +14 -21
- data/lib/puppet/provider/package/aptitude.rb +0 -0
- data/lib/puppet/provider/package/blastwave.rb +2 -0
- data/lib/puppet/provider/package/darwinport.rb +0 -0
- data/lib/puppet/provider/package/dpkg.rb +33 -51
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +0 -0
- data/lib/puppet/provider/package/gem.rb +0 -0
- data/lib/puppet/provider/package/hpux.rb +46 -0
- data/lib/puppet/provider/package/openbsd.rb +0 -0
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +3 -1
- data/lib/puppet/provider/package/ports.rb +3 -3
- data/lib/puppet/provider/package/rpm.rb +8 -1
- data/lib/puppet/provider/package/rug.rb +2 -2
- data/lib/puppet/provider/package/sun.rb +2 -0
- data/lib/puppet/provider/package/sunfreeware.rb +3 -0
- data/lib/puppet/provider/package/yum.rb +24 -17
- data/lib/puppet/provider/package/yumhelper.py +92 -11
- data/lib/puppet/provider/parsedfile.rb +0 -0
- data/lib/puppet/provider/port/parsed.rb +0 -0
- data/lib/puppet/provider/selboolean/getsetsebool.rb +47 -0
- data/lib/puppet/provider/selmodule/semodule.rb +143 -0
- data/lib/puppet/provider/service/base.rb +0 -0
- data/lib/puppet/provider/service/daemontools.rb +154 -0
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +2 -0
- data/lib/puppet/provider/service/gentoo.rb +2 -0
- data/lib/puppet/provider/service/init.rb +0 -0
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/runit.rb +93 -0
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -0
- data/lib/puppet/provider/user/hpux.rb +30 -0
- data/lib/puppet/provider/user/user_role_add.rb +156 -0
- data/lib/puppet/provider/user/useradd.rb +23 -14
- data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +17 -0
- data/lib/puppet/rails/database/schema.rb +0 -8
- data/lib/puppet/rails/resource.rb +6 -6
- data/lib/puppet/reference/configuration.rb +0 -7
- data/lib/puppet/reports.rb +0 -0
- data/lib/puppet/reports/rrdgraph.rb +3 -2
- data/lib/puppet/sslcertificates.rb +0 -0
- data/lib/puppet/sslcertificates/inventory.rb +3 -2
- data/lib/puppet/sslcertificates/support.rb +3 -0
- data/lib/puppet/transaction/report.rb +1 -7
- data/lib/puppet/transportable.rb +10 -7
- data/lib/puppet/type.rb +2110 -14
- data/lib/puppet/type/cron.rb +0 -0
- data/lib/puppet/type/exec.rb +0 -0
- data/lib/puppet/type/file.rb +12 -2
- data/lib/puppet/type/file/checksum.rb +4 -0
- data/lib/puppet/type/file/content.rb +0 -0
- data/lib/puppet/type/file/ensure.rb +0 -0
- data/lib/puppet/type/file/group.rb +30 -43
- data/lib/puppet/type/file/mode.rb +0 -0
- data/lib/puppet/type/file/owner.rb +0 -0
- data/lib/puppet/type/file/selcontext.rb +104 -0
- data/lib/puppet/type/file/source.rb +0 -0
- data/lib/puppet/type/file/type.rb +0 -0
- data/lib/puppet/type/filebucket.rb +0 -0
- data/lib/puppet/type/group.rb +0 -8
- data/lib/puppet/type/host.rb +0 -0
- data/lib/puppet/type/mailalias.rb +0 -0
- data/lib/puppet/type/maillist.rb +0 -0
- data/lib/puppet/type/mount.rb +0 -0
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/port.rb +0 -0
- data/lib/puppet/type/schedule.rb +0 -0
- data/lib/puppet/type/selboolean.rb +31 -0
- data/lib/puppet/type/selmodule.rb +54 -0
- data/lib/puppet/type/ssh_authorized_key.rb +3 -3
- data/lib/puppet/type/sshkey.rb +0 -0
- data/lib/puppet/type/tidy.rb +0 -0
- data/lib/puppet/type/user.rb +153 -137
- data/lib/puppet/type/yumrepo.rb +18 -2
- data/lib/puppet/type/zone.rb +5 -1
- data/lib/puppet/util.rb +7 -7
- data/lib/puppet/util/filetype.rb +7 -0
- data/lib/puppet/util/instance_loader.rb +0 -0
- data/lib/puppet/util/ldap/connection.rb +11 -1
- data/lib/puppet/util/ldap/manager.rb +1 -1
- data/lib/puppet/util/loadedfile.rb +0 -0
- data/lib/puppet/util/log.rb +42 -43
- data/lib/puppet/util/metric.rb +23 -9
- data/lib/puppet/util/posix.rb +69 -18
- data/lib/puppet/util/selinux.rb +139 -0
- data/lib/puppet/util/settings.rb +5 -7
- data/lib/puppet/util/user_attr.rb +21 -0
- data/test/certmgr/ca.rb +0 -0
- data/test/certmgr/certmgr.rb +0 -0
- data/test/certmgr/inventory.rb +0 -0
- data/test/certmgr/support.rb +0 -0
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +3 -0
- data/test/data/snippets/append.pp +11 -0
- data/test/data/snippets/arithmetic_expression.pp +8 -0
- data/test/data/snippets/arraytrailingcomma.pp +3 -0
- data/test/data/snippets/emptyifelse.pp +9 -0
- data/test/data/snippets/funccomma.pp +5 -0
- data/test/data/snippets/ifexpression.rb +6 -0
- data/test/data/snippets/subclass_name_duplication.pp +0 -0
- data/test/executables/filebucket.rb +0 -0
- data/test/executables/puppetbin.rb +0 -0
- data/test/executables/puppetca.rb +0 -0
- data/test/executables/puppetd.rb +0 -0
- data/test/executables/puppetmasterd.rb +0 -0
- data/test/executables/puppetmodule.rb +0 -0
- data/test/language/ast.rb +0 -0
- data/test/language/ast/casestatement.rb +0 -0
- data/test/language/ast/resource.rb +0 -0
- data/test/language/ast/resource_reference.rb +0 -28
- data/test/language/ast/selector.rb +0 -0
- data/test/language/ast/variable.rb +0 -0
- data/test/language/functions.rb +91 -12
- data/test/language/parser.rb +21 -0
- data/test/language/resource.rb +0 -0
- data/test/language/scope.rb +28 -0
- data/test/language/snippets.rb +14 -0
- data/test/language/transportable.rb +0 -0
- data/test/lib/puppettest.rb +0 -0
- data/test/lib/puppettest/reporttesting.rb +0 -2
- data/test/lib/puppettest/runnable_test.rb +2 -0
- data/test/lib/puppettest/support/resources.rb +0 -0
- data/test/network/authconfig.rb +0 -0
- data/test/network/authorization.rb +0 -0
- data/test/network/authstore.rb +0 -0
- data/test/network/client/ca.rb +0 -0
- data/test/network/client/client.rb +0 -0
- data/test/network/client/dipper.rb +0 -0
- data/test/network/client/master.rb +2 -6
- data/test/network/client/resource.rb +0 -0
- data/test/network/client_request.rb +0 -0
- data/test/network/daemon.rb +0 -0
- data/test/network/handler/bucket.rb +0 -0
- data/test/network/handler/ca.rb +0 -0
- data/test/network/handler/fileserver.rb +8 -0
- data/test/network/handler/handler.rb +0 -0
- data/test/network/handler/master.rb +3 -1
- data/test/network/handler/report.rb +0 -0
- data/test/network/handler/resource.rb +0 -0
- data/test/network/handler/runner.rb +0 -0
- data/test/network/rights.rb +0 -0
- data/test/network/server/mongrel_test.rb +0 -0
- data/test/network/server/webrick.rb +0 -0
- data/test/network/xmlrpc/client.rb +0 -0
- data/test/network/xmlrpc/processor.rb +0 -0
- data/test/network/xmlrpc/server.rb +0 -0
- data/test/network/xmlrpc/webrick_servlet.rb +0 -0
- data/test/other/dsl.rb +0 -0
- data/test/other/events.rb +0 -0
- data/test/other/overrides.rb +0 -0
- data/test/other/provider.rb +0 -0
- data/test/other/puppet.rb +0 -0
- data/test/other/relationships.rb +0 -0
- data/test/other/report.rb +2 -4
- data/test/other/transactions.rb +1 -1
- data/test/puppet/conffiles.rb +0 -0
- data/test/puppet/defaults.rb +0 -0
- data/test/puppet/errortest.rb +0 -0
- data/test/puppet/tc_suidmanager.rb +0 -0
- data/test/rails/ast.rb +0 -0
- data/test/rails/configuration.rb +0 -0
- data/test/rails/host.rb +0 -0
- data/test/rails/rails.rb +0 -0
- data/test/rails/railsparameter.rb +0 -0
- data/test/rails/railsresource.rb +0 -0
- data/test/ral/manager/attributes.rb +0 -0
- data/test/ral/manager/instances.rb +0 -0
- data/test/ral/manager/manager.rb +0 -0
- data/test/ral/manager/provider.rb +0 -0
- data/test/ral/manager/type.rb +0 -0
- data/test/ral/providers/cron/crontab.rb +0 -0
- data/test/ral/providers/group.rb +14 -13
- data/test/ral/providers/host/netinfo.rb +0 -0
- data/test/ral/providers/host/parsed.rb +0 -0
- data/test/ral/providers/mailalias/aliases.rb +0 -0
- data/test/ral/providers/mount/netinfo.rb +0 -0
- data/test/ral/providers/nameservice.rb +0 -0
- data/test/ral/providers/package.rb +0 -31
- data/test/ral/providers/package/aptitude.rb +1 -2
- data/test/ral/providers/package/aptrpm.rb +2 -2
- data/test/ral/providers/parsedfile.rb +0 -0
- data/test/ral/providers/port/parsed.rb +0 -0
- data/test/ral/providers/provider.rb +0 -0
- data/test/ral/providers/service/base.rb +0 -0
- data/test/ral/providers/service/debian.rb +0 -0
- data/test/ral/providers/sshkey/parsed.rb +0 -0
- data/test/ral/providers/user.rb +8 -8
- data/test/ral/providers/user/useradd.rb +0 -0
- data/test/ral/type/basic.rb +0 -0
- data/test/ral/type/cron.rb +0 -0
- data/test/ral/type/exec.rb +0 -0
- data/test/ral/type/file.rb +0 -0
- data/test/ral/type/file/target.rb +0 -0
- data/test/ral/type/filebucket.rb +0 -0
- data/test/ral/type/fileignoresource.rb +0 -0
- data/test/ral/type/filesources.rb +1 -3
- data/test/ral/type/group.rb +0 -0
- data/test/ral/type/host.rb +0 -0
- data/test/ral/type/mailalias.rb +1 -2
- data/test/ral/type/parameter.rb +0 -0
- data/test/ral/type/port.rb +0 -0
- data/test/ral/type/property.rb +0 -0
- data/test/ral/type/resources.rb +0 -0
- data/test/ral/type/service.rb +0 -0
- data/test/ral/type/sshkey.rb +0 -0
- data/test/ral/type/tidy.rb +0 -0
- data/test/ral/type/user.rb +0 -50
- data/test/ral/type/yumrepo.rb +7 -1
- data/test/ral/type/zone.rb +0 -0
- data/test/test +0 -0
- data/test/util/autoload.rb +0 -0
- data/test/util/classgen.rb +0 -0
- data/test/util/execution.rb +0 -0
- data/test/util/features.rb +0 -0
- data/test/util/fileparsing.rb +0 -0
- data/test/util/filetype.rb +0 -0
- data/test/util/inifile.rb +0 -0
- data/test/util/instance_loader.rb +0 -0
- data/test/util/log.rb +0 -59
- data/test/util/metrics.rb +0 -0
- data/test/util/package.rb +0 -0
- data/test/util/pidlock.rb +0 -0
- data/test/util/settings.rb +0 -0
- data/test/util/storage.rb +0 -0
- data/test/util/subclass_loader.rb +0 -0
- data/test/util/utiltest.rb +0 -0
- metadata +54 -19
- data/lib/puppet/metatype/attributes.rb +0 -685
- data/lib/puppet/metatype/closure.rb +0 -49
- data/lib/puppet/metatype/container.rb +0 -50
- data/lib/puppet/metatype/evaluation.rb +0 -163
- data/lib/puppet/metatype/instances.rb +0 -305
- data/lib/puppet/metatype/metaparams.rb +0 -423
- data/lib/puppet/metatype/providers.rb +0 -247
- data/lib/puppet/metatype/relationships.rb +0 -115
- data/lib/puppet/metatype/schedules.rb +0 -33
- data/lib/puppet/metatype/tags.rb +0 -38
- data/lib/puppet/util/plist.rb +0 -23
- data/lib/puppet/util/plist/generator.rb +0 -225
- data/lib/puppet/util/plist/parser.rb +0 -226
- data/test/ral/providers/package/apt.rb +0 -169
- data/test/ral/providers/package/dpkg.rb +0 -64
- data/test/util/posixtest.rb +0 -169
@@ -25,7 +25,7 @@ class Puppet::Provider::Confine
|
|
25
25
|
begin
|
26
26
|
require "puppet/provider/confine/%s" % name
|
27
27
|
rescue LoadError => detail
|
28
|
-
unless detail.to_s
|
28
|
+
unless detail.to_s =~ /No such file/i
|
29
29
|
warn "Could not load confine test '%s': %s" % [name, detail]
|
30
30
|
end
|
31
31
|
# Could not find file
|
@@ -1,11 +1,19 @@
|
|
1
1
|
require 'puppet/provider/confine'
|
2
2
|
|
3
|
+
# Require a specific value for a variable, either a Puppet setting
|
4
|
+
# or a Facter value. This class is a bit weird because the name
|
5
|
+
# is set explicitly by the ConfineCollection class -- from this class,
|
6
|
+
# it's not obvious how the name would ever get set.
|
3
7
|
class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
|
8
|
+
# Provide a hash summary of failing confines -- the key of the hash
|
9
|
+
# is the name of the confine, and the value is the missing yet required values.
|
10
|
+
# Only returns failed values, not all required values.
|
4
11
|
def self.summarize(confines)
|
5
12
|
result = Hash.new { |hash, key| hash[key] = [] }
|
6
|
-
confines.inject(result) { |total, confine| total[confine.
|
13
|
+
confines.inject(result) { |total, confine| total[confine.name] += confine.values unless confine.valid?; total }
|
7
14
|
end
|
8
15
|
|
16
|
+
# This is set by ConfineCollection.
|
9
17
|
attr_accessor :name
|
10
18
|
|
11
19
|
# Retrieve the value from facter
|
@@ -20,6 +28,7 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
|
|
20
28
|
"facter value '%s' for '%s' not in required list '%s'" % [value, self.name, values.join(",")]
|
21
29
|
end
|
22
30
|
|
31
|
+
# Compare the passed-in value to the retrieved value.
|
23
32
|
def pass?(value)
|
24
33
|
test_value.downcase.to_s == value.to_s.downcase
|
25
34
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -179,11 +179,33 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def create
|
182
|
-
|
182
|
+
if exists?
|
183
|
+
info "already exists"
|
184
|
+
# The object already exists
|
185
|
+
return nil
|
186
|
+
end
|
187
|
+
|
188
|
+
begin
|
189
|
+
execute(self.addcmd)
|
190
|
+
rescue Puppet::ExecutionFailure => detail
|
191
|
+
raise Puppet::Error, "Could not create %s %s: %s" %
|
192
|
+
[@resource.class.name, @resource.name, detail]
|
193
|
+
end
|
183
194
|
end
|
184
195
|
|
185
196
|
def delete
|
186
|
-
|
197
|
+
unless exists?
|
198
|
+
info "already absent"
|
199
|
+
# the object already doesn't exist
|
200
|
+
return nil
|
201
|
+
end
|
202
|
+
|
203
|
+
begin
|
204
|
+
execute(self.deletecmd)
|
205
|
+
rescue Puppet::ExecutionFailure => detail
|
206
|
+
raise Puppet::Error, "Could not delete %s %s: %s" %
|
207
|
+
[@resource.class.name, @resource.name, detail]
|
208
|
+
end
|
187
209
|
end
|
188
210
|
|
189
211
|
def ensure
|
@@ -194,43 +216,6 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
194
216
|
end
|
195
217
|
end
|
196
218
|
|
197
|
-
# This is only used when creating or destroying the object.
|
198
|
-
def ensure=(value)
|
199
|
-
cmd = nil
|
200
|
-
event = nil
|
201
|
-
case value
|
202
|
-
when :absent
|
203
|
-
# we need to remove the object...
|
204
|
-
unless exists?
|
205
|
-
info "already absent"
|
206
|
-
# the object already doesn't exist
|
207
|
-
return nil
|
208
|
-
end
|
209
|
-
|
210
|
-
# again, needs to be set by the ind. property or its
|
211
|
-
# parent
|
212
|
-
cmd = self.deletecmd
|
213
|
-
type = "delete"
|
214
|
-
when :present
|
215
|
-
if exists?
|
216
|
-
info "already exists"
|
217
|
-
# The object already exists
|
218
|
-
return nil
|
219
|
-
end
|
220
|
-
|
221
|
-
# blah blah, define elsewhere, blah blah
|
222
|
-
cmd = self.addcmd
|
223
|
-
type = "create"
|
224
|
-
end
|
225
|
-
|
226
|
-
begin
|
227
|
-
execute(cmd)
|
228
|
-
rescue Puppet::ExecutionFailure => detail
|
229
|
-
raise Puppet::Error, "Could not %s %s %s: %s" %
|
230
|
-
[type, @resource.class.name, @resource.name, detail]
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
219
|
# Does our object exist?
|
235
220
|
def exists?
|
236
221
|
if getinfo(true)
|
@@ -206,9 +206,18 @@ class DirectoryService < Puppet::Provider::NameService
|
|
206
206
|
if ensure_value == :present
|
207
207
|
@resource.class.validproperties.each do |name|
|
208
208
|
next if name == :ensure
|
209
|
-
|
210
|
-
#
|
211
|
-
|
209
|
+
|
210
|
+
# LAK: We use property.sync here rather than directly calling
|
211
|
+
# the settor method because the properties might do some kind
|
212
|
+
# of conversion. In particular, the user gid property might
|
213
|
+
# have a string and need to convert it to a number
|
214
|
+
if @resource.should(name)
|
215
|
+
@resource.property(name).sync
|
216
|
+
elsif value = autogen(name)
|
217
|
+
self.send(name.to_s + "=", value)
|
218
|
+
else
|
219
|
+
next
|
220
|
+
end
|
212
221
|
end
|
213
222
|
end
|
214
223
|
end
|
@@ -138,8 +138,18 @@ class NetInfo < Puppet::Provider::NameService
|
|
138
138
|
if arg == :present
|
139
139
|
@resource.class.validproperties.each do |name|
|
140
140
|
next if name == :ensure
|
141
|
-
|
142
|
-
|
141
|
+
|
142
|
+
# LAK: We use property.sync here rather than directly calling
|
143
|
+
# the settor method because the properties might do some kind
|
144
|
+
# of conversion. In particular, the user gid property might
|
145
|
+
# have a string and need to convert it to a number
|
146
|
+
if @resource.should(name)
|
147
|
+
@resource.property(name).sync
|
148
|
+
elsif value = autogen(name)
|
149
|
+
self.send(name.to_s + "=", value)
|
150
|
+
else
|
151
|
+
next
|
152
|
+
end
|
143
153
|
end
|
144
154
|
end
|
145
155
|
end
|
@@ -2,15 +2,6 @@ require 'puppet/provider/nameservice'
|
|
2
2
|
|
3
3
|
class Puppet::Provider::NameService
|
4
4
|
class ObjectAdd < Puppet::Provider::NameService
|
5
|
-
# Does the object already exist?
|
6
|
-
def self.exists?(obj)
|
7
|
-
if obj.getinfo(true)
|
8
|
-
return true
|
9
|
-
else
|
10
|
-
return false
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
5
|
def deletecmd
|
15
6
|
[command(:delete), @resource[:name]]
|
16
7
|
end
|
@@ -23,7 +14,7 @@ class ObjectAdd < Puppet::Provider::NameService
|
|
23
14
|
|
24
15
|
def modifycmd(param, value)
|
25
16
|
cmd = [command(:modify), flag(param), value]
|
26
|
-
if @resource.allowdupe? && ((param == :uid
|
17
|
+
if @resource.allowdupe? && ((param == :uid) || (param == :gid and self.class.name == :groupadd))
|
27
18
|
cmd << "-o"
|
28
19
|
end
|
29
20
|
cmd << @resource[:name]
|
@@ -55,7 +55,7 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag
|
|
55
55
|
self.fail "Mac OS X PKG DMG's must specificy a source string ending in .dmg"
|
56
56
|
end
|
57
57
|
require 'open-uri'
|
58
|
-
require '
|
58
|
+
require 'facter/util/plist'
|
59
59
|
cached_source = source
|
60
60
|
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
61
61
|
cached_source = "/tmp/#{name}"
|
File without changes
|
@@ -10,7 +10,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
10
10
|
commands :aptcache => "/usr/bin/apt-cache"
|
11
11
|
commands :preseed => "/usr/bin/debconf-set-selections"
|
12
12
|
|
13
|
-
defaultfor :operatingsystem => :debian
|
13
|
+
defaultfor :operatingsystem => [:debian, :ubuntu]
|
14
14
|
|
15
15
|
ENV['DEBIAN_FRONTEND'] = "noninteractive"
|
16
16
|
|
@@ -45,9 +45,19 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
45
45
|
if @resource[:responsefile]
|
46
46
|
self.run_preseed
|
47
47
|
end
|
48
|
-
should = @resource
|
48
|
+
should = @resource[:ensure]
|
49
49
|
|
50
50
|
checkforcdrom()
|
51
|
+
cmd = %w{-q -y}
|
52
|
+
|
53
|
+
keep = ""
|
54
|
+
if config = @resource[:configfiles]
|
55
|
+
if config == :keep
|
56
|
+
cmd << "-o" << 'DPkg::Options::=--force-confold'
|
57
|
+
else
|
58
|
+
cmd << "-o" << 'DPkg::Options::=--force-confnew'
|
59
|
+
end
|
60
|
+
end
|
51
61
|
|
52
62
|
str = @resource[:name]
|
53
63
|
case should
|
@@ -57,19 +67,6 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
57
67
|
# Add the package version
|
58
68
|
str += "=%s" % should
|
59
69
|
end
|
60
|
-
cmd = %w{-q -y}
|
61
|
-
|
62
|
-
keep = ""
|
63
|
-
if config = @resource[:configfiles]
|
64
|
-
case config
|
65
|
-
when :keep
|
66
|
-
cmd << "-o" << 'DPkg::Options::=--force-confold'
|
67
|
-
when :replace
|
68
|
-
cmd << "-o" << 'DPkg::Options::=--force-confnew'
|
69
|
-
else
|
70
|
-
raise Puppet::Error, "Invalid 'configfiles' value %s" % config
|
71
|
-
end
|
72
|
-
end
|
73
70
|
|
74
71
|
cmd << :install << str
|
75
72
|
|
@@ -92,7 +89,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
92
89
|
# preseeds answers to dpkg-set-selection from the "responsefile"
|
93
90
|
#
|
94
91
|
def run_preseed
|
95
|
-
if response = @resource[:responsefile] and FileTest.
|
92
|
+
if response = @resource[:responsefile] and FileTest.exist?(response)
|
96
93
|
self.info("Preseeding %s to debconf-set-selections" % response)
|
97
94
|
|
98
95
|
preseed response
|
@@ -101,16 +98,12 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
101
98
|
end
|
102
99
|
end
|
103
100
|
|
104
|
-
def update
|
105
|
-
self.install
|
106
|
-
end
|
107
|
-
|
108
101
|
def uninstall
|
109
102
|
aptget "-y", "-q", :remove, @resource[:name]
|
110
103
|
end
|
111
104
|
|
112
105
|
def purge
|
113
|
-
aptget '-y', '-q',
|
106
|
+
aptget '-y', '-q', :remove, '--purge', @resource[:name]
|
114
107
|
# workaround a "bug" in apt, that already removed packages are not purged
|
115
108
|
super
|
116
109
|
end
|
File without changes
|
File without changes
|
@@ -23,30 +23,39 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
23
23
|
|
24
24
|
# now turn each returned line into a package object
|
25
25
|
process.each { |line|
|
26
|
-
if
|
27
|
-
|
26
|
+
if hash = parse_line(line)
|
27
|
+
packages << new(hash)
|
28
|
+
end
|
29
|
+
}
|
30
|
+
end
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
+
return packages
|
33
|
+
end
|
32
34
|
|
33
|
-
|
35
|
+
REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
|
36
|
+
FIELDS = [:desired, :error, :status, :name, :ensure]
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
hash[:ensure] = :absent
|
39
|
-
end
|
38
|
+
def self.parse_line(line)
|
39
|
+
if match = REGEX.match(line)
|
40
|
+
hash = {}
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
Puppet.warning "Failed to match dpkg-query line %s" %
|
44
|
-
line.inspect
|
45
|
-
end
|
42
|
+
FIELDS.zip(match.captures) { |field,value|
|
43
|
+
hash[field] = value
|
46
44
|
}
|
45
|
+
|
46
|
+
hash[:provider] = self.name
|
47
|
+
|
48
|
+
if hash[:status] == 'not-installed'
|
49
|
+
hash[:ensure] = :purged
|
50
|
+
elsif hash[:status] != "installed"
|
51
|
+
hash[:ensure] = :absent
|
52
|
+
end
|
53
|
+
else
|
54
|
+
Puppet.warning "Failed to match dpkg-query line %s" % line.inspect
|
55
|
+
return nil
|
47
56
|
end
|
48
57
|
|
49
|
-
return
|
58
|
+
return hash
|
50
59
|
end
|
51
60
|
|
52
61
|
def install
|
@@ -56,15 +65,10 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
56
65
|
|
57
66
|
args = []
|
58
67
|
|
59
|
-
if
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
when :replace
|
64
|
-
args << '--force-confnew'
|
65
|
-
else
|
66
|
-
raise Puppet::Error, "Invalid 'configfiles' value %s" % config
|
67
|
-
end
|
68
|
+
if @resource[:configfiles] == :keep
|
69
|
+
args << '--force-confold'
|
70
|
+
else
|
71
|
+
args << '--force-confnew'
|
68
72
|
end
|
69
73
|
args << '-i' << file
|
70
74
|
|
@@ -80,7 +84,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
80
84
|
output = dpkg_deb "--show", @resource[:source]
|
81
85
|
matches = /^(\S+)\t(\S+)$/.match(output).captures
|
82
86
|
unless matches[0].match(@resource[:name])
|
83
|
-
|
87
|
+
warning "source doesn't contain named package, but %s" % matches[0]
|
84
88
|
end
|
85
89
|
matches[1]
|
86
90
|
end
|
@@ -103,37 +107,16 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
103
107
|
:name => @resource[:name], :error => 'ok'}
|
104
108
|
|
105
109
|
end
|
106
|
-
# Our regex for matching dpkg-query output. We could probably just
|
107
|
-
# use split here, but I'm not positive that dpkg-query will never
|
108
|
-
# return whitespace.
|
109
|
-
regex = %r{^(\S+) (\S+) (\S+) (\S+) (\S*)$}
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
if match = regex.match(line)
|
114
|
-
fields.zip(match.captures) { |field,value|
|
115
|
-
hash[field] = value
|
116
|
-
}
|
117
|
-
else
|
118
|
-
notice "Failed to handle dpkg-query line %s" % line.inspect
|
119
|
-
return {:ensure => :absent, :status => 'missing',
|
120
|
-
:name => @resource[:name], :error => 'ok'}
|
121
|
-
end
|
111
|
+
hash = self.class.parse_line(output) || {:ensure => :absent, :status => 'missing', :name => @resource[:name], :error => 'ok'}
|
122
112
|
|
123
113
|
if hash[:error] != "ok"
|
124
|
-
raise Puppet::
|
114
|
+
raise Puppet::Error.new(
|
125
115
|
"Package %s, version %s is in error state: %s" %
|
126
116
|
[hash[:name], hash[:ensure], hash[:error]]
|
127
117
|
)
|
128
118
|
end
|
129
119
|
|
130
|
-
# DPKG can discuss packages that are no longer installed, so allow that.
|
131
|
-
if hash[:status] == "not-installed"
|
132
|
-
hash[:ensure] = :purged
|
133
|
-
elsif hash[:status] != "installed"
|
134
|
-
hash[:ensure] = :absent
|
135
|
-
end
|
136
|
-
|
137
120
|
return hash
|
138
121
|
end
|
139
122
|
|
@@ -145,4 +128,3 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
145
128
|
dpkg "--purge", @resource[:name]
|
146
129
|
end
|
147
130
|
end
|
148
|
-
|
@@ -4,7 +4,7 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
|
|
4
4
|
|
5
5
|
desc "Package management via ``fink``."
|
6
6
|
|
7
|
-
|
7
|
+
commands :fink => "/sw/bin/fink"
|
8
8
|
commands :aptget => "/sw/bin/apt-get"
|
9
9
|
commands :aptcache => "/sw/bin/apt-cache"
|
10
10
|
commands :dpkgquery => "/sw/bin/dpkg-query"
|
File without changes
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# HP-UX packaging.
|
2
|
+
|
3
|
+
require 'puppet/provider/package'
|
4
|
+
|
5
|
+
Puppet::Type.type(:package).provide :hpux, :parent => Puppet::Provider::Package do
|
6
|
+
|
7
|
+
desc "HP-UX's packaging system."
|
8
|
+
|
9
|
+
commands :swinstall => "/usr/sbin/swinstall",
|
10
|
+
:swlist => "/usr/sbin/swlist",
|
11
|
+
:swremove => "/usr/sbin/swremove"
|
12
|
+
|
13
|
+
confine :operatingsystem => "hp-ux"
|
14
|
+
|
15
|
+
defaultfor :operatingsystem => "hp-ux"
|
16
|
+
|
17
|
+
def self.instances
|
18
|
+
# TODO: This is very hard on HP-UX!
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
|
22
|
+
# source and name are required
|
23
|
+
def install
|
24
|
+
raise ArgumentError, "source must be provided to install HP-UX packages" unless resource[:source]
|
25
|
+
args = standard_args + ["-s", resource[:source], resource[:name]]
|
26
|
+
swinstall(*args)
|
27
|
+
end
|
28
|
+
|
29
|
+
def query
|
30
|
+
begin
|
31
|
+
swlist resource[:name]
|
32
|
+
{:ensure => :present}
|
33
|
+
rescue
|
34
|
+
{:ensure => :absent}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def uninstall
|
39
|
+
args = standard_args + [resource[:name]]
|
40
|
+
swremove(*args)
|
41
|
+
end
|
42
|
+
|
43
|
+
def standard_args
|
44
|
+
return ["-x", "mount_all_filesystems=false"]
|
45
|
+
end
|
46
|
+
end
|