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
@@ -128,20 +128,6 @@ class Puppet::Indirector::Terminus
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
# Do we have an update for this object? This compares the provided version
|
132
|
-
# to our version, and returns true if our version is at least as high
|
133
|
-
# as the asked-about version.
|
134
|
-
def has_most_recent?(key, vers)
|
135
|
-
raise Puppet::DevError.new("Cannot check update status when no 'version' method is defined") unless respond_to?(:version)
|
136
|
-
|
137
|
-
if existing_version = version(key)
|
138
|
-
#puts "%s fresh: %s (%s vs %s)" % [self.name, (existing_version.to_f >= vers.to_f).inspect, existing_version.to_f, vers.to_f]
|
139
|
-
existing_version.to_f >= vers.to_f
|
140
|
-
else
|
141
|
-
false
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
131
|
def indirection
|
146
132
|
self.class.indirection
|
147
133
|
end
|
@@ -163,17 +149,4 @@ class Puppet::Indirector::Terminus
|
|
163
149
|
def terminus_type
|
164
150
|
self.class.terminus_type
|
165
151
|
end
|
166
|
-
|
167
|
-
# Provide a default method for retrieving an instance's version.
|
168
|
-
# By default, just find the resource and get its version. Individual
|
169
|
-
# terminus types can override this method to provide custom definitions of
|
170
|
-
# 'versions'.
|
171
|
-
def version(name)
|
172
|
-
raise Puppet::DevError.new("Cannot retrieve an instance's version without a :find method") unless respond_to?(:find)
|
173
|
-
if instance = find(name)
|
174
|
-
instance.version
|
175
|
-
else
|
176
|
-
nil
|
177
|
-
end
|
178
|
-
end
|
179
152
|
end
|
@@ -3,23 +3,22 @@ require 'puppet/indirector/terminus'
|
|
3
3
|
# The base class for YAML indirection termini.
|
4
4
|
class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
|
5
5
|
# Read a given name's file in and convert it from YAML.
|
6
|
-
def find(
|
7
|
-
|
8
|
-
file = path(name)
|
6
|
+
def find(request)
|
7
|
+
file = path(request.key)
|
9
8
|
return nil unless FileTest.exist?(file)
|
10
9
|
|
11
10
|
begin
|
12
11
|
return from_yaml(File.read(file))
|
13
12
|
rescue => detail
|
14
|
-
raise Puppet::Error, "Could not read YAML data for %s %s: %s" % [indirection.name,
|
13
|
+
raise Puppet::Error, "Could not read YAML data for %s %s: %s" % [indirection.name, request.key, detail]
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
# Convert our object to YAML and store it to the disk.
|
19
|
-
def save(
|
20
|
-
raise ArgumentError.new("You can only save objects that respond to :name") unless
|
18
|
+
def save(request)
|
19
|
+
raise ArgumentError.new("You can only save objects that respond to :name") unless request.instance.respond_to?(:name)
|
21
20
|
|
22
|
-
file = path(
|
21
|
+
file = path(request.key)
|
23
22
|
|
24
23
|
basedir = File.dirname(file)
|
25
24
|
|
@@ -29,15 +28,16 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
|
|
29
28
|
end
|
30
29
|
|
31
30
|
begin
|
32
|
-
File.open(file, "w", 0660) { |f| f.print to_yaml(
|
31
|
+
File.open(file, "w", 0660) { |f| f.print to_yaml(request.instance) }
|
33
32
|
rescue TypeError => detail
|
34
|
-
Puppet.err "Could not save %s %s: %s" % [self.name,
|
33
|
+
Puppet.err "Could not save %s %s: %s" % [self.name, request.key, detail]
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
# Return the path to a given node's file.
|
38
|
+
def path(name)
|
39
|
+
base = (Puppet[:name] == "puppetmasterd") ? Puppet[:yamldir] : Puppet[:clientyamldir]
|
40
|
+
File.join(base, self.class.indirection_name.to_s, name.to_s + ".yaml")
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
@@ -49,9 +49,4 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
|
|
49
49
|
def to_yaml(object)
|
50
50
|
YAML.dump(object)
|
51
51
|
end
|
52
|
-
|
53
|
-
# Return the path to a given node's file.
|
54
|
-
def path(name)
|
55
|
-
File.join(Puppet[:yamldir], self.class.indirection_name.to_s, name.to_s + ".yaml")
|
56
|
-
end
|
57
52
|
end
|
@@ -477,13 +477,9 @@ class Puppet::Type
|
|
477
477
|
end
|
478
478
|
|
479
479
|
if obj = @parameters[name]
|
480
|
-
#
|
481
|
-
#
|
482
|
-
|
483
|
-
fail "[] called on a property"
|
484
|
-
else
|
485
|
-
return obj.value
|
486
|
-
end
|
480
|
+
# Note that if this is a property, then the value is the "should" value,
|
481
|
+
# not the current value.
|
482
|
+
obj.value
|
487
483
|
else
|
488
484
|
return nil
|
489
485
|
end
|
@@ -139,7 +139,7 @@ class Puppet::Type
|
|
139
139
|
end
|
140
140
|
|
141
141
|
if ensureparam and ! ensureparam.insync?(currentvalues[ensureparam])
|
142
|
-
changes << Puppet::
|
142
|
+
changes << Puppet::Transaction::Change.new(ensureparam, currentvalues[ensureparam])
|
143
143
|
# Else, if the 'ensure' property is correctly absent, then do
|
144
144
|
# nothing
|
145
145
|
elsif ensureparam and currentvalues[ensureparam] == :absent
|
@@ -149,7 +149,7 @@ class Puppet::Type
|
|
149
149
|
currentvalues[property] ||= :absent
|
150
150
|
! property.insync?(currentvalues[property])
|
151
151
|
}.collect { |property|
|
152
|
-
Puppet::
|
152
|
+
Puppet::Transaction::Change.new(property, currentvalues[property])
|
153
153
|
}
|
154
154
|
end
|
155
155
|
|
data/lib/puppet/module.rb
CHANGED
@@ -63,6 +63,10 @@ class Puppet::Module
|
|
63
63
|
return template
|
64
64
|
end
|
65
65
|
|
66
|
+
# If we can find the template in :templatedir, we return that.
|
67
|
+
td_file = File.join(Puppet.settings.value(:templatedir, environment), template)
|
68
|
+
return td_file if File.exists?(td_file)
|
69
|
+
|
66
70
|
path, file = split_path(template)
|
67
71
|
|
68
72
|
# Because templates don't have an assumed template name, like manifests do,
|
@@ -76,7 +80,7 @@ class Puppet::Module
|
|
76
80
|
if mod
|
77
81
|
return mod.template(file)
|
78
82
|
else
|
79
|
-
return
|
83
|
+
return td_file # Return this anyway, since we're going to fail.
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
@@ -132,7 +136,7 @@ class Puppet::Module
|
|
132
136
|
def manifests(rest)
|
133
137
|
rest ||= "init.pp"
|
134
138
|
p = File::join(path, MANIFESTS, rest)
|
135
|
-
files = Dir.glob(p)
|
139
|
+
files = Dir.glob(p).reject { |f| FileTest.directory?(f) }
|
136
140
|
if files.size == 0
|
137
141
|
files = Dir.glob(p + ".pp")
|
138
142
|
end
|
@@ -26,6 +26,20 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
26
26
|
|
27
27
|
down = Puppet[:downcasefacts]
|
28
28
|
|
29
|
+
Facter.clear
|
30
|
+
|
31
|
+
# Reload everything.
|
32
|
+
if Facter.respond_to? :loadfacts
|
33
|
+
Facter.loadfacts
|
34
|
+
elsif Facter.respond_to? :load
|
35
|
+
Facter.load
|
36
|
+
else
|
37
|
+
Puppet.warning "You should upgrade your version of Facter to at least 1.3.8"
|
38
|
+
end
|
39
|
+
|
40
|
+
# This loads all existing facts and any new ones. We have to remove and
|
41
|
+
# reload because there's no way to unload specific facts.
|
42
|
+
loadfacts()
|
29
43
|
facts = Facter.to_hash.inject({}) do |newhash, array|
|
30
44
|
name, fact = array
|
31
45
|
if down
|
@@ -49,6 +63,8 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
49
63
|
end
|
50
64
|
|
51
65
|
# Return the list of dynamic facts as an array of symbols
|
66
|
+
# NOTE:LAK(2008/04/10): This code is currently unused, since we now always
|
67
|
+
# recompile.
|
52
68
|
def self.dynamic_facts
|
53
69
|
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
|
54
70
|
x = Puppet.settings[:dynamicfacts].split(/\s*,\s*/).collect { |fact| fact.downcase }
|
@@ -97,31 +113,6 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
97
113
|
end
|
98
114
|
end
|
99
115
|
|
100
|
-
# Check whether our catalog is up to date
|
101
|
-
def fresh?(facts)
|
102
|
-
if Puppet[:ignorecache]
|
103
|
-
Puppet.notice "Ignoring cache"
|
104
|
-
return false
|
105
|
-
end
|
106
|
-
unless self.compile_time
|
107
|
-
Puppet.debug "No cached compile time"
|
108
|
-
return false
|
109
|
-
end
|
110
|
-
if facts_changed?(facts)
|
111
|
-
Puppet.info "Facts have changed; recompiling" unless local?
|
112
|
-
return false
|
113
|
-
end
|
114
|
-
|
115
|
-
newcompile = @driver.freshness
|
116
|
-
# We're willing to give a 2 second drift
|
117
|
-
if newcompile - @compile_time.to_i < 1
|
118
|
-
return true
|
119
|
-
else
|
120
|
-
Puppet.debug "Server compile time is %s vs %s" % [newcompile, @compile_time.to_i]
|
121
|
-
return false
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
116
|
# Let the daemon run again, freely in the filesystem. Frolick, little
|
126
117
|
# daemon!
|
127
118
|
def enable
|
@@ -138,6 +129,9 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
138
129
|
def getconfig
|
139
130
|
dostorage()
|
140
131
|
|
132
|
+
# Retrieve the plugins.
|
133
|
+
getplugins() if Puppet[:pluginsync]
|
134
|
+
|
141
135
|
facts = nil
|
142
136
|
Puppet::Util.benchmark(:debug, "Retrieved facts") do
|
143
137
|
facts = self.class.facts
|
@@ -145,27 +139,24 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
145
139
|
|
146
140
|
raise Puppet::Network::ClientError.new("Could not retrieve any facts") unless facts.length > 0
|
147
141
|
|
148
|
-
# Retrieve the plugins.
|
149
|
-
getplugins() if Puppet[:pluginsync]
|
150
|
-
|
151
|
-
if (self.catalog or FileTest.exist?(self.cachefile)) and self.fresh?(facts)
|
152
|
-
Puppet.info "Configuration is up to date"
|
153
|
-
return if use_cached_config
|
154
|
-
end
|
155
|
-
|
156
142
|
Puppet.debug("Retrieving catalog")
|
157
143
|
|
158
144
|
# If we can't retrieve the catalog, just return, which will either
|
159
145
|
# fail, or use the in-memory catalog.
|
160
|
-
unless
|
146
|
+
unless marshalled_objects = get_actual_config(facts)
|
161
147
|
use_cached_config(true)
|
162
148
|
return
|
163
149
|
end
|
164
150
|
|
165
151
|
begin
|
166
|
-
|
152
|
+
case Puppet[:catalog_format]
|
153
|
+
when "marshal": objects = Marshal.load(marshalled_objects)
|
154
|
+
when "yaml": objects = YAML.load(marshalled_objects)
|
155
|
+
else
|
156
|
+
raise "Invalid catalog format '%s'" % Puppet[:catalog_format]
|
157
|
+
end
|
167
158
|
rescue => detail
|
168
|
-
msg = "Configuration could not be translated from
|
159
|
+
msg = "Configuration could not be translated from %s" % Puppet[:catalog_format]
|
169
160
|
msg += "; using cached catalog" if use_cached_config(true)
|
170
161
|
Puppet.warning msg
|
171
162
|
return
|
@@ -189,7 +180,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
189
180
|
end
|
190
181
|
|
191
182
|
if ! @catalog.from_cache
|
192
|
-
self.cache(
|
183
|
+
self.cache(marshalled_objects)
|
193
184
|
end
|
194
185
|
|
195
186
|
# Keep the state database up to date.
|
@@ -368,23 +359,6 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
368
359
|
|
369
360
|
files << resource[:path]
|
370
361
|
end
|
371
|
-
ensure
|
372
|
-
# Clear all existing definitions.
|
373
|
-
Facter.clear
|
374
|
-
|
375
|
-
# Reload everything.
|
376
|
-
if Facter.respond_to? :loadfacts
|
377
|
-
Facter.loadfacts
|
378
|
-
elsif Facter.respond_to? :load
|
379
|
-
Facter.load
|
380
|
-
else
|
381
|
-
raise Puppet::Error,
|
382
|
-
"You must upgrade your version of Facter to use centralized facts"
|
383
|
-
end
|
384
|
-
|
385
|
-
# This loads all existing facts and any new ones. We have to remove and
|
386
|
-
# reload because there's no way to unload specific facts.
|
387
|
-
loadfacts()
|
388
362
|
end
|
389
363
|
|
390
364
|
# Retrieve the plugins from the central server. We only have to load the
|
@@ -451,32 +425,6 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
451
425
|
|
452
426
|
loadfacts()
|
453
427
|
|
454
|
-
# Have the facts changed since we last compiled?
|
455
|
-
def facts_changed?(facts)
|
456
|
-
oldfacts = (Puppet::Util::Storage.cache(:configuration)[:facts] || {}).dup
|
457
|
-
newfacts = facts.dup
|
458
|
-
self.class.dynamic_facts.each do |fact|
|
459
|
-
[oldfacts, newfacts].each do |facthash|
|
460
|
-
facthash.delete(fact) if facthash.include?(fact)
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
if oldfacts == newfacts
|
465
|
-
return false
|
466
|
-
else
|
467
|
-
# unless oldfacts
|
468
|
-
# puts "no old facts"
|
469
|
-
# return true
|
470
|
-
# end
|
471
|
-
# newfacts.keys.each do |k|
|
472
|
-
# unless newfacts[k] == oldfacts[k]
|
473
|
-
# puts "%s: %s vs %s" % [k, newfacts[k], oldfacts[k]]
|
474
|
-
# end
|
475
|
-
# end
|
476
|
-
return true
|
477
|
-
end
|
478
|
-
end
|
479
|
-
|
480
428
|
# Actually retrieve the catalog, either from the server or from a
|
481
429
|
# local master.
|
482
430
|
def get_actual_config(facts)
|
@@ -499,7 +447,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
499
447
|
benchmark(:debug, "Retrieved catalog") do
|
500
448
|
# error handling for this is done in the network client
|
501
449
|
begin
|
502
|
-
textobjects = @driver.getconfig(textfacts,
|
450
|
+
textobjects = @driver.getconfig(textfacts, Puppet[:catalog_format])
|
503
451
|
begin
|
504
452
|
textobjects = CGI.unescape(textobjects)
|
505
453
|
rescue => detail
|
@@ -23,8 +23,8 @@ class Puppet::Network::Handler
|
|
23
23
|
|
24
24
|
# Tell a client whether there's a fresh config for it
|
25
25
|
def freshness(client = nil, clientip = nil)
|
26
|
-
|
27
|
-
|
26
|
+
# Always force a recompile. Newer clients shouldn't do this (as of April 2008).
|
27
|
+
Time.now
|
28
28
|
end
|
29
29
|
|
30
30
|
def initialize(hash = {})
|
@@ -51,53 +51,27 @@ class Puppet::Network::Handler
|
|
51
51
|
if hash.include?(:Classes)
|
52
52
|
args[:Classes] = hash[:Classes]
|
53
53
|
end
|
54
|
-
|
55
|
-
@config_handler = Puppet::Network::Handler.handler(:configuration).new(args)
|
56
54
|
end
|
57
55
|
|
58
56
|
# Call our various handlers; this handler is getting deprecated.
|
59
57
|
def getconfig(facts, format = "marshal", client = nil, clientip = nil)
|
60
58
|
facts = decode_facts(facts)
|
61
|
-
|
59
|
+
|
60
|
+
client ||= facts["hostname"]
|
62
61
|
|
63
62
|
# Pass the facts to the fact handler
|
64
63
|
Puppet::Node::Facts.new(client, facts).save unless local?
|
65
64
|
|
66
|
-
|
67
|
-
config = nil
|
68
|
-
benchmark(:notice, "Compiled configuration for %s" % client) do
|
69
|
-
config = config_handler.configuration(client)
|
70
|
-
end
|
71
|
-
|
72
|
-
return translate(config.extract)
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
# Manipulate the client name as appropriate.
|
78
|
-
def clientname(name, ip, facts)
|
79
|
-
# Always use the hostname from Facter.
|
80
|
-
client = facts["hostname"]
|
81
|
-
clientip = facts["ipaddress"]
|
82
|
-
if Puppet[:node_name] == 'cert'
|
83
|
-
if name
|
84
|
-
client = name
|
85
|
-
facts["fqdn"] = client
|
86
|
-
facts["hostname"], facts["domain"] = client.split('.', 2)
|
87
|
-
end
|
88
|
-
if ip
|
89
|
-
clientip = ip
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
return client, clientip
|
94
|
-
end
|
65
|
+
catalog = Puppet::Node::Catalog.find(client)
|
95
66
|
|
96
|
-
|
97
|
-
|
98
|
-
|
67
|
+
case format
|
68
|
+
when "yaml":
|
69
|
+
return CGI.escape(catalog.extract.to_yaml(:UseBlock => true))
|
70
|
+
when "marshal":
|
71
|
+
return CGI.escape(Marshal.dump(catalog.extract))
|
72
|
+
else
|
73
|
+
raise "Invalid markup format '%s'" % format
|
99
74
|
end
|
100
|
-
@config_handler
|
101
75
|
end
|
102
76
|
|
103
77
|
#
|
@@ -123,11 +97,6 @@ class Puppet::Network::Handler
|
|
123
97
|
|
124
98
|
# Translate our configuration appropriately for sending back to a client.
|
125
99
|
def translate(config)
|
126
|
-
if local?
|
127
|
-
config
|
128
|
-
else
|
129
|
-
CGI.escape(config.to_yaml(:UseBlock => true))
|
130
|
-
end
|
131
100
|
end
|
132
101
|
end
|
133
102
|
end
|
data/lib/puppet/network/http.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
class Puppet::Network::HTTP
|
2
2
|
def self.server_class_by_type(kind)
|
3
|
-
|
4
|
-
|
3
|
+
case kind.to_sym
|
4
|
+
when :webrick:
|
5
|
+
require 'puppet/network/http/webrick'
|
6
|
+
return Puppet::Network::HTTP::WEBrick
|
7
|
+
when :mongrel:
|
5
8
|
raise ArgumentError, "Mongrel is not installed on this platform" unless Puppet.features.mongrel?
|
9
|
+
require 'puppet/network/http/mongrel'
|
6
10
|
return Puppet::Network::HTTP::Mongrel
|
11
|
+
else
|
12
|
+
raise ArgumentError, "Unknown HTTP server name [#{kind}]"
|
7
13
|
end
|
8
|
-
raise ArgumentError, "Unknown HTTP server name [#{kind}]"
|
9
14
|
end
|
10
15
|
end
|
11
|
-
|
12
|
-
require 'puppet/network/http/webrick'
|
13
|
-
require 'puppet/network/http/mongrel'
|