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
@@ -72,8 +72,13 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def query
|
75
|
+
# support portorigin_glob such as "mail/postfix"
|
76
|
+
name = self.name
|
77
|
+
if name =~ /\//
|
78
|
+
name = self.name.split(/\//).slice(1)
|
79
|
+
end
|
75
80
|
self.class.instances.each do |instance|
|
76
|
-
if instance.name ==
|
81
|
+
if instance.name == name
|
77
82
|
return instance.properties
|
78
83
|
end
|
79
84
|
end
|
@@ -43,19 +43,20 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
43
43
|
# a hash with entries :instance => fully versioned package name, and
|
44
44
|
# :ensure => version-release
|
45
45
|
def query
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
# FIXME: We could actually be getting back multiple packages
|
56
|
-
# for multilib
|
57
|
-
@property_hash.update(self.class.nevra_to_hash(output))
|
46
|
+
#NOTE: Prior to a fix for issue 1243, this method potentially returned a cached value
|
47
|
+
#IF YOU CALL THIS METHOD, IT WILL CALL RPM
|
48
|
+
#Use get(:property) to check if cached values are available
|
49
|
+
cmd = ["-q", @resource[:name], "--nosignature", "--nodigest", "--qf", "#{NEVRAFORMAT}\n"]
|
50
|
+
|
51
|
+
begin
|
52
|
+
output = rpm(*cmd)
|
53
|
+
rescue Puppet::ExecutionFailure
|
54
|
+
return nil
|
58
55
|
end
|
56
|
+
|
57
|
+
# FIXME: We could actually be getting back multiple packages
|
58
|
+
# for multilib
|
59
|
+
@property_hash.update(self.class.nevra_to_hash(output))
|
59
60
|
|
60
61
|
return @property_hash.dup
|
61
62
|
end
|
@@ -67,7 +68,7 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
67
68
|
end
|
68
69
|
|
69
70
|
cmd = [command(:rpm), "-q", "--qf", "#{NEVRAFORMAT}\n", "-p", "#{@resource[:source]}"]
|
70
|
-
h = nevra_to_hash(execfail(cmd, Puppet::Error))
|
71
|
+
h = self.class.nevra_to_hash(execfail(cmd, Puppet::Error))
|
71
72
|
return h[:ensure]
|
72
73
|
end
|
73
74
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Puppet::Type.type(:package).provide :urpmi, :parent => :rpm, :source => :rpm do
|
2
2
|
desc "Support via ``urpmi``."
|
3
|
-
commands :urpmi => "urpmi", :rpm => "rpm"
|
3
|
+
commands :urpmi => "urpmi", :urpmq => "urpmq", :rpm => "rpm"
|
4
4
|
|
5
5
|
if command('rpm')
|
6
6
|
confine :true => begin
|
@@ -41,9 +41,9 @@ Puppet::Type.type(:package).provide :urpmi, :parent => :rpm, :source => :rpm do
|
|
41
41
|
|
42
42
|
# What's the latest package version available?
|
43
43
|
def latest
|
44
|
-
output =
|
44
|
+
output = urpmq "-S", @resource[:name]
|
45
45
|
|
46
|
-
if output =~ /^#{@resource[:name]}\
|
46
|
+
if output =~ /^#{@resource[:name]}\s+:\s+.*\(\s+(\S+)\s+\)/
|
47
47
|
return $1
|
48
48
|
else
|
49
49
|
# urpmi didn't find updates, pretend the current
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Puppet::Type.type(:service).provide :base do
|
2
2
|
desc "The simplest form of service support. You have to specify
|
3
3
|
enough about your service for this to work; the minimum you can specify
|
4
|
-
is a binary for starting the process, and this same binary will be
|
5
|
-
for in the process table to stop the service. It is
|
6
|
-
specify start, stop, and status commands, akin to how you
|
7
|
-
so using ``init``."
|
4
|
+
is a binary for starting the process, and this same binary will be
|
5
|
+
searched for in the process table to stop the service. It is
|
6
|
+
preferable to specify start, stop, and status commands, akin to how you
|
7
|
+
would do so using ``init``."
|
8
8
|
|
9
9
|
commands :kill => "kill"
|
10
10
|
|
@@ -22,7 +22,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
22
22
|
|
23
23
|
# If it's enabled, then it will print output showing removal of
|
24
24
|
# links.
|
25
|
-
if output =~ /etc\/rc[\dS].d|not installed/
|
25
|
+
if output =~ /etc\/rc[\dS].d\/S|not installed/
|
26
26
|
return :true
|
27
27
|
else
|
28
28
|
return :false
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# customizations of this module.
|
3
3
|
Puppet::Type.type(:service).provide :init, :parent => :base do
|
4
4
|
desc "Standard init service management. This provider assumes that the
|
5
|
-
init script has
|
6
|
-
so you need to either provide a status command or specify via
|
7
|
-
that one already exists in the init script."
|
5
|
+
init script has no ``status`` command, because so few scripts do,
|
6
|
+
so you need to either provide a status command or specify via
|
7
|
+
``hasstatus`` that one already exists in the init script."
|
8
8
|
|
9
9
|
class << self
|
10
10
|
attr_accessor :defpath
|
@@ -13,6 +13,8 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
13
13
|
case Facter["operatingsystem"].value
|
14
14
|
when "FreeBSD":
|
15
15
|
@defpath = ["/etc/rc.d", "/usr/local/etc/rc.d"]
|
16
|
+
when "HP-UX":
|
17
|
+
@defpath = "/sbin/init.d"
|
16
18
|
else
|
17
19
|
@defpath = "/etc/init.d"
|
18
20
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# Manage
|
2
|
-
|
1
|
+
# Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig
|
2
|
+
|
3
3
|
Puppet::Type.type(:service).provide :redhat, :parent => :init do
|
4
4
|
desc "Red Hat's (and probably many others) form of ``init``-style service
|
5
5
|
management; uses ``chkconfig`` for service enabling and disabling."
|
6
6
|
|
7
|
-
commands :chkconfig => "/sbin/chkconfig"
|
8
|
-
|
7
|
+
commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"
|
8
|
+
|
9
9
|
defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos]
|
10
10
|
|
11
11
|
def self.defpath
|
@@ -16,7 +16,6 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
|
|
16
16
|
def disable
|
17
17
|
begin
|
18
18
|
output = chkconfig(@resource[:name], :off)
|
19
|
-
output += chkconfig("--del", @resource[:name])
|
20
19
|
rescue Puppet::ExecutionFailure
|
21
20
|
raise Puppet::Error, "Could not disable %s: %s" %
|
22
21
|
[self.name, output]
|
@@ -43,12 +42,41 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
|
|
43
42
|
# in the init scripts.
|
44
43
|
def enable
|
45
44
|
begin
|
46
|
-
output = chkconfig(
|
47
|
-
output += chkconfig(@resource[:name], :on)
|
45
|
+
output = chkconfig(@resource[:name], :on)
|
48
46
|
rescue Puppet::ExecutionFailure => detail
|
49
47
|
raise Puppet::Error, "Could not enable %s: %s" %
|
50
48
|
[self.name, detail]
|
51
49
|
end
|
52
50
|
end
|
51
|
+
|
52
|
+
def restart
|
53
|
+
if @resource[:hasrestart] == :true
|
54
|
+
service(@resource[:name], "restart")
|
55
|
+
else
|
56
|
+
super
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def status
|
61
|
+
if @resource[:hasstatus] == :true
|
62
|
+
begin
|
63
|
+
service(@resource[:name], "status")
|
64
|
+
return :running
|
65
|
+
rescue
|
66
|
+
return :stopped
|
67
|
+
end
|
68
|
+
else
|
69
|
+
super
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def start
|
74
|
+
service(@resource[:name], "start")
|
75
|
+
end
|
76
|
+
|
77
|
+
def stop
|
78
|
+
service(@resource[:name], "stop")
|
79
|
+
end
|
80
|
+
|
53
81
|
end
|
54
82
|
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'puppet/provider/parsedfile'
|
2
|
+
|
3
|
+
Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
|
4
|
+
:parent => Puppet::Provider::ParsedFile,
|
5
|
+
:filetype => :flat,
|
6
|
+
:default_target => ''
|
7
|
+
) do
|
8
|
+
desc "Parse and generate authorized_keys files for SSH."
|
9
|
+
|
10
|
+
text_line :comment, :match => /^#/
|
11
|
+
text_line :blank, :match => /^\s+/
|
12
|
+
|
13
|
+
record_line :parsed,
|
14
|
+
:fields => %w{options type key name},
|
15
|
+
:optional => %w{options},
|
16
|
+
:rts => /^\s+/,
|
17
|
+
:match => /^(?:([^ ]+) )?(ssh-dss|ssh-rsa) ([^ ]+)(?: (.+))?$/,
|
18
|
+
:post_parse => proc { |record|
|
19
|
+
if record[:options].nil?
|
20
|
+
record[:options] = [:absent]
|
21
|
+
else
|
22
|
+
record[:options] = record[:options].split(',')
|
23
|
+
end
|
24
|
+
},
|
25
|
+
:pre_gen => proc { |record|
|
26
|
+
if record[:options].include?(:absent)
|
27
|
+
record[:options] = ""
|
28
|
+
else
|
29
|
+
record[:options] = record[:options].join(',')
|
30
|
+
end
|
31
|
+
}
|
32
|
+
|
33
|
+
def prefetch
|
34
|
+
# This was done in the type class but path expansion was failing for
|
35
|
+
# not yet existing users, the only workaround I found was to move that
|
36
|
+
# in the provider.
|
37
|
+
if user = @resource.should(:user)
|
38
|
+
target = File.expand_path("~%s/.ssh/authorized_keys" % user)
|
39
|
+
@property_hash[:target] = target
|
40
|
+
@resource[:target] = target
|
41
|
+
end
|
42
|
+
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def flush
|
47
|
+
# As path expansion had to be moved in the provider, we cannot generate new file
|
48
|
+
# resources and thus have to chown and chmod here. It smells hackish.
|
49
|
+
|
50
|
+
# Create target's parent directory if nonexistant
|
51
|
+
if target = @property_hash[:target]
|
52
|
+
dir = File.dirname(@property_hash[:target])
|
53
|
+
if not File.exist? dir
|
54
|
+
Puppet.debug("Creating directory %s which did not exist" % dir)
|
55
|
+
Dir.mkdir(dir, 0700)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Generate the file
|
60
|
+
super
|
61
|
+
|
62
|
+
# Ensure correct permissions
|
63
|
+
if target and user = @property_hash[:user]
|
64
|
+
File.chown(Puppet::Util.uid(user), nil, dir)
|
65
|
+
File.chown(Puppet::Util.uid(user), nil, @property_hash[:target])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require 'puppet/provider/ldap'
|
2
|
+
|
3
|
+
Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
|
4
|
+
desc "User 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 UID for you if
|
11
|
+
you do not specify one, but it is a potentially expensive operation,
|
12
|
+
as it iterates across all existing users to pick the appropriate next
|
13
|
+
one."
|
14
|
+
|
15
|
+
confine :feature => :ldap, :false => (Puppet[:ldapuser] == "")
|
16
|
+
|
17
|
+
has_feature :manages_passwords
|
18
|
+
|
19
|
+
manages(:posixAccount, :person).at("ou=People").named_by(:uid).and.maps :name => :uid,
|
20
|
+
:password => :userPassword,
|
21
|
+
:comment => :cn,
|
22
|
+
:uid => :uidNumber,
|
23
|
+
:gid => :gidNumber,
|
24
|
+
:home => :homeDirectory,
|
25
|
+
:shell => :loginShell
|
26
|
+
|
27
|
+
# Use the last field of a space-separated array as
|
28
|
+
# the sn. LDAP requires a surname, for some stupid reason.
|
29
|
+
manager.generates(:sn).from(:cn).with do |cn|
|
30
|
+
x = 1
|
31
|
+
cn[0].split(/\s+/)[-1]
|
32
|
+
end
|
33
|
+
|
34
|
+
# Find the next uid after the current largest uid.
|
35
|
+
provider = self
|
36
|
+
manager.generates(:uidNumber).with do
|
37
|
+
largest = 500
|
38
|
+
if existing = provider.manager.search
|
39
|
+
existing.each do |hash|
|
40
|
+
next unless value = hash[:uid]
|
41
|
+
num = value[0].to_i
|
42
|
+
if num > largest
|
43
|
+
largest = num
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
largest + 1
|
48
|
+
end
|
49
|
+
|
50
|
+
# Convert our gid to a group name, if necessary.
|
51
|
+
def gid=(value)
|
52
|
+
unless [Fixnum, Bignum].include?(value.class)
|
53
|
+
value = group2id(value)
|
54
|
+
end
|
55
|
+
|
56
|
+
@property_hash[:gid] = value
|
57
|
+
end
|
58
|
+
|
59
|
+
# Find all groups this user is a member of in ldap.
|
60
|
+
def groups
|
61
|
+
# We want to cache the current result, so we know if we
|
62
|
+
# have to remove old values.
|
63
|
+
unless @property_hash[:groups]
|
64
|
+
unless result = group_manager.search("memberUid=%s" % name)
|
65
|
+
return @property_hash[:groups] = :absent
|
66
|
+
end
|
67
|
+
|
68
|
+
return @property_hash[:groups] = result.collect { |r| r[:name] }.join(",")
|
69
|
+
end
|
70
|
+
return @property_hash[:groups]
|
71
|
+
end
|
72
|
+
|
73
|
+
# Manage the list of groups this user is a member of.
|
74
|
+
def groups=(values)
|
75
|
+
should = values.split(",")
|
76
|
+
|
77
|
+
if groups() == :absent
|
78
|
+
is = []
|
79
|
+
else
|
80
|
+
is = groups().split(",")
|
81
|
+
end
|
82
|
+
|
83
|
+
modes = {}
|
84
|
+
[is, should].flatten.uniq.each do |group|
|
85
|
+
# Skip it when they're in both
|
86
|
+
next if is.include?(group) and should.include?(group)
|
87
|
+
|
88
|
+
# We're adding a group.
|
89
|
+
modes[group] = :add and next unless is.include?(group)
|
90
|
+
|
91
|
+
# We're removing a group.
|
92
|
+
modes[group] = :remove and next unless should.include?(group)
|
93
|
+
end
|
94
|
+
|
95
|
+
modes.each do |group, form|
|
96
|
+
self.fail "Could not find ldap group %s" % group unless ldap_group = group_manager.find(group)
|
97
|
+
|
98
|
+
current = ldap_group[:members]
|
99
|
+
|
100
|
+
if form == :add
|
101
|
+
if current.is_a?(Array) and ! current.empty?
|
102
|
+
new = current + [name]
|
103
|
+
else
|
104
|
+
new = [name]
|
105
|
+
end
|
106
|
+
else
|
107
|
+
new = current - [name]
|
108
|
+
new = :absent if new.empty?
|
109
|
+
end
|
110
|
+
|
111
|
+
group_manager.update(group, {:ensure => :present, :members => current}, {:ensure => :present, :members => new})
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Convert a gropu name to an id.
|
116
|
+
def group2id(group)
|
117
|
+
Puppet::Type.type(:group).provider(:ldap).name2id(group)
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
def group_manager
|
123
|
+
Puppet::Type.type(:group).provider(:ldap).manager
|
124
|
+
end
|
125
|
+
|
126
|
+
def group_properties(values)
|
127
|
+
if values.empty? or values == :absent
|
128
|
+
{:ensure => :present}
|
129
|
+
else
|
130
|
+
{:ensure => :present, :members => values}
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -25,7 +25,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
25
25
|
|
26
26
|
def addcmd
|
27
27
|
cmd = [command(:add)]
|
28
|
-
|
28
|
+
Puppet::Type.type(:user).validproperties.each do |property|
|
29
29
|
next if property == :ensure
|
30
30
|
# the value needs to be quoted, mostly because -c might
|
31
31
|
# have spaces in it
|
@@ -1,17 +1,17 @@
|
|
1
1
|
class AddCreatedAtToAllTables < ActiveRecord::Migration
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
def self.up
|
3
|
+
ActiveRecord::Base.connection.tables.each do |t|
|
4
|
+
unless ActiveRecord::Base.connection.columns(t).collect {|c| c.name}.include?("created_at")
|
5
|
+
add_column t.to_s, :created_at, :datetime
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def self.down
|
11
|
+
ActiveRecord::Base.connection.tables.each do |t|
|
12
|
+
unless ActiveRecord::Base.connection.columns(t).collect {|c| c.name}.include?("created_at")
|
13
|
+
remove_column t.to_s, :created_at
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
17
|
end
|
@@ -14,6 +14,7 @@ class Puppet::Rails::Schema
|
|
14
14
|
t.column :exported, :boolean
|
15
15
|
t.column :line, :integer
|
16
16
|
t.column :updated_at, :datetime
|
17
|
+
t.column :created_at, :datetime
|
17
18
|
end
|
18
19
|
add_index :resources, :id, :integer => true
|
19
20
|
add_index :resources, :host_id, :integer => true
|
@@ -31,6 +32,7 @@ class Puppet::Rails::Schema
|
|
31
32
|
t.column :filename, :string
|
32
33
|
t.column :path, :string
|
33
34
|
t.column :updated_at, :datetime
|
35
|
+
t.column :created_at, :datetime
|
34
36
|
end
|
35
37
|
add_index :source_files, :id, :integer => true
|
36
38
|
add_index :source_files, :filename
|
@@ -39,6 +41,7 @@ class Puppet::Rails::Schema
|
|
39
41
|
t.column :resource_id, :integer
|
40
42
|
t.column :puppet_tag_id, :integer
|
41
43
|
t.column :updated_at, :datetime
|
44
|
+
t.column :created_at, :datetime
|
42
45
|
end
|
43
46
|
add_index :resource_tags, :id, :integer => true
|
44
47
|
add_index :resource_tags, :resource_id, :integer => true
|
@@ -47,6 +50,7 @@ class Puppet::Rails::Schema
|
|
47
50
|
create_table :puppet_tags do |t|
|
48
51
|
t.column :name, :string
|
49
52
|
t.column :updated_at, :datetime
|
53
|
+
t.column :created_at, :datetime
|
50
54
|
end
|
51
55
|
add_index :puppet_tags, :id, :integer => true
|
52
56
|
|
@@ -59,6 +63,7 @@ class Puppet::Rails::Schema
|
|
59
63
|
#Use updated_at to automatically add timestamp on save.
|
60
64
|
t.column :updated_at, :datetime
|
61
65
|
t.column :source_file_id, :integer
|
66
|
+
t.column :created_at, :datetime
|
62
67
|
end
|
63
68
|
add_index :hosts, :id, :integer => true
|
64
69
|
add_index :hosts, :source_file_id, :integer => true
|
@@ -67,6 +72,7 @@ class Puppet::Rails::Schema
|
|
67
72
|
create_table :fact_names do |t|
|
68
73
|
t.column :name, :string, :null => false
|
69
74
|
t.column :updated_at, :datetime
|
75
|
+
t.column :created_at, :datetime
|
70
76
|
end
|
71
77
|
add_index :fact_names, :id, :integer => true
|
72
78
|
add_index :fact_names, :name
|
@@ -76,6 +82,7 @@ class Puppet::Rails::Schema
|
|
76
82
|
t.column :fact_name_id, :integer, :null => false
|
77
83
|
t.column :host_id, :integer, :null => false
|
78
84
|
t.column :updated_at, :datetime
|
85
|
+
t.column :created_at, :datetime
|
79
86
|
end
|
80
87
|
add_index :fact_values, :id, :integer => true
|
81
88
|
add_index :fact_values, :fact_name_id, :integer => true
|
@@ -87,6 +94,7 @@ class Puppet::Rails::Schema
|
|
87
94
|
t.column :line, :integer
|
88
95
|
t.column :resource_id, :integer
|
89
96
|
t.column :updated_at, :datetime
|
97
|
+
t.column :created_at, :datetime
|
90
98
|
end
|
91
99
|
add_index :param_values, :id, :integer => true
|
92
100
|
add_index :param_values, :param_name_id, :integer => true
|
@@ -95,6 +103,7 @@ class Puppet::Rails::Schema
|
|
95
103
|
create_table :param_names do |t|
|
96
104
|
t.column :name, :string, :null => false
|
97
105
|
t.column :updated_at, :datetime
|
106
|
+
t.column :created_at, :datetime
|
98
107
|
end
|
99
108
|
add_index :param_names, :id, :integer => true
|
100
109
|
add_index :param_names, :name
|