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
@@ -63,14 +63,20 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
|
|
63
63
|
case test
|
64
64
|
when :exists:
|
65
65
|
details += " - Missing files %s\n" % values.join(", ")
|
66
|
-
when :
|
66
|
+
when :variable:
|
67
67
|
values.each do |name, facts|
|
68
|
-
|
68
|
+
if Puppet.settings.valid?(name)
|
69
|
+
details += " - Setting %s (currently %s) not in list %s\n" % [name, Puppet.settings.value(name).inspect, facts.join(", ")]
|
70
|
+
else
|
71
|
+
details += " - Fact %s (currently %s) not in list %s\n" % [name, Facter.value(name).inspect, facts.join(", ")]
|
72
|
+
end
|
69
73
|
end
|
70
74
|
when :true:
|
71
75
|
details += " - Got %s true tests that should have been false\n" % values
|
72
76
|
when :false:
|
73
77
|
details += " - Got %s false tests that should have been true\n" % values
|
78
|
+
when :feature:
|
79
|
+
details += " - Missing features %s\n" % values.collect { |f| f.to_s }.join(",")
|
74
80
|
end
|
75
81
|
end
|
76
82
|
notes << details
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'puppet/reports'
|
2
|
+
|
3
|
+
report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do
|
4
|
+
Puppet::Reports.reportdocs
|
5
|
+
end
|
6
|
+
|
7
|
+
report.header = "
|
8
|
+
Puppet clients can report back to the server after each transaction. This
|
9
|
+
transaction report is sent as a YAML dump of the
|
10
|
+
``Puppet::Transaction::Report`` class and includes every log message that was
|
11
|
+
generated during the transaction along with as many metrics as Puppet knows how
|
12
|
+
to collect. See `ReportsAndReporting Reports and Reporting`:trac:
|
13
|
+
for more information on how to use reports.
|
14
|
+
|
15
|
+
Currently, clients default to not sending in reports; you can enable reporting
|
16
|
+
by setting the ``report`` parameter to true.
|
17
|
+
|
18
|
+
To use a report, set the ``reports`` parameter on the server; multiple
|
19
|
+
reports must be comma-separated. You can also specify ``none`` to disable
|
20
|
+
reports entirely.
|
21
|
+
|
22
|
+
Puppet provides multiple report handlers that will process client reports:
|
23
|
+
"
|
@@ -1,8 +1,10 @@
|
|
1
1
|
Puppet::Reports.register_report(:rrdgraph) do
|
2
2
|
desc "Graph all available data about hosts using the RRD library. You
|
3
3
|
must have the Ruby RRDtool library installed to use this report, which
|
4
|
-
you can get from `the RubyRRDTool RubyForge page`_. This package
|
5
|
-
|
4
|
+
you can get from `the RubyRRDTool RubyForge page`_. This package may also
|
5
|
+
be available as ``ruby-rrd`` or ``rrdtool-ruby`` in your distribution's package
|
6
|
+
management system. The library and/or package will both require the binary
|
7
|
+
``rrdtool`` package from your distribution to be installed.
|
6
8
|
|
7
9
|
.. _the RubyRRDTool RubyForge page: http://rubyforge.org/projects/rubyrrdtool/
|
8
10
|
|
@@ -97,7 +97,7 @@ class Puppet::SSLCertificates::CA
|
|
97
97
|
if @config[:capass] and File.readable?(@config[:capass])
|
98
98
|
return File.read(@config[:capass])
|
99
99
|
else
|
100
|
-
raise Puppet::Error, "Could not
|
100
|
+
raise Puppet::Error, "Could not decrypt CA key with password: %s" % detail
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -379,9 +379,14 @@ class Puppet::SSLCertificates::CA
|
|
379
379
|
def sign_with_key(signable, digest = OpenSSL::Digest::SHA1.new)
|
380
380
|
cakey = nil
|
381
381
|
if @config[:password]
|
382
|
-
|
383
|
-
|
384
|
-
|
382
|
+
begin
|
383
|
+
cakey = OpenSSL::PKey::RSA.new(
|
384
|
+
File.read(@config[:cakey]), @config[:password]
|
385
|
+
)
|
386
|
+
rescue
|
387
|
+
raise Puppet::Error,
|
388
|
+
"Decrypt of CA private key with password stored in @config[:capass] not possible"
|
389
|
+
end
|
385
390
|
else
|
386
391
|
cakey = OpenSSL::PKey::RSA.new(
|
387
392
|
File.read(@config[:cakey])
|
@@ -28,7 +28,8 @@ module Puppet::SSLCertificates::Support
|
|
28
28
|
|
29
29
|
# Define the reading method.
|
30
30
|
define_method(reader) do
|
31
|
-
return nil unless FileTest.exists?(Puppet[param])
|
31
|
+
return nil unless FileTest.exists?(Puppet[param]) or rename_files_with_uppercase(Puppet[param])
|
32
|
+
|
32
33
|
begin
|
33
34
|
instance_variable_set(var, klass.new(File.read(Puppet[param])))
|
34
35
|
rescue => detail
|
@@ -121,5 +122,28 @@ module Puppet::SSLCertificates::Support
|
|
121
122
|
end
|
122
123
|
return retrieved
|
123
124
|
end
|
124
|
-
end
|
125
125
|
|
126
|
+
# A hack method to deal with files that exist with a different case.
|
127
|
+
# Just renames it; doesn't read it in or anything.
|
128
|
+
def rename_files_with_uppercase(file)
|
129
|
+
dir = File.dirname(file)
|
130
|
+
short = File.basename(file)
|
131
|
+
|
132
|
+
# If the dir isn't present, we clearly don't have the file.
|
133
|
+
#return nil unless FileTest.directory?(dir)
|
134
|
+
|
135
|
+
raise ArgumentError, "Tried to fix SSL files to a file containing uppercase" unless short.downcase == short
|
136
|
+
real_file = Dir.entries(dir).reject { |f| f =~ /^\./ }.find do |other|
|
137
|
+
other.downcase == short
|
138
|
+
end
|
139
|
+
|
140
|
+
return nil unless real_file
|
141
|
+
|
142
|
+
full_file = File.join(dir, real_file)
|
143
|
+
|
144
|
+
Puppet.notice "Fixing case in %s; renaming to %s" % [full_file, file]
|
145
|
+
File.rename(full_file, file)
|
146
|
+
|
147
|
+
return true
|
148
|
+
end
|
149
|
+
end
|
data/lib/puppet/transaction.rb
CHANGED
@@ -2,10 +2,12 @@
|
|
2
2
|
# and performs them
|
3
3
|
|
4
4
|
require 'puppet'
|
5
|
-
require 'puppet/propertychange'
|
6
5
|
|
7
6
|
module Puppet
|
8
7
|
class Transaction
|
8
|
+
require 'puppet/transaction/change'
|
9
|
+
require 'puppet/transaction/event'
|
10
|
+
|
9
11
|
attr_accessor :component, :catalog, :ignoreschedules
|
10
12
|
attr_accessor :sorted_resources, :configurator
|
11
13
|
|
@@ -96,7 +98,7 @@ class Transaction
|
|
96
98
|
# Create an edge with this resource as both the source and
|
97
99
|
# target. The triggering method treats these specially for
|
98
100
|
# logging.
|
99
|
-
events = resourceevents.collect { |e| e.
|
101
|
+
events = resourceevents.collect { |e| e.name }
|
100
102
|
set_trigger(Puppet::Relationship.new(resource, resource, :callback => :refresh, :event => events))
|
101
103
|
end
|
102
104
|
end
|
@@ -109,7 +111,6 @@ class Transaction
|
|
109
111
|
changes.collect { |change|
|
110
112
|
@changes << change
|
111
113
|
@count += 1
|
112
|
-
change.transaction = self
|
113
114
|
events = nil
|
114
115
|
begin
|
115
116
|
# use an array, so that changes can return more than one
|
@@ -278,7 +279,7 @@ class Transaction
|
|
278
279
|
# of course, bad.
|
279
280
|
edge = orig_edge.class.new(orig_edge.source, orig_edge.target)
|
280
281
|
label = orig_edge.label.dup
|
281
|
-
label[:event] = events.collect { |e| e.
|
282
|
+
label[:event] = events.collect { |e| e.name }
|
282
283
|
edge.label = label
|
283
284
|
set_trigger(edge)
|
284
285
|
end
|
@@ -499,10 +500,12 @@ class Transaction
|
|
499
500
|
|
500
501
|
# Prepare to evaluate the resources in a transaction.
|
501
502
|
def prepare
|
502
|
-
prefetch()
|
503
|
-
|
504
503
|
# Now add any dynamically generated resources
|
505
504
|
generate()
|
505
|
+
|
506
|
+
# Then prefetch. It's important that we generate and then prefetch,
|
507
|
+
# so that any generated resources also get prefetched.
|
508
|
+
prefetch()
|
506
509
|
|
507
510
|
# This will throw an error if there are cycles in the graph.
|
508
511
|
@sorted_resources = relationship_graph.topsort
|
@@ -678,11 +681,7 @@ class Transaction
|
|
678
681
|
[callback, subs.length]
|
679
682
|
|
680
683
|
# And then add an event for it.
|
681
|
-
return [Puppet::Event.new(
|
682
|
-
:event => :noop,
|
683
|
-
:transaction => self,
|
684
|
-
:source => resource
|
685
|
-
)]
|
684
|
+
return [Puppet::Transaction::Event.new(:noop, resource)]
|
686
685
|
end
|
687
686
|
|
688
687
|
if subs.length == 1 and subs[0].source == resource
|
@@ -710,11 +709,7 @@ class Transaction
|
|
710
709
|
end
|
711
710
|
|
712
711
|
# And then add an event for it.
|
713
|
-
trigged << Puppet::Event.new(
|
714
|
-
:event => :triggered,
|
715
|
-
:transaction => self,
|
716
|
-
:source => resource
|
717
|
-
)
|
712
|
+
trigged << Puppet::Transaction::Event.new(:triggered, resource)
|
718
713
|
|
719
714
|
triggered(resource, callback)
|
720
715
|
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'puppet/transaction'
|
2
|
+
require 'puppet/transaction/event'
|
3
|
+
|
4
|
+
# Handle all of the work around performing an actual change,
|
5
|
+
# including calling 'sync' on the properties and producing events.
|
6
|
+
class Puppet::Transaction::Change
|
7
|
+
attr_accessor :is, :should, :path, :property, :changed, :proxy
|
8
|
+
|
9
|
+
# Switch the goals of the property, thus running the change in reverse.
|
10
|
+
def backward
|
11
|
+
@is, @should = @should, @is
|
12
|
+
@property.should = @should
|
13
|
+
|
14
|
+
@property.info "Reversing %s" % self
|
15
|
+
return self.go
|
16
|
+
end
|
17
|
+
|
18
|
+
def changed?
|
19
|
+
self.changed
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create our event object.
|
23
|
+
def event(name)
|
24
|
+
# default to a simple event type
|
25
|
+
unless name.is_a?(Symbol)
|
26
|
+
@property.warning("Property '%s' returned invalid event '%s'; resetting to default" %
|
27
|
+
[@property.class, name])
|
28
|
+
|
29
|
+
name = @property.event(should)
|
30
|
+
end
|
31
|
+
|
32
|
+
Puppet::Transaction::Event.new(name, self.resource)
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(property, currentvalue)
|
36
|
+
@property = property
|
37
|
+
@path = [property.path,"change"].flatten
|
38
|
+
@is = currentvalue
|
39
|
+
|
40
|
+
@should = property.should
|
41
|
+
|
42
|
+
@changed = false
|
43
|
+
end
|
44
|
+
|
45
|
+
# Perform the actual change. This method can go either forward or
|
46
|
+
# backward, and produces an event.
|
47
|
+
def go
|
48
|
+
if self.noop?
|
49
|
+
@property.log "is %s, should be %s (noop)" % [property.is_to_s(@is), property.should_to_s(@should)]
|
50
|
+
return [event(:noop)]
|
51
|
+
end
|
52
|
+
|
53
|
+
# The transaction catches any exceptions here.
|
54
|
+
events = @property.sync
|
55
|
+
if events.nil?
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
|
59
|
+
if events.is_a?(Array)
|
60
|
+
if events.empty?
|
61
|
+
return nil
|
62
|
+
end
|
63
|
+
else
|
64
|
+
events = [events]
|
65
|
+
end
|
66
|
+
|
67
|
+
return events.collect { |name|
|
68
|
+
@report = @property.log(@property.change_to_s(@is, @should))
|
69
|
+
event(name)
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def forward
|
74
|
+
return self.go
|
75
|
+
end
|
76
|
+
|
77
|
+
# Is our property noop? This is used for generating special events.
|
78
|
+
def noop?
|
79
|
+
return @property.noop
|
80
|
+
end
|
81
|
+
|
82
|
+
# The resource that generated this change. This is used for handling events,
|
83
|
+
# and the proxy resource is used for generated resources, since we can't
|
84
|
+
# send an event to a resource we don't have a direct relationship. If we
|
85
|
+
# have a proxy resource, then the events will be considered to be from
|
86
|
+
# that resource, rather than us, so the graph resolution will still work.
|
87
|
+
def resource
|
88
|
+
self.proxy || @property.resource
|
89
|
+
end
|
90
|
+
|
91
|
+
def to_s
|
92
|
+
return "change %s" % @property.change_to_s(@is, @should)
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/util/methodhelper'
|
3
|
+
require 'puppet/util/errors'
|
4
|
+
|
5
|
+
# events are transient packets of information; they result in one or more (or none)
|
6
|
+
# subscriptions getting triggered, and then they get cleared
|
7
|
+
# eventually, these will be passed on to some central event system
|
8
|
+
class Puppet::Transaction::Event
|
9
|
+
include Puppet::Util::MethodHelper
|
10
|
+
include Puppet::Util::Errors
|
11
|
+
|
12
|
+
attr_reader :name, :source
|
13
|
+
|
14
|
+
def initialize(name, source)
|
15
|
+
@name, @source = name, source
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
source.to_s + " -> " + name.to_s
|
20
|
+
end
|
21
|
+
end
|
data/lib/puppet/type.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'puppet'
|
2
2
|
require 'puppet/util/log'
|
3
|
-
require 'puppet/event'
|
4
3
|
require 'puppet/util/metric'
|
5
4
|
require 'puppet/property'
|
6
5
|
require 'puppet/parameter'
|
@@ -415,7 +414,6 @@ class Type
|
|
415
414
|
end # Puppet::Type
|
416
415
|
end
|
417
416
|
|
418
|
-
require 'puppet/propertychange'
|
419
417
|
require 'puppet/provider'
|
420
418
|
|
421
419
|
# Always load these types.
|
@@ -138,11 +138,6 @@ module Puppet
|
|
138
138
|
# We have to treat :present specially, because it works with any
|
139
139
|
# type of file.
|
140
140
|
def insync?(currentvalue)
|
141
|
-
if property = @resource.property(:source) and ! property.described?
|
142
|
-
warning "No specified sources exist"
|
143
|
-
return true
|
144
|
-
end
|
145
|
-
|
146
141
|
if self.should == :present
|
147
142
|
if currentvalue.nil? or currentvalue == :absent
|
148
143
|
return false
|
@@ -11,12 +11,8 @@ module Puppet
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def id2name(id)
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
if id.is_a?(Symbol)
|
18
|
-
return id.to_s
|
19
|
-
end
|
14
|
+
return id.to_s if id.is_a?(Symbol)
|
15
|
+
return nil if id > Puppet[:maximum_uid].to_i
|
20
16
|
begin
|
21
17
|
group = Etc.getgrgid(id)
|
22
18
|
rescue ArgumentError
|
@@ -73,7 +69,17 @@ module Puppet
|
|
73
69
|
@method = :chown
|
74
70
|
end
|
75
71
|
|
76
|
-
|
72
|
+
currentvalue = stat.gid
|
73
|
+
|
74
|
+
# On OS X, files that are owned by -2 get returned as really
|
75
|
+
# large GIDs instead of negative ones. This isn't a Ruby bug,
|
76
|
+
# it's an OS X bug, since it shows up in perl, too.
|
77
|
+
if currentvalue > Puppet[:maximum_uid].to_i
|
78
|
+
self.warning "Apparently using negative GID (%s) on a platform that does not consistently handle them" % currentvalue
|
79
|
+
currentvalue = :silly
|
80
|
+
end
|
81
|
+
|
82
|
+
return currentvalue
|
77
83
|
end
|
78
84
|
|
79
85
|
# Determine if the group is valid, and if so, return the GID
|
@@ -101,8 +101,7 @@ module Puppet
|
|
101
101
|
begin
|
102
102
|
desc = server.describe(path, @resource[:links])
|
103
103
|
rescue Puppet::Network::XMLRPCClientError => detail
|
104
|
-
|
105
|
-
return nil
|
104
|
+
fail detail, "Could not describe %s: %s" % [path, detail]
|
106
105
|
end
|
107
106
|
|
108
107
|
return nil if desc == ""
|
@@ -135,18 +134,8 @@ module Puppet
|
|
135
134
|
return args
|
136
135
|
end
|
137
136
|
|
138
|
-
# Have we successfully described the remote source?
|
139
|
-
def described?
|
140
|
-
! @stats.nil? and ! @stats[:type].nil? #and @is != :notdescribed
|
141
|
-
end
|
142
|
-
|
143
137
|
# Use the info we get from describe() to check if we're in sync.
|
144
138
|
def insync?(currentvalue)
|
145
|
-
unless described?
|
146
|
-
warning "No specified sources exist"
|
147
|
-
return true
|
148
|
-
end
|
149
|
-
|
150
139
|
if currentvalue == :nocopy
|
151
140
|
return true
|
152
141
|
end
|
@@ -180,7 +169,11 @@ module Puppet
|
|
180
169
|
def pinparams
|
181
170
|
[:mode, :type, :owner, :group]
|
182
171
|
end
|
183
|
-
|
172
|
+
|
173
|
+
def found?
|
174
|
+
! (@stats.nil? or @stats[:type].nil?)
|
175
|
+
end
|
176
|
+
|
184
177
|
# This basically calls describe() on our file, and then sets all
|
185
178
|
# of the local states appropriately. If the remote file is a normal
|
186
179
|
# file then we set it to copy; if it's a directory, then we just mark
|
@@ -202,8 +195,8 @@ module Puppet
|
|
202
195
|
}
|
203
196
|
end
|
204
197
|
|
205
|
-
if
|
206
|
-
|
198
|
+
if !found?
|
199
|
+
raise Puppet::Error, "No specified source was found from" + @should.inject("") { |s, source| s + " #{source},"}.gsub(/,$/,"")
|
207
200
|
end
|
208
201
|
|
209
202
|
case @stats[:type]
|