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
data/ext/ldap/puppet.schema
CHANGED
@@ -12,11 +12,16 @@ attributetype ( 1.1.3.9 NAME 'parentnode'
|
|
12
12
|
EQUALITY caseIgnoreIA5Match
|
13
13
|
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
14
14
|
|
15
|
-
attributetype ( 1.1.3.
|
15
|
+
attributetype ( 1.1.3.11 NAME 'environment'
|
16
16
|
DESC 'Puppet Node Environment'
|
17
17
|
EQUALITY caseIgnoreIA5Match
|
18
18
|
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
19
19
|
|
20
|
+
attributetype ( 1.1.3.12 NAME 'puppetvar'
|
21
|
+
DESC 'A variable setting for puppet'
|
22
|
+
EQUALITY caseIgnoreIA5Match
|
23
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
24
|
+
|
20
25
|
objectclass ( 1.1.1.2 NAME 'puppetClient' SUP top AUXILIARY
|
21
26
|
DESC 'Puppet Client objectclass'
|
22
|
-
MAY ( puppetclass $ parentnode $ environment ))
|
27
|
+
MAY ( puppetclass $ parentnode $ environment $ puppetvar ))
|
data/ext/module_puppet
CHANGED
@@ -138,8 +138,9 @@ server = nil
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
Puppet.
|
142
|
-
Puppet.
|
141
|
+
if Puppet.settings.print_configs?
|
142
|
+
exit(Puppet.settings.print_configs ? 0 : 1)
|
143
|
+
end
|
143
144
|
|
144
145
|
unless ARGV.length > 0
|
145
146
|
$stderr.puts "You must pass a script to parse"
|
@@ -179,7 +180,7 @@ node.classes = classes
|
|
179
180
|
|
180
181
|
begin
|
181
182
|
# Compile our configuration
|
182
|
-
catalog = Puppet::Node::Catalog.find(node)
|
183
|
+
catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
|
183
184
|
rescue => detail
|
184
185
|
if Puppet[:trace]
|
185
186
|
puts detail.backtrace
|
@@ -0,0 +1,117 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'sys/proctable'
|
5
|
+
include Sys
|
6
|
+
|
7
|
+
class CheckPuppet
|
8
|
+
|
9
|
+
VERSION = '0.1'
|
10
|
+
script_name = File.basename($0)
|
11
|
+
|
12
|
+
# default options
|
13
|
+
OPTIONS = {
|
14
|
+
:statefile => "/var/puppet/state/state.yaml",
|
15
|
+
:process => "puppetd",
|
16
|
+
:interval => 30,
|
17
|
+
}
|
18
|
+
|
19
|
+
o = OptionParser.new do |o|
|
20
|
+
o.set_summary_indent(' ')
|
21
|
+
o.banner = "Usage: #{script_name} [OPTIONS]"
|
22
|
+
o.define_head "The check_puppet Nagios plug-in checks that specified " +
|
23
|
+
"Puppet process is running and the state file is no " +
|
24
|
+
"older than specified interval."
|
25
|
+
o.separator ""
|
26
|
+
o.separator "Mandatory arguments to long options are mandatory for " +
|
27
|
+
"short options too."
|
28
|
+
|
29
|
+
o.on("-s", "--statefile=statefile", String, "The state file",
|
30
|
+
"Default: #{OPTIONS[:statefile]}") { |OPTIONS[:statefile]| }
|
31
|
+
o.on("-p", "--process=processname", String, "The process to check",
|
32
|
+
"Default: #{OPTIONS[:process]}") { |OPTIONS[:process]| }
|
33
|
+
o.on("-i", "--interval=value", Integer,
|
34
|
+
"Default: #{OPTIONS[:interval]} minutes") { |OPTIONS[:interval]| }
|
35
|
+
|
36
|
+
o.separator ""
|
37
|
+
o.on_tail("-h", "--help", "Show this help message.") do
|
38
|
+
puts o
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
o.parse!(ARGV)
|
43
|
+
end
|
44
|
+
|
45
|
+
def check_proc
|
46
|
+
|
47
|
+
unless ProcTable.ps.find { |p| p.name == OPTIONS[:process]}
|
48
|
+
@proc = 2
|
49
|
+
else
|
50
|
+
@proc = 0
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def check_state
|
56
|
+
|
57
|
+
# Set variables
|
58
|
+
curt = Time.now
|
59
|
+
intv = OPTIONS[:interval] * 60
|
60
|
+
|
61
|
+
# Check file time
|
62
|
+
begin
|
63
|
+
@modt = File.mtime("#{OPTIONS[:statefile]}")
|
64
|
+
rescue
|
65
|
+
@file = 3
|
66
|
+
end
|
67
|
+
|
68
|
+
diff = (curt - @modt).to_i
|
69
|
+
|
70
|
+
if diff > intv
|
71
|
+
@file = 2
|
72
|
+
else
|
73
|
+
@file = 0
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def output_status
|
79
|
+
|
80
|
+
case @file
|
81
|
+
when 0
|
82
|
+
state = "state file status okay updated on " + @modt.strftime("%m/%d/%Y at %H:%M:%S")
|
83
|
+
when 2
|
84
|
+
state = "state fille is not up to date and is older than #{OPTIONS[:interval]} minutes"
|
85
|
+
when 3
|
86
|
+
state = "state file status unknown"
|
87
|
+
end
|
88
|
+
|
89
|
+
case @proc
|
90
|
+
when 0
|
91
|
+
process = "process #{OPTIONS[:process]} is running"
|
92
|
+
when 2
|
93
|
+
process = "process #{OPTIONS[:process]} is not running"
|
94
|
+
end
|
95
|
+
|
96
|
+
case @proc or @file
|
97
|
+
when 0
|
98
|
+
status = "OK"
|
99
|
+
exitcode = 0
|
100
|
+
when 2
|
101
|
+
status = "CRITICAL"
|
102
|
+
exitcode = 2
|
103
|
+
when 3
|
104
|
+
status = "UNKNOWN"
|
105
|
+
exitcide = 3
|
106
|
+
end
|
107
|
+
|
108
|
+
puts "PUPPET " + status + ": " + process + ", " + state
|
109
|
+
exit(exitcode)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
cp = CheckPuppet.new
|
114
|
+
cp.check_proc
|
115
|
+
cp.check_state
|
116
|
+
cp.output_status
|
117
|
+
|
data/ext/puppetlast
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Script to print out when puppet ran successfully last
|
4
|
+
# AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'puppet'
|
8
|
+
require 'puppet/defaults'
|
9
|
+
require 'yaml'
|
10
|
+
|
11
|
+
Puppet[:config] = "/etc/puppet/puppet.conf"
|
12
|
+
Puppet.parse_config
|
13
|
+
|
14
|
+
print "puppetlast\n"
|
15
|
+
|
16
|
+
nodes = {}
|
17
|
+
|
18
|
+
yfdir = Puppet.settings.value(:vardir) + "/yaml/facts"
|
19
|
+
|
20
|
+
if yfdir
|
21
|
+
begin
|
22
|
+
Dir.chdir(yfdir) do
|
23
|
+
Dir.glob("*.yaml").each do |yaml|
|
24
|
+
data = YAML.load_file(yaml)
|
25
|
+
t = Time.now
|
26
|
+
age = t - data.version
|
27
|
+
nodes[data.name] = age.to_i
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
nodes.sort.each do |node,age|
|
32
|
+
minutes = age / 60 + 0.5
|
33
|
+
print minutes.floor.to_s + ' minutes ago: ' + node + "\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
rescue
|
37
|
+
print 'error: ' + $! + "\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/install.rb
CHANGED
@@ -78,7 +78,7 @@ rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO In
|
|
78
78
|
ri = glob(%w(bin/*.rb sbin/* lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ }
|
79
79
|
man = glob(%w{man/man8/*})
|
80
80
|
libs = glob(%w{lib/**/*.rb lib/**/*.py})
|
81
|
-
tests = glob(%w{
|
81
|
+
tests = glob(%w{test/**/*.rb})
|
82
82
|
|
83
83
|
def do_bins(bins, target, strip = 's?bin/')
|
84
84
|
bins.each do |bf|
|
@@ -106,7 +106,7 @@ def do_man(man, strip = 'man/')
|
|
106
106
|
File.install(mf, omf, 0644, true)
|
107
107
|
gzip = %x{which gzip}
|
108
108
|
gzip.chomp!
|
109
|
-
%x{#{gzip} #{omf}}
|
109
|
+
%x{#{gzip} -f #{omf}}
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -200,6 +200,15 @@ def prepare_installation
|
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
203
|
+
# Mac OS X 10.5 declares bindir and sbindir as
|
204
|
+
# /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
|
205
|
+
# /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/sbin
|
206
|
+
# which is not generally where people expect executables to be installed
|
207
|
+
if RUBY_PLATFORM == "universal-darwin9.0"
|
208
|
+
Config::CONFIG['bindir'] = "/usr/bin"
|
209
|
+
Config::CONFIG['sbindir'] = "/usr/sbin"
|
210
|
+
end
|
211
|
+
|
203
212
|
if (destdir = ENV['DESTDIR'])
|
204
213
|
bindir = "#{destdir}#{Config::CONFIG['bindir']}"
|
205
214
|
sbindir = "#{destdir}#{Config::CONFIG['sbindir']}"
|
@@ -374,7 +383,7 @@ EOS
|
|
374
383
|
check_prereqs
|
375
384
|
prepare_installation
|
376
385
|
|
377
|
-
run_tests(tests) if InstallOptions.tests
|
386
|
+
#run_tests(tests) if InstallOptions.tests
|
378
387
|
#build_rdoc(rdoc) if InstallOptions.rdoc
|
379
388
|
#build_ri(ri) if InstallOptions.ri
|
380
389
|
#build_man(bins) if InstallOptions.man
|
data/lib/puppet.rb
CHANGED
@@ -25,7 +25,7 @@ require 'puppet/util/suidmanager'
|
|
25
25
|
# it's also a place to find top-level commands like 'debug'
|
26
26
|
|
27
27
|
module Puppet
|
28
|
-
PUPPETVERSION = '0.24.
|
28
|
+
PUPPETVERSION = '0.24.5'
|
29
29
|
|
30
30
|
def Puppet.version
|
31
31
|
return PUPPETVERSION
|
@@ -117,49 +117,6 @@ module Puppet
|
|
117
117
|
# Load all of the configuration parameters.
|
118
118
|
require 'puppet/defaults'
|
119
119
|
|
120
|
-
# Prints the contents of a config file with the available config elements, or it
|
121
|
-
# prints a single value of a config element.
|
122
|
-
def self.genconfig
|
123
|
-
if Puppet[:configprint] != ""
|
124
|
-
val = Puppet[:configprint]
|
125
|
-
if val == "all"
|
126
|
-
hash = {}
|
127
|
-
Puppet.settings.each do |name, obj|
|
128
|
-
val = obj.value
|
129
|
-
case val
|
130
|
-
when true, false, "": val = val.inspect
|
131
|
-
end
|
132
|
-
hash[name] = val
|
133
|
-
end
|
134
|
-
hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val|
|
135
|
-
puts "%s = %s" % [name, val]
|
136
|
-
end
|
137
|
-
elsif val =~ /,/
|
138
|
-
val.split(/\s*,\s*/).sort.each do |v|
|
139
|
-
if Puppet.settings.include?(v)
|
140
|
-
puts "%s = %s" % [v, Puppet[v]]
|
141
|
-
else
|
142
|
-
puts "invalid parameter: %s" % v
|
143
|
-
exit(1)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
else
|
147
|
-
val.split(/\s*,\s*/).sort.each do |v|
|
148
|
-
if Puppet.settings.include?(v)
|
149
|
-
puts Puppet[val]
|
150
|
-
else
|
151
|
-
puts "invalid parameter: %s" % v
|
152
|
-
exit(1)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
exit(0)
|
157
|
-
end
|
158
|
-
if Puppet[:genconfig]
|
159
|
-
puts Puppet.settings.to_config
|
160
|
-
exit(0)
|
161
|
-
end
|
162
|
-
end
|
163
120
|
|
164
121
|
def self.genmanifest
|
165
122
|
if Puppet[:genmanifest]
|
data/lib/puppet/defaults.rb
CHANGED
@@ -69,8 +69,6 @@ module Puppet
|
|
69
69
|
:rundir => {
|
70
70
|
:default => rundir,
|
71
71
|
:mode => 01777,
|
72
|
-
:owner => "$user",
|
73
|
-
:group => "$group",
|
74
72
|
:desc => "Where Puppet PID files are kept."
|
75
73
|
},
|
76
74
|
:genconfig => [false,
|
@@ -128,7 +126,7 @@ module Puppet
|
|
128
126
|
This is more useful as a server-side setting than client, but any
|
129
127
|
environment chosen must be in this list. Values should be
|
130
128
|
separated by a comma."],
|
131
|
-
:environment => {:default => "
|
129
|
+
:environment => {:default => "production", :desc => "The environment Puppet is running in. For clients
|
132
130
|
(e.g., ``puppetd``) this determines the environment itself, which
|
133
131
|
is used to find modules and much more. For servers (i.e.,
|
134
132
|
``puppetmasterd``) this provides the default environment for nodes
|
@@ -160,8 +158,12 @@ module Puppet
|
|
160
158
|
end
|
161
159
|
|
162
160
|
Puppet.setdefaults(:ssl,
|
163
|
-
|
164
|
-
|
161
|
+
# We have to downcase the fqdn, because the current ssl stuff (as oppsed to in master) doesn't have good facilities for
|
162
|
+
# manipulating naming.
|
163
|
+
:certname => {:default => fqdn.downcase, :desc => "The name to use when handling certificates. Defaults
|
164
|
+
to the fully qualified domain name.",
|
165
|
+
:call_on_define => true, # Call our hook with the default value, so we're always downcased
|
166
|
+
:hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case; see #1168") unless value == value.downcase }},
|
165
167
|
:certdnsnames => ['', "The DNS names on the Server certificate as a colon-separated list.
|
166
168
|
If it's anything other than an empty string, it will be used as an alias in the created
|
167
169
|
certificate. By default, only the server gets an alias set up, and only for 'puppet'."],
|
@@ -354,7 +356,9 @@ module Puppet
|
|
354
356
|
# To make sure this directory is created before we try to use it on the server, we need
|
355
357
|
# it to be in the server section (#1138).
|
356
358
|
:yamldir => {:default => "$vardir/yaml", :owner => "$user", :group => "$user", :mode => "750",
|
357
|
-
:desc => "The directory in which YAML data is stored, usually in a subdirectory."}
|
359
|
+
:desc => "The directory in which YAML data is stored, usually in a subdirectory."},
|
360
|
+
:clientyamldir => {:default => "$vardir/client_yaml", :mode => "750",
|
361
|
+
:desc => "The directory in which client-side YAML data is stored."}
|
358
362
|
)
|
359
363
|
|
360
364
|
self.setdefaults(:puppetd,
|
@@ -412,7 +416,10 @@ module Puppet
|
|
412
416
|
:ca_server => ["$server", "The server to use for certificate
|
413
417
|
authority requests. It's a separate server because it cannot
|
414
418
|
and does not need to horizontally scale."],
|
415
|
-
:ca_port => ["$masterport", "The port to use for the certificate authority."]
|
419
|
+
:ca_port => ["$masterport", "The port to use for the certificate authority."],
|
420
|
+
:catalog_format => ["yaml", "What format to use to dump the catalog. Only supports
|
421
|
+
'marshal' and 'yaml'. Only matters on the client, since it asks the server
|
422
|
+
for a specific format."]
|
416
423
|
)
|
417
424
|
|
418
425
|
self.setdefaults(:filebucket,
|
@@ -505,9 +512,11 @@ module Puppet
|
|
505
512
|
|
506
513
|
# Central fact information.
|
507
514
|
self.setdefaults(:main,
|
508
|
-
:factpath =>
|
509
|
-
"Where Puppet should look for facts. Multiple directories should
|
510
|
-
|
515
|
+
:factpath => {:default => "$vardir/facts",
|
516
|
+
:desc => "Where Puppet should look for facts. Multiple directories should
|
517
|
+
be colon-separated, like normal PATH variables.",
|
518
|
+
:call_on_define => true, # Call our hook with the default value, so we always get the value added to facter.
|
519
|
+
:hook => proc { |value| Facter.search(value) if Facter.respond_to?(:search) }},
|
511
520
|
:factdest => ["$vardir/facts",
|
512
521
|
"Where Puppet should store facts that it pulls down from the central
|
513
522
|
server."],
|
@@ -622,6 +631,10 @@ module Puppet
|
|
622
631
|
:ldapclassattrs => ["puppetclass",
|
623
632
|
"The LDAP attributes to use to define Puppet classes. Values
|
624
633
|
should be comma-separated."],
|
634
|
+
:ldapstackedattrs => ["puppetvar",
|
635
|
+
"The LDAP attributes that should be stacked to arrays by adding
|
636
|
+
the values in all hierarchy elements of the tree. Values
|
637
|
+
should be comma-separated."],
|
625
638
|
:ldapattrs => ["all",
|
626
639
|
"The LDAP attributes to include when querying LDAP for nodes. All
|
627
640
|
returned attributes are set as variables in the top-level scope.
|
data/lib/puppet/dsl.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Just quick mess-around to see what a DSL would look like.
|
2
2
|
#
|
3
3
|
# This is what the executable could look like:
|
4
|
-
##!/usr/bin/ruby
|
4
|
+
##!/usr/bin/env ruby
|
5
5
|
#
|
6
6
|
#require 'puppet'
|
7
7
|
#require 'puppet/dsl'
|
@@ -23,7 +23,7 @@
|
|
23
23
|
# And here's what an example config could look like:
|
24
24
|
#
|
25
25
|
|
26
|
-
##!/usr/bin/ruby
|
26
|
+
##!/usr/bin/env ruby
|
27
27
|
#
|
28
28
|
#
|
29
29
|
# require 'puppet'
|
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
module Puppet
|
3
|
+
module Executables
|
4
|
+
module Client
|
5
|
+
class CertHandler
|
6
|
+
attr_writer :wait_for_cert, :one_time
|
7
|
+
attr_reader :new_cert
|
8
|
+
|
9
|
+
def initialize(wait_time, is_one_time)
|
10
|
+
@wait_for_cert = wait_time
|
11
|
+
@one_time = is_one_time
|
12
|
+
@new_cert = false
|
13
|
+
end
|
14
|
+
|
15
|
+
# Did we just read a cert?
|
16
|
+
def new_cert?
|
17
|
+
new_cert
|
18
|
+
end
|
19
|
+
|
20
|
+
# Read, or retrieve if necessary, our certificate. Returns true if we retrieved
|
21
|
+
# a new cert, false if the cert already exists.
|
22
|
+
def read_retrieve
|
23
|
+
#NOTE: ACS this is checking that a file exists, maybe next time just do that?
|
24
|
+
unless read_cert
|
25
|
+
# If we don't already have the certificate, then create a client to
|
26
|
+
# request one. Use the special ca stuff, don't use the normal server and port.
|
27
|
+
retrieve_cert
|
28
|
+
end
|
29
|
+
|
30
|
+
! new_cert?
|
31
|
+
end
|
32
|
+
|
33
|
+
def retrieve_cert
|
34
|
+
caclient = Puppet::Network::Client.ca.new()
|
35
|
+
|
36
|
+
while true do
|
37
|
+
begin
|
38
|
+
if caclient.request_cert
|
39
|
+
break if read_new_cert
|
40
|
+
else
|
41
|
+
Puppet.notice "Did not receive certificate"
|
42
|
+
if @one_time
|
43
|
+
Puppet.notice "Set to run 'one time'; exiting with no certificate"
|
44
|
+
exit(1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
rescue StandardError => detail
|
48
|
+
Puppet.err "Could not request certificate: %s" % detail.to_s
|
49
|
+
exit(23) if @one_time
|
50
|
+
end
|
51
|
+
|
52
|
+
sleep @wait_for_cert
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def read_cert
|
57
|
+
Puppet::Network::HttpPool.read_cert
|
58
|
+
end
|
59
|
+
|
60
|
+
def read_new_cert
|
61
|
+
if Puppet::Network::HttpPool.read_cert
|
62
|
+
# If we read it in, then we need to get rid of our existing http connection.
|
63
|
+
# The @new_cert flag will help us do that, in that it provides a way
|
64
|
+
# to notify that the cert status has changed.
|
65
|
+
@new_cert = true
|
66
|
+
Puppet.notice "Got signed certificate"
|
67
|
+
else
|
68
|
+
Puppet.err "Could not read certificates after retrieving them"
|
69
|
+
exit(34) if @one_time
|
70
|
+
end
|
71
|
+
|
72
|
+
return @new_cert
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|