puppet 0.24.4 → 0.24.5
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 +170 -0
- data/Rakefile +6 -4
- data/bin/filebucket +3 -2
- data/bin/puppet +7 -4
- data/bin/puppetca +32 -14
- data/bin/puppetd +12 -34
- data/bin/puppetmasterd +3 -2
- data/bin/puppetrun +5 -43
- data/bin/ralsh +2 -2
- data/conf/debian/README.source +2 -0
- data/conf/debian/TODO.Debian +1 -0
- data/conf/debian/changelog +257 -0
- data/conf/debian/compat +1 -0
- data/conf/debian/control +45 -0
- data/conf/debian/copyright +17 -0
- data/conf/debian/docs +1 -0
- data/conf/debian/fileserver.conf +12 -0
- data/conf/debian/puppet.NEWS +63 -0
- data/conf/debian/puppet.conf +8 -0
- data/conf/debian/puppet.dirs +7 -0
- data/conf/debian/puppet.files +6 -0
- data/conf/debian/puppet.init +64 -0
- data/conf/debian/puppet.logrotate +11 -0
- data/conf/debian/puppet.postinst +9 -0
- data/conf/debian/puppet.postrm +21 -0
- data/conf/debian/puppet.preinst +25 -0
- data/conf/debian/puppetmaster.files +4 -0
- data/conf/debian/puppetmaster.init +58 -0
- data/conf/debian/rules +115 -0
- data/conf/debian/watch +2 -0
- data/conf/gentoo/init.d/puppet +1 -1
- data/conf/gentoo/init.d/puppetmaster +32 -31
- data/conf/redhat/client.init +10 -2
- data/conf/redhat/puppet.spec +4 -1
- data/conf/redhat/server.init +9 -1
- data/examples/{code/allatonce → allatonce} +0 -0
- data/examples/{code/assignments → assignments} +0 -0
- data/examples/{code/components → components} +0 -0
- data/examples/{root/etc → etc}/init.d/sleeper +0 -0
- data/examples/{root/etc → etc}/otherfile +0 -0
- data/examples/{root/etc → etc}/puppet/fileserver.conf +0 -0
- data/examples/{root/etc → etc}/puppet/namespaceauth.conf +0 -0
- data/examples/{root/etc → etc}/puppet/puppet.conf +0 -0
- data/examples/{root/etc → etc}/puppet/tagmail.conf +0 -0
- data/examples/{code/execs → execs} +0 -0
- data/examples/{code/file.bl → file.bl} +0 -0
- data/examples/{code/filedefaults → filedefaults} +0 -0
- data/examples/{code/fileparsing → fileparsing} +0 -0
- data/examples/{code/filerecursion → filerecursion} +0 -0
- data/examples/{code/functions → functions} +0 -0
- data/examples/{code/groups → groups} +0 -0
- data/examples/{code/head → head} +0 -0
- data/examples/{code/importing → importing} +0 -0
- data/examples/{code/mac_automount.pp → mac_automount.pp} +0 -0
- data/examples/{code/mac_dscl.pp → mac_dscl.pp} +0 -0
- data/examples/{code/mac_dscl_revert.pp → mac_dscl_revert.pp} +0 -0
- data/examples/{code/mac_netinfo.pp → mac_netinfo.pp} +0 -0
- data/examples/{code/mac_pkgdmg.pp → mac_pkgdmg.pp} +0 -0
- data/examples/{code/modules → modules}/sample-module.pp +0 -0
- data/examples/{code/modules → modules}/sample-module/README.txt +0 -0
- data/examples/{code/modules → modules}/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +0 -0
- data/examples/{code/modules → modules}/sample-module/manifests/init.pp +0 -0
- data/examples/{code/modules → modules}/sample-module/templates/sample.erb +0 -0
- data/examples/{code/nodes → nodes} +0 -0
- data/examples/{code/one → one} +0 -0
- data/examples/{code/relationships → relationships} +0 -0
- data/examples/{code/selectors → selectors} +0 -0
- data/examples/{code/simpletests → simpletests} +0 -0
- data/examples/{code/svncommit → svncommit} +0 -0
- data/ext/autotest/Rakefile +8 -0
- data/ext/autotest/config +43 -0
- data/ext/autotest/readme.rst +16 -0
- data/{examples/root → ext}/bin/sleeper +1 -1
- data/ext/emacs/puppet-mode.el +246 -184
- data/ext/ldap/puppet.schema +7 -2
- data/ext/module_puppet +4 -3
- data/ext/nagios/check_puppet.rb +117 -0
- data/ext/puppetlast +40 -0
- data/install.rb +12 -3
- data/lib/puppet.rb +1 -44
- data/lib/puppet/defaults.rb +23 -10
- data/lib/puppet/dsl.rb +2 -2
- data/lib/puppet/executables/client/certhandler.rb +77 -0
- data/lib/puppet/external/nagios.rb +1 -1
- data/lib/puppet/external/nagios/base.rb +60 -46
- data/lib/puppet/file_serving/indirection_hooks.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +0 -9
- data/lib/puppet/file_serving/terminus_helper.rb +4 -4
- data/lib/puppet/indirector.rb +26 -28
- data/lib/puppet/indirector/catalog/compiler.rb +6 -28
- data/lib/puppet/indirector/checksum/file.rb +2 -2
- data/lib/puppet/indirector/direct_file_server.rb +7 -7
- data/lib/puppet/indirector/envelope.rb +13 -0
- data/lib/puppet/indirector/exec.rb +2 -2
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/file.rb +17 -14
- data/lib/puppet/indirector/file_metadata/file.rb +2 -2
- data/lib/puppet/indirector/file_server.rb +14 -14
- data/lib/puppet/indirector/indirection.rb +113 -48
- data/lib/puppet/indirector/ldap.rb +13 -25
- data/lib/puppet/indirector/memory.rb +7 -7
- data/lib/puppet/indirector/module_files.rb +14 -14
- data/lib/puppet/indirector/node/exec.rb +3 -10
- data/lib/puppet/indirector/node/ldap.rb +138 -41
- data/lib/puppet/indirector/node/plain.rb +1 -8
- data/lib/puppet/indirector/node/rest.rb +1 -1
- data/lib/puppet/indirector/plain.rb +2 -2
- data/lib/puppet/indirector/report/processor.rb +2 -2
- data/lib/puppet/indirector/request.rb +42 -0
- data/lib/puppet/indirector/rest.rb +51 -3
- data/lib/puppet/indirector/terminus.rb +0 -27
- data/lib/puppet/indirector/yaml.rb +12 -17
- data/lib/puppet/metatype/attributes.rb +3 -7
- data/lib/puppet/metatype/evaluation.rb +2 -2
- data/lib/puppet/module.rb +6 -2
- data/lib/puppet/network/client/master.rb +29 -81
- data/lib/puppet/network/handler/master.rb +12 -43
- data/lib/puppet/network/http.rb +8 -6
- data/lib/puppet/network/http/handler.rb +42 -32
- data/lib/puppet/network/http/mongrel.rb +8 -9
- data/lib/puppet/network/http/mongrel/rest.rb +42 -15
- data/lib/puppet/network/http/webrick.rb +27 -16
- data/lib/puppet/network/http/webrick/rest.rb +38 -14
- data/lib/puppet/network/http_pool.rb +3 -2
- data/lib/puppet/network/server.rb +24 -22
- data/lib/puppet/network/xmlrpc/client.rb +6 -1
- data/lib/puppet/node.rb +38 -79
- data/lib/puppet/node/catalog.rb +9 -0
- data/lib/puppet/node/facts.rb +9 -1
- data/lib/puppet/parser/ast/function.rb +1 -1
- data/lib/puppet/parser/collector.rb +6 -0
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/functions.rb +25 -1
- data/lib/puppet/parser/interpreter.rb +2 -17
- data/lib/puppet/parser/parser.rb +4 -4
- data/lib/puppet/parser/parser_support.rb +6 -2
- data/lib/puppet/parser/resource.rb +6 -0
- data/lib/puppet/parser/templatewrapper.rb +9 -0
- data/lib/puppet/pgraph.rb +1 -1
- data/lib/puppet/property.rb +0 -1
- data/lib/puppet/provider.rb +9 -95
- data/lib/puppet/provider/confine.rb +77 -0
- data/lib/puppet/provider/confine/exists.rb +22 -0
- data/lib/puppet/provider/confine/false.rb +19 -0
- data/lib/puppet/provider/confine/feature.rb +17 -0
- data/lib/puppet/provider/confine/true.rb +20 -0
- data/lib/puppet/provider/confine/variable.rb +42 -0
- data/lib/puppet/provider/confine_collection.rb +47 -0
- data/lib/puppet/provider/confiner.rb +20 -0
- data/lib/puppet/provider/cron/crontab.rb +6 -2
- data/lib/puppet/provider/group/groupadd.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +48 -0
- data/lib/puppet/provider/ldap.rb +137 -0
- data/lib/puppet/provider/nameservice.rb +1 -2
- data/lib/puppet/provider/nameservice/objectadd.rb +2 -5
- data/lib/puppet/provider/package/dpkg.rb +16 -1
- data/lib/puppet/provider/package/freebsd.rb +15 -4
- data/lib/puppet/provider/package/gem.rb +33 -12
- data/lib/puppet/provider/package/pkgdmg.rb +1 -60
- data/lib/puppet/provider/package/ports.rb +6 -1
- data/lib/puppet/provider/package/rpm.rb +14 -13
- data/lib/puppet/provider/package/urpmi.rb +3 -3
- data/lib/puppet/provider/service/base.rb +4 -4
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +5 -3
- data/lib/puppet/provider/service/redhat.rb +35 -7
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +69 -0
- data/lib/puppet/provider/user/ldap.rb +133 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +14 -14
- data/lib/puppet/rails/database/schema.rb +9 -0
- data/lib/puppet/rails/resource.rb +1 -0
- data/lib/puppet/reference/providers.rb +8 -2
- data/lib/puppet/reference/report.rb +23 -0
- data/lib/puppet/reports/rrdgraph.rb +4 -2
- data/lib/puppet/sslcertificates/ca.rb +9 -4
- data/lib/puppet/sslcertificates/support.rb +26 -2
- data/lib/puppet/transaction.rb +11 -16
- data/lib/puppet/transaction/change.rb +94 -0
- data/lib/puppet/transaction/event.rb +21 -0
- data/lib/puppet/transaction/report.rb +4 -0
- data/lib/puppet/type.rb +0 -2
- data/lib/puppet/type/file/ensure.rb +0 -5
- data/lib/puppet/type/file/group.rb +13 -7
- data/lib/puppet/type/file/source.rb +8 -15
- data/lib/puppet/type/file/target.rb +2 -0
- data/lib/puppet/type/group.rb +1 -1
- data/lib/puppet/type/mount.rb +4 -2
- data/lib/puppet/type/nagios_hostescalation.rb +3 -0
- data/lib/puppet/type/nagios_servicegroup.rb +3 -0
- data/lib/puppet/type/ssh_authorized_key.rb +56 -0
- data/lib/puppet/type/user.rb +3 -0
- data/lib/puppet/type/yumrepo.rb +0 -1
- data/lib/puppet/util.rb +1 -1
- data/lib/puppet/util/ldap.rb +5 -0
- data/lib/puppet/util/ldap/connection.rb +69 -0
- data/lib/puppet/util/ldap/generator.rb +45 -0
- data/lib/puppet/util/ldap/manager.rb +281 -0
- data/lib/puppet/util/posix.rb +2 -2
- data/lib/puppet/util/resource_template.rb +61 -0
- data/lib/puppet/util/settings.rb +63 -3
- data/lib/puppet/util/storage.rb +4 -0
- data/lib/puppet/util/warnings.rb +7 -0
- data/man/man8/filebucket.8 +116 -0
- data/man/man8/pi.8 +34 -0
- data/man/man8/puppet.8 +78 -0
- data/man/man8/puppet.conf.8 +1747 -0
- data/man/man8/puppetca.8 +118 -0
- data/man/man8/puppetd.8 +184 -0
- data/man/man8/puppetdoc.8 +62 -0
- data/man/man8/puppetmasterd.8 +87 -0
- data/man/man8/puppetrun.8 +151 -0
- data/man/man8/ralsh.8 +135 -0
- data/test/README +24 -0
- data/test/certmgr/support.rb +28 -1
- data/test/data/failers/badclassnoparam +10 -0
- data/test/data/failers/badclassparam +10 -0
- data/test/data/failers/badcompnoparam +9 -0
- data/test/data/failers/badcompparam +9 -0
- data/test/data/failers/badtypeparam +3 -0
- data/test/data/failers/noobjectrvalue +1 -0
- data/test/data/providers/cron/crontab.allthree +17 -0
- data/test/data/providers/cron/crontab.envNcomment +12 -0
- data/test/data/providers/cron/crontab.envNname +11 -0
- data/test/data/providers/cron/crontab.multirecords +12 -0
- data/test/data/providers/cron/crontab_collections.yaml +44 -0
- data/test/data/providers/cron/crontab_multiple_with_env.yaml +54 -0
- data/test/data/providers/cron/crontab_sample_records.yaml +272 -0
- data/test/data/providers/cron/examples/freebsd +2 -0
- data/test/data/providers/cron/examples/one +14 -0
- data/test/data/providers/cron/examples/openbsd +20 -0
- data/test/data/providers/package/testpackages.yaml +65 -0
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +5 -0
- data/test/data/reports/1.yaml +108 -0
- data/test/data/reports/2.yaml +108 -0
- data/test/data/reports/tagmail_failers.conf +3 -0
- data/test/data/reports/tagmail_passers.conf +30 -0
- data/test/data/snippets/aliastest.pp +16 -0
- data/test/data/snippets/argumentdefaults +14 -0
- data/test/data/snippets/casestatement.pp +58 -0
- data/test/data/snippets/classheirarchy.pp +15 -0
- data/test/data/snippets/classincludes.pp +17 -0
- data/test/data/snippets/classpathtest +11 -0
- data/test/data/snippets/collection.pp +10 -0
- data/test/data/snippets/collection_within_virtual_definitions.pp +20 -0
- data/test/data/snippets/componentmetaparams.pp +11 -0
- data/test/data/snippets/componentrequire.pp +8 -0
- data/test/data/snippets/deepclassheirarchy.pp +23 -0
- data/test/data/snippets/defineoverrides.pp +17 -0
- data/test/data/snippets/emptyclass.pp +9 -0
- data/test/data/snippets/emptyexec.pp +3 -0
- data/test/data/snippets/falsevalues.pp +3 -0
- data/test/data/snippets/filecreate +11 -0
- data/test/data/snippets/fqdefinition.pp +5 -0
- data/test/data/snippets/fqparents.pp +11 -0
- data/test/data/snippets/implicititeration +15 -0
- data/test/data/snippets/multipleinstances +7 -0
- data/test/data/snippets/multisubs.pp +13 -0
- data/test/data/snippets/namevartest +9 -0
- data/test/data/snippets/scopetest +13 -0
- data/test/data/snippets/selectorvalues.pp +42 -0
- data/test/data/snippets/simpledefaults +5 -0
- data/test/data/snippets/simpleselector +38 -0
- data/test/data/snippets/singleary.pp +19 -0
- data/test/data/snippets/singlequote.pp +11 -0
- data/test/data/snippets/singleselector.pp +22 -0
- data/test/data/snippets/subclass_name_duplication.pp +11 -0
- data/test/data/snippets/tag.pp +9 -0
- data/test/data/snippets/tagged.pp +35 -0
- data/test/data/snippets/virtualresources.pp +14 -0
- data/test/data/types/hosts/1 +3 -0
- data/test/data/types/hosts/2 +13 -0
- data/test/data/types/hosts/solaris +5 -0
- data/test/data/types/mailalias/file1 +183 -0
- data/test/data/types/mount/freebsd.fstab +7 -0
- data/test/data/types/mount/linux.fstab +11 -0
- data/test/data/types/mount/solaris.fstab +11 -0
- data/test/data/types/port/1 +533 -0
- data/test/data/types/port/darwin +11866 -0
- data/test/data/types/ssh_authorized_key/1 +2 -0
- data/test/data/types/sshkey/1 +21 -0
- data/test/data/types/yumrepos/fedora-devel.repo +26 -0
- data/test/data/types/yumrepos/fedora.repo +9 -0
- data/test/language/parser.rb +8 -1
- data/test/lib/puppettest/runnable_test.rb +3 -0
- data/test/lib/puppettest/support/utils.rb +1 -1
- data/test/lib/rake/puppet_testtask.rb +3 -0
- data/test/lib/stubba.rb +1 -1
- data/test/network/client/ca.rb +1 -0
- data/test/network/client/master.rb +13 -127
- data/test/network/handler/master.rb +61 -80
- data/test/other/provider.rb +0 -45
- data/test/other/transactions.rb +53 -15
- data/test/rails/host.rb +0 -37
- data/test/ral/providers/cron/crontab.rb +32 -3
- data/test/ral/providers/provider.rb +28 -7
- data/test/ral/type/filesources.rb +2 -18
- data/test/ral/type/sshkey.rb +0 -1
- data/test/ral/type/user.rb +6 -0
- data/test/test +241 -0
- metadata +289 -113
- data/examples/root/etc/configfile +0 -0
- data/examples/root/etc/debian-passwd +0 -29
- data/examples/root/etc/debian-syslog.conf +0 -71
- data/lib/puppet/event.rb +0 -28
- data/lib/puppet/network/handler/configuration.rb +0 -184
- data/lib/puppet/network/http/mongrel/xmlrpc.rb +0 -4
- data/lib/puppet/network/http/webrick/xmlrpc.rb +0 -4
- data/lib/puppet/propertychange.rb +0 -141
- data/lib/puppet/provider/interface/redhat.rb +0 -250
- data/lib/puppet/provider/interface/sunos.rb +0 -133
- data/lib/puppet/type/interface.rb +0 -60
- data/lib/puppet/util/variables.rb +0 -38
- data/test/network/handler/configuration.rb +0 -160
- data/test/other/propertychange.rb +0 -140
- data/test/util/loadedfile.rb +0 -121
@@ -30,7 +30,7 @@ Puppet::Type.type(:cron).provide(:crontab,
|
|
30
30
|
}
|
31
31
|
|
32
32
|
crontab = record_line :crontab, :fields => %w{minute hour monthday month weekday command},
|
33
|
-
:match => %r{
|
33
|
+
:match => %r{^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$},
|
34
34
|
:optional => %w{minute hour weekday month monthday}, :absent => "*"
|
35
35
|
|
36
36
|
class << crontab
|
@@ -69,7 +69,11 @@ Puppet::Type.type(:cron).provide(:crontab,
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
if record[:special]
|
73
|
+
str += "@%s %s" % [record[:special], record[:command]]
|
74
|
+
else
|
75
|
+
str += join(record)
|
76
|
+
end
|
73
77
|
str
|
74
78
|
end
|
75
79
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'puppet/provider/ldap'
|
2
|
+
|
3
|
+
Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
|
4
|
+
desc "Group management via ``ldap``. This provider requires that you
|
5
|
+
have valid values for all of the ldap-related settings,
|
6
|
+
including ``ldapbase``. You will also almost definitely need settings
|
7
|
+
for ``ldapuser`` and ``ldappassword``, so that your clients can write
|
8
|
+
to ldap.
|
9
|
+
|
10
|
+
Note that this provider will automatically generate a GID for you if
|
11
|
+
you do not specify one, but it is a potentially expensive operation,
|
12
|
+
as it iterates across all existing groups to pick the appropriate next
|
13
|
+
one."
|
14
|
+
|
15
|
+
confine :true => Puppet.features.ldap?, :false => (Puppet[:ldapuser] == "")
|
16
|
+
|
17
|
+
# We're mapping 'members' here because we want to make it
|
18
|
+
# easy for the ldap user provider to manage groups. This
|
19
|
+
# way it can just use the 'update' method in the group manager,
|
20
|
+
# whereas otherwise it would need to replicate that code.
|
21
|
+
manages(:posixGroup).at("ou=Groups").and.maps :name => :cn, :gid => :gidNumber, :members => :memberUid
|
22
|
+
|
23
|
+
# Find the next gid after the current largest gid.
|
24
|
+
provider = self
|
25
|
+
manager.generates(:gidNumber).with do
|
26
|
+
largest = 500
|
27
|
+
if existing = provider.manager.search
|
28
|
+
existing.each do |hash|
|
29
|
+
next unless value = hash[:gid]
|
30
|
+
num = value[0].to_i
|
31
|
+
if num > largest
|
32
|
+
largest = num
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
largest + 1
|
37
|
+
end
|
38
|
+
|
39
|
+
# Convert a group name to an id.
|
40
|
+
def self.name2id(group)
|
41
|
+
return nil unless result = manager.search("cn=%s" % group) and result.length > 0
|
42
|
+
|
43
|
+
# Only use the first result.
|
44
|
+
group = result[0]
|
45
|
+
gid = group[:gid][0]
|
46
|
+
return gid
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'puppet/provider'
|
2
|
+
|
3
|
+
# The base class for LDAP providers.
|
4
|
+
class Puppet::Provider::Ldap < Puppet::Provider
|
5
|
+
require 'puppet/util/ldap/manager'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_reader :manager
|
9
|
+
end
|
10
|
+
|
11
|
+
# Look up all instances at our location. Yay.
|
12
|
+
def self.instances
|
13
|
+
return [] unless list = manager.search
|
14
|
+
|
15
|
+
list.collect { |entry| new(entry) }
|
16
|
+
end
|
17
|
+
|
18
|
+
# Specify the ldap manager for this provider, which is
|
19
|
+
# used to figure out how we actually interact with ldap.
|
20
|
+
def self.manages(*args)
|
21
|
+
@manager = Puppet::Util::Ldap::Manager.new
|
22
|
+
@manager.manages(*args)
|
23
|
+
|
24
|
+
# Set up our getter/setter methods.
|
25
|
+
mk_resource_methods
|
26
|
+
return @manager
|
27
|
+
end
|
28
|
+
|
29
|
+
# Query all of our resources from ldap.
|
30
|
+
def self.prefetch(resources)
|
31
|
+
resources.each do |name, resource|
|
32
|
+
if result = manager.find(name)
|
33
|
+
result[:ensure] = :present
|
34
|
+
resource.provider = new(result)
|
35
|
+
else
|
36
|
+
resource.provider = new(:ensure => :absent)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_reader :ldap_properties
|
42
|
+
|
43
|
+
def manager
|
44
|
+
self.class.manager
|
45
|
+
end
|
46
|
+
|
47
|
+
def create
|
48
|
+
@property_hash[:ensure] = :present
|
49
|
+
self.class.resource_type.validproperties.each do |property|
|
50
|
+
if val = resource.should(property)
|
51
|
+
@property_hash[property] = val
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def delete
|
57
|
+
@property_hash[:ensure] = :absent
|
58
|
+
end
|
59
|
+
|
60
|
+
def exists?
|
61
|
+
@property_hash[:ensure] != :absent
|
62
|
+
end
|
63
|
+
|
64
|
+
# Apply our changes to ldap, yo.
|
65
|
+
def flush
|
66
|
+
# Just call the manager's update() method.
|
67
|
+
@property_hash.delete(:groups)
|
68
|
+
@ldap_properties.delete(:groups)
|
69
|
+
manager.update(name, ldap_properties, properties)
|
70
|
+
@property_hash.clear
|
71
|
+
@ldap_properties.clear
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(*args)
|
75
|
+
raise(Puppet::DevError, "No LDAP Configuration defined for %s" % self.class) unless self.class.manager
|
76
|
+
raise(Puppet::DevError, "Invalid LDAP Configuration defined for %s" % self.class) unless self.class.manager.valid?
|
77
|
+
super
|
78
|
+
|
79
|
+
@property_hash = @property_hash.inject({}) do |result, ary|
|
80
|
+
param, values = ary
|
81
|
+
|
82
|
+
# Skip any attributes we don't manage.
|
83
|
+
next result unless self.class.resource_type.validattr?(param)
|
84
|
+
|
85
|
+
paramclass = self.class.resource_type.attrclass(param)
|
86
|
+
|
87
|
+
unless values.is_a?(Array)
|
88
|
+
result[param] = values
|
89
|
+
next result
|
90
|
+
end
|
91
|
+
|
92
|
+
# Only use the first value if the attribute class doesn't manage
|
93
|
+
# arrays of values.
|
94
|
+
if paramclass.superclass == Puppet::Parameter or paramclass.array_matching == :first
|
95
|
+
result[param] = values[0]
|
96
|
+
else
|
97
|
+
result[param] = values
|
98
|
+
end
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
# Make a duplicate, so that we have a copy for comparison
|
103
|
+
# at the end.
|
104
|
+
@ldap_properties = @property_hash.dup
|
105
|
+
end
|
106
|
+
|
107
|
+
# Return the current state of ldap.
|
108
|
+
def ldap_properties
|
109
|
+
@ldap_properties.dup
|
110
|
+
end
|
111
|
+
|
112
|
+
# Return (and look up if necessary) the desired state.
|
113
|
+
def properties
|
114
|
+
if @property_hash.empty?
|
115
|
+
@property_hash = query || {:ensure => :absent}
|
116
|
+
if @property_hash.empty?
|
117
|
+
@property_hash[:ensure] = :absent
|
118
|
+
end
|
119
|
+
end
|
120
|
+
@property_hash.dup
|
121
|
+
end
|
122
|
+
|
123
|
+
# Collect the current attributes from ldap. Returns
|
124
|
+
# the results, but also stores the attributes locally,
|
125
|
+
# so we have something to compare against when we update.
|
126
|
+
# LAK:NOTE This is normally not used, because we rely on prefetching.
|
127
|
+
def query
|
128
|
+
# Use the module function.
|
129
|
+
unless attributes = manager.find(name)
|
130
|
+
@ldap_properties = {}
|
131
|
+
return nil
|
132
|
+
end
|
133
|
+
|
134
|
+
@ldap_properties = attributes
|
135
|
+
return @ldap_properties.dup
|
136
|
+
end
|
137
|
+
end
|
@@ -323,8 +323,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
323
323
|
begin
|
324
324
|
execute(cmd)
|
325
325
|
rescue Puppet::ExecutionFailure => detail
|
326
|
-
raise Puppet::Error, "Could not set %s on %s[%s]: %s" %
|
327
|
-
[param, @resource.class.name, @resource.name, detail]
|
326
|
+
raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
|
328
327
|
end
|
329
328
|
end
|
330
329
|
end
|
@@ -22,10 +22,8 @@ class ObjectAdd < Puppet::Provider::NameService
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def modifycmd(param, value)
|
25
|
-
cmd = [command(:modify),
|
26
|
-
|
27
|
-
value]
|
28
|
-
if @resource[:allowdupe] == :true
|
25
|
+
cmd = [command(:modify), flag(param), value]
|
26
|
+
if @resource.allowdupe? && ((param == :uid and self.class.name == :useradd) || (param == :gid and self.class.name == :groupadd))
|
29
27
|
cmd << "-o"
|
30
28
|
end
|
31
29
|
cmd << @resource[:name]
|
@@ -41,4 +39,3 @@ class ObjectAdd < Puppet::Provider::NameService
|
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
44
|
-
|
@@ -53,7 +53,22 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
53
53
|
unless file = @resource[:source]
|
54
54
|
raise ArgumentError, "You cannot install dpkg packages without a source"
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
|
+
args = []
|
58
|
+
|
59
|
+
if config = @resource[:configfiles]
|
60
|
+
case config
|
61
|
+
when :keep
|
62
|
+
args << '--force-confold'
|
63
|
+
when :replace
|
64
|
+
args << '--force-confnew'
|
65
|
+
else
|
66
|
+
raise Puppet::Error, "Invalid 'configfiles' value %s" % config
|
67
|
+
end
|
68
|
+
end
|
69
|
+
args << '-i' << file
|
70
|
+
|
71
|
+
dpkg(*args)
|
57
72
|
end
|
58
73
|
|
59
74
|
def update
|
@@ -18,11 +18,22 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
|
|
18
18
|
def install
|
19
19
|
should = @resource.should(:ensure)
|
20
20
|
|
21
|
-
if @resource[:source]
|
22
|
-
|
21
|
+
if @resource[:source] =~ /\/$/
|
22
|
+
if @resource[:source] =~ /^(ftp|https?):/
|
23
|
+
withenv :PACKAGESITE => @resource[:source] do
|
24
|
+
pkgadd "-r", @resource[:name]
|
25
|
+
end
|
26
|
+
else
|
27
|
+
withenv :PKG_PATH => @resource[:source] do
|
28
|
+
pkgadd @resource[:name]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
else
|
32
|
+
if @resource[:source]
|
33
|
+
Puppet.warning "source is defined but does not have trailing slash, ignoring %s" % @resource[:source]
|
34
|
+
end
|
35
|
+
pkgadd "-r", @resource[:name]
|
23
36
|
end
|
24
|
-
|
25
|
-
pkgadd "-r", @resource[:name]
|
26
37
|
end
|
27
38
|
|
28
39
|
def query
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'puppet/provider/package'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
# Ruby gems support.
|
4
5
|
Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package do
|
5
|
-
desc "Ruby Gem support.
|
6
|
-
|
6
|
+
desc "Ruby Gem support. If a URL is passed via ``source``, then that URL is used as the
|
7
|
+
remote gem repository; if a source is present but is not a valid URL, it will be
|
8
|
+
interpreted as the path to a local gem file. If source is not present at all,
|
9
|
+
the gem will be installed from the default gem repositories."
|
7
10
|
|
8
11
|
has_feature :versionable
|
9
12
|
|
@@ -65,20 +68,38 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
65
68
|
end
|
66
69
|
|
67
70
|
def install(useversion = true)
|
68
|
-
command = ["install"]
|
69
|
-
if (!
|
70
|
-
command << "-v" <<
|
71
|
+
command = [command(:gemcmd), "install"]
|
72
|
+
if (! resource[:ensure].is_a? Symbol) and useversion
|
73
|
+
command << "-v" << resource[:ensure]
|
71
74
|
end
|
72
75
|
# Always include dependencies
|
73
76
|
command << "--include-dependencies"
|
74
77
|
|
75
|
-
if source =
|
76
|
-
|
78
|
+
if source = resource[:source]
|
79
|
+
begin
|
80
|
+
uri = URI.parse(source)
|
81
|
+
rescue => detail
|
82
|
+
fail "Invalid source '%s': %s" % [uri, detail]
|
83
|
+
end
|
84
|
+
|
85
|
+
case uri.scheme
|
86
|
+
when nil:
|
87
|
+
# no URI scheme => interpret the source as a local file
|
88
|
+
command << source
|
89
|
+
when /file/i
|
90
|
+
command << uri.path
|
91
|
+
when 'puppet'
|
92
|
+
# we don't support puppet:// URLs (yet)
|
93
|
+
raise Puppet::Error.new("puppet:// URLs are not supported as gem sources")
|
94
|
+
else
|
95
|
+
# interpret it as a gem repository
|
96
|
+
command << "--source" << "#{source}" << resource[:name]
|
97
|
+
end
|
77
98
|
else
|
78
|
-
command <<
|
99
|
+
command << resource[:name]
|
79
100
|
end
|
80
101
|
|
81
|
-
output =
|
102
|
+
output = execute(command)
|
82
103
|
# Apparently some stupid gem versions don't exit non-0 on failure
|
83
104
|
if output.include?("ERROR")
|
84
105
|
self.fail "Could not install: %s" % output.chomp
|
@@ -87,17 +108,17 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
87
108
|
|
88
109
|
def latest
|
89
110
|
# This always gets the latest version available.
|
90
|
-
hash = self.class.gemlist(:justme =>
|
111
|
+
hash = self.class.gemlist(:justme => resource[:name])
|
91
112
|
|
92
113
|
return hash[:ensure]
|
93
114
|
end
|
94
115
|
|
95
116
|
def query
|
96
|
-
self.class.gemlist(:justme =>
|
117
|
+
self.class.gemlist(:justme => resource[:name], :local => true)
|
97
118
|
end
|
98
119
|
|
99
120
|
def uninstall
|
100
|
-
gemcmd "uninstall", "-x", "-a",
|
121
|
+
gemcmd "uninstall", "-x", "-a", resource[:name]
|
101
122
|
end
|
102
123
|
|
103
124
|
def update
|
@@ -28,66 +28,7 @@
|
|
28
28
|
require 'puppet/provider/package'
|
29
29
|
|
30
30
|
Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do
|
31
|
-
desc "Package management based on Apple's Installer.app and DiskUtility.app
|
32
|
-
|
33
|
-
Author: Jeff McCune <jeff@northstarlabs.net>
|
34
|
-
|
35
|
-
Please direct questions about this provider to the puppet-users mailing list.
|
36
|
-
|
37
|
-
This package works by checking the contents of a DMG image for Apple pkg or
|
38
|
-
mpkg files. Any number of pkg or mpkg files may exist in the root directory of
|
39
|
-
the DMG file system. Sub directories are not checked for packages.
|
40
|
-
|
41
|
-
This provider always assumes the label (formerly called 'name') attribute
|
42
|
-
declared in the manifest will always exactly match the file name (without
|
43
|
-
path) of the DMG file itself. Therefore, if you want to install packages in
|
44
|
-
'Foobar.pkg.dmg' you must explicitly specify the label::
|
45
|
-
|
46
|
-
package { Foobar.pkg.dmg: ensure => installed, provider => pkgdmg }
|
47
|
-
|
48
|
-
Only the dmg file name itself is used when puppet determines if the packages
|
49
|
-
contained within are currently installed. For example, if a package resource
|
50
|
-
named 'Foobar.pkg.dmg' is named for installation and contains multiple
|
51
|
-
packages, this provider will install all packages in the root directory of
|
52
|
-
this file system, then create a small cookie for the whole bundle, located at
|
53
|
-
/var/db/.puppet_pkgdmg_installed_Foobar.pkg.dmg
|
54
|
-
|
55
|
-
As a result, if you change the contents of the DMG file in any way, Puppet
|
56
|
-
will not update or re-install the packages contained within unless you change
|
57
|
-
the file name of the DMG wrapper itself. Therefore, if you use this provider,
|
58
|
-
I recommend you name the DMG wrapper files in a manner that lends itself to
|
59
|
-
incremental version changes. I include some version or date string in the DMG
|
60
|
-
name, like so::
|
61
|
-
|
62
|
-
Firefox-2.0.0.3-1.pkg.dmg
|
63
|
-
|
64
|
-
If I realize I've mis-packaged this DMG, then I have the option to increment
|
65
|
-
the package version, yielding Firefox-2.0.0.3-2.pkg.dmg.
|
66
|
-
|
67
|
-
This provider allows you to host DMG files within an FTP or HTTP server. This
|
68
|
-
is primarily how the author provider distributes software. Any URL mechanism
|
69
|
-
curl or Ruby's open-uri module supports is supported by this provider. Curl
|
70
|
-
supported URL's yield much faster data throughput than open-uri, so I
|
71
|
-
recommend HTTP, HTTPS, or FTP for source package repositories.
|
72
|
-
|
73
|
-
Because the provider assumes packages will be transfered via CURL, a two stage
|
74
|
-
process occurs. First, if a URL is detected, curl is invoked to transfer the
|
75
|
-
file into a temporary directory. If no URL is present, the provider skips
|
76
|
-
straight to step 2. In step two, the source file is mounted, then packages
|
77
|
-
installed, and finally the DMG file is removed.
|
78
|
-
|
79
|
-
If this is a problem for you, please patch the code, or bug Jeff to fix this.
|
80
|
-
|
81
|
-
Example usage::
|
82
|
-
|
83
|
-
package { Thunderbird-2.0.0.4-1.pkg.dmg:
|
84
|
-
provider => pkgdmg, ensure => present
|
85
|
-
source => 'http://0.0.0.0:8000/packages/Thunderbird-2.0.0.4-1.pkg.dmg',
|
86
|
-
}
|
87
|
-
|
88
|
-
**WARNING**: Because I assume files will be downloaded to /tmp, the current
|
89
|
-
implementation attempts to delete DMG files if you install directly from the
|
90
|
-
file system and not via a URL method."
|
31
|
+
desc "Package management based on Apple's Installer.app and DiskUtility.app. This package works by checking the contents of a DMG image for Apple pkg or mpkg files. Any number of pkg or mpkg files may exist in the root directory of the DMG file system. Sub directories are not checked for packages. See `the wiki docs </trac/puppet/wiki/DmgPackages>` for more detail."
|
91
32
|
|
92
33
|
confine :exists => "/Library/Receipts"
|
93
34
|
commands :installer => "/usr/sbin/installer"
|