puppet 2.7.19 → 2.7.20.rc1
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/CONTRIBUTING.md +61 -238
- data/Gemfile +32 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +1 -1
- data/README_DEVELOPER.md +300 -5
- data/Rakefile +41 -37
- data/ext/build_defaults.yaml +20 -0
- data/ext/debian/README.Debian +8 -0
- data/ext/debian/README.source +2 -0
- data/ext/debian/TODO.Debian +1 -0
- data/ext/debian/changelog.erb +1104 -0
- data/ext/debian/compat +1 -0
- data/ext/debian/control +142 -0
- data/ext/debian/copyright +361 -0
- data/ext/debian/docs +1 -0
- data/ext/debian/fileserver.conf +17 -0
- data/ext/debian/puppet-common.dirs +8 -0
- data/ext/debian/puppet-common.install +3 -0
- data/ext/debian/puppet-common.lintian-overrides +7 -0
- data/ext/debian/puppet-common.manpages +2 -0
- data/ext/debian/puppet-common.postinst +35 -0
- data/ext/debian/puppet-common.postrm +32 -0
- data/ext/debian/puppet-el.dirs +1 -0
- data/ext/debian/puppet-el.emacsen-install +25 -0
- data/ext/debian/puppet-el.emacsen-remove +11 -0
- data/ext/debian/puppet-el.emacsen-startup +9 -0
- data/ext/debian/puppet-el.install +1 -0
- data/ext/debian/puppet-testsuite.install +3 -0
- data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
- data/ext/debian/puppet.NEWS +86 -0
- data/ext/debian/puppet.conf +14 -0
- data/ext/debian/puppet.default +7 -0
- data/ext/debian/puppet.dirs +1 -0
- data/ext/debian/puppet.init +118 -0
- data/ext/debian/puppet.install +4 -0
- data/ext/debian/puppet.lintian-overrides +3 -0
- data/ext/debian/puppet.logrotate +11 -0
- data/ext/debian/puppet.manpages +36 -0
- data/ext/debian/puppet.postinst +20 -0
- data/ext/debian/puppet.postrm +20 -0
- data/ext/debian/puppet.preinst +20 -0
- data/ext/debian/puppetmaster-common.install +5 -0
- data/ext/debian/puppetmaster-common.manpages +5 -0
- data/ext/debian/puppetmaster-common.puppetqd.default +27 -0
- data/ext/debian/puppetmaster-common.puppetqd.init +84 -0
- data/ext/debian/puppetmaster-passenger.dirs +4 -0
- data/ext/debian/puppetmaster-passenger.postinst +66 -0
- data/ext/debian/puppetmaster-passenger.postrm +33 -0
- data/ext/debian/puppetmaster.NEWS +13 -0
- data/ext/debian/puppetmaster.README.debian +16 -0
- data/ext/debian/puppetmaster.default +38 -0
- data/ext/debian/puppetmaster.dirs +1 -0
- data/ext/debian/puppetmaster.init +158 -0
- data/ext/debian/puppetmaster.install +1 -0
- data/ext/debian/puppetmaster.lintian-overrides +3 -0
- data/ext/debian/puppetmaster.manpages +1 -0
- data/ext/debian/puppetmaster.postinst +20 -0
- data/ext/debian/puppetmaster.postrm +5 -0
- data/ext/debian/puppetmaster.preinst +22 -0
- data/ext/debian/rules +127 -0
- data/ext/debian/source/format +1 -0
- data/ext/debian/source/options +1 -0
- data/ext/debian/vim-puppet.README.Debian +13 -0
- data/ext/debian/vim-puppet.dirs +3 -0
- data/ext/debian/vim-puppet.yaml +5 -0
- data/ext/debian/watch +2 -0
- data/ext/emacs/puppet-mode.el +1 -0
- data/{conf → ext}/osx/PackageInfo.plist +0 -0
- data/{conf → ext}/osx/createpackage.sh +0 -0
- data/ext/osx/file_mapping.yaml +38 -0
- data/ext/osx/preflight.erb +37 -0
- data/{tasks/rake/templates → ext/osx}/prototype.plist.erb +0 -0
- data/ext/packaging/README-Solaris.md +117 -0
- data/ext/packaging/README.md +255 -0
- data/ext/packaging/spec/spec_helper.rb +12 -0
- data/ext/packaging/spec/tasks/00_utils_spec.rb +66 -0
- data/ext/packaging/tasks/00_utils.rake +382 -0
- data/ext/packaging/tasks/10_setupvars.rake +71 -0
- data/ext/packaging/tasks/20_setupextravars.rake +25 -0
- data/ext/packaging/tasks/apple.rake +201 -0
- data/ext/packaging/tasks/clean.rake +5 -0
- data/ext/packaging/tasks/deb.rake +108 -0
- data/ext/packaging/tasks/doc.rake +20 -0
- data/ext/packaging/tasks/fetch.rake +18 -0
- data/ext/packaging/tasks/gem.rake +68 -0
- data/ext/packaging/tasks/ips.rake +80 -0
- data/ext/packaging/tasks/mock.rake +126 -0
- data/ext/packaging/tasks/pe_deb.rake +9 -0
- data/ext/packaging/tasks/pe_remote.rake +45 -0
- data/ext/packaging/tasks/pe_rpm.rake +21 -0
- data/ext/packaging/tasks/pe_ship.rake +30 -0
- data/ext/packaging/tasks/pe_sign.rake +27 -0
- data/ext/packaging/tasks/pe_sles.rake +96 -0
- data/ext/packaging/tasks/release.rake +73 -0
- data/ext/packaging/tasks/remote_build.rake +78 -0
- data/ext/packaging/tasks/rpm.rake +52 -0
- data/ext/packaging/tasks/ship.rake +78 -0
- data/ext/packaging/tasks/sign.rake +82 -0
- data/ext/packaging/tasks/tag.rake +8 -0
- data/ext/packaging/tasks/tar.rake +68 -0
- data/ext/packaging/tasks/template.rake +13 -0
- data/ext/packaging/tasks/update.rake +16 -0
- data/ext/packaging/tasks/version.rake +21 -0
- data/ext/project_data.yaml +24 -0
- data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +18 -10
- data/install.rb +8 -8
- data/lib/puppet.rb +2 -6
- data/lib/puppet/agent/locker.rb +2 -0
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +1 -1
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/cert.rb +5 -6
- data/lib/puppet/application/describe.rb +1 -1
- data/lib/puppet/application/device.rb +1 -1
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/kick.rb +1 -1
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/defaults.rb +21 -3
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/face/help/global.erb +1 -1
- data/lib/puppet/face/module/install.rb +1 -1
- data/lib/puppet/face/module/list.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/node/clean.rb +23 -18
- data/lib/puppet/face/parser.rb +11 -2
- data/lib/puppet/file_collection.rb +16 -27
- data/lib/puppet/file_collection/lookup.rb +6 -16
- data/lib/puppet/file_serving/base.rb +4 -4
- data/lib/puppet/indirector/catalog/static_compiler.rb +3 -4
- data/lib/puppet/indirector/certificate/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/certificate_request/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/face.rb +2 -2
- data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/node/exec.rb +13 -1
- data/lib/puppet/indirector/request.rb +4 -0
- data/lib/puppet/metatype/manager.rb +17 -10
- data/lib/puppet/network/authstore.rb +1 -1
- data/lib/puppet/network/rights.rb +1 -2
- data/lib/puppet/node/environment.rb +1 -0
- data/lib/puppet/parameter/value.rb +9 -3
- data/lib/puppet/parser/ast.rb +1 -4
- data/lib/puppet/parser/files.rb +1 -1
- data/lib/puppet/parser/functions.rb +68 -22
- data/lib/puppet/parser/functions/create_resources.rb +2 -3
- data/lib/puppet/parser/functions/shellquote.rb +21 -25
- data/lib/puppet/parser/lexer.rb +40 -6
- data/lib/puppet/parser/relationship.rb +3 -1
- data/lib/puppet/parser/resource.rb +2 -3
- data/lib/puppet/parser/resource/param.rb +3 -5
- data/lib/puppet/parser/scope.rb +7 -4
- data/lib/puppet/property.rb +5 -3
- data/lib/puppet/provider.rb +5 -5
- data/lib/puppet/provider/aixobject.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/file/windows.rb +10 -29
- data/lib/puppet/provider/group/groupadd.rb +2 -3
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +1 -1
- data/lib/puppet/provider/ldap.rb +5 -1
- data/lib/puppet/provider/nameservice.rb +3 -3
- data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
- data/lib/puppet/provider/package/gem.rb +6 -2
- data/lib/puppet/provider/package/portage.rb +4 -2
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
- data/lib/puppet/provider/service/base.rb +2 -41
- data/lib/puppet/provider/service/daemontools.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/redhat.rb +6 -5
- data/lib/puppet/provider/service/runit.rb +1 -1
- data/lib/puppet/provider/service/service.rb +43 -0
- data/lib/puppet/provider/service/windows.rb +1 -8
- data/lib/puppet/provider/user/user_role_add.rb +2 -1
- data/lib/puppet/provider/user/useradd.rb +8 -3
- data/lib/puppet/provider/user/windows_adsi.rb +12 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -1
- data/lib/puppet/rails/inventory_node.rb +26 -13
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +20 -5
- data/lib/puppet/resource/status.rb +1 -1
- data/lib/puppet/ssl/certificate_authority.rb +2 -0
- data/lib/puppet/ssl/host.rb +31 -6
- data/lib/puppet/test/test_helper.rb +3 -1
- data/lib/puppet/transaction/event.rb +1 -1
- data/lib/puppet/transaction/report.rb +2 -2
- data/lib/puppet/type.rb +30 -25
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/cron.rb +2 -2
- data/lib/puppet/type/exec.rb +6 -6
- data/lib/puppet/type/file.rb +5 -15
- data/lib/puppet/type/file/content.rb +1 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +1 -1
- data/lib/puppet/type/file/selcontext.rb +6 -2
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/package.rb +1 -1
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/scheduled_task.rb +1 -1
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/whit.rb +16 -9
- data/lib/puppet/util.rb +27 -11
- data/lib/puppet/util/adsi.rb +25 -23
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/feature.rb +3 -1
- data/lib/puppet/util/fileparsing.rb +9 -9
- data/lib/puppet/util/filetype.rb +55 -40
- data/lib/puppet/util/instance_loader.rb +5 -5
- data/lib/puppet/util/instrumentation.rb +3 -5
- data/lib/puppet/util/log_paths.rb +1 -3
- data/lib/puppet/util/monkey_patches.rb +34 -8
- data/lib/puppet/util/platform.rb +7 -0
- data/lib/puppet/util/posix.rb +3 -3
- data/lib/puppet/util/provider_features.rb +2 -3
- data/lib/puppet/util/rdoc.rb +4 -3
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/selinux.rb +31 -36
- data/lib/puppet/util/tagging.rb +28 -6
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/error.rb +1 -1
- data/lib/puppet/util/windows/process.rb +3 -3
- data/lib/puppet/util/windows/security.rb +9 -46
- data/lib/puppet/util/windows/sid.rb +96 -0
- data/lib/puppet/util/windows/user.rb +65 -2
- data/lib/puppet/util/zaml.rb +109 -59
- data/lib/puppet/version.rb +18 -0
- data/spec/fixtures/unit/util/filetype/aixtab_output +44 -0
- data/spec/fixtures/unit/util/filetype/suntab_output +9 -0
- data/spec/integration/defaults_spec.rb +26 -7
- data/spec/integration/parser/functions_spec.rb +0 -4
- data/spec/integration/util/file_locking_spec.rb +1 -1
- data/spec/integration/util/windows/security_spec.rb +3 -23
- data/spec/lib/puppet_spec/files.rb +3 -3
- data/spec/shared_contexts/platform.rb +8 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/unit/application/queue_spec.rb +2 -1
- data/spec/unit/configurer_spec.rb +1 -1
- data/spec/unit/face/{instrumentation_data.rb → instrumentation_data_spec.rb} +0 -0
- data/spec/unit/face/{instrumentation_listener.rb → instrumentation_listener_spec.rb} +0 -0
- data/spec/unit/face/{instrumentation_probe.rb → instrumentation_probe_spec.rb} +0 -0
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +194 -0
- data/spec/unit/indirector/certificate/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/key/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/request_spec.rb +22 -0
- data/spec/unit/network/http/webrick_spec.rb +0 -7
- data/spec/unit/node/environment_spec.rb +8 -8
- data/spec/unit/parser/ast_spec.rb +0 -5
- data/spec/unit/parser/collector_spec.rb +1 -0
- data/spec/unit/parser/files_spec.rb +2 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +3 -4
- data/spec/unit/parser/functions/require_spec.rb +0 -6
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -5
- data/spec/unit/parser/functions/template_spec.rb +6 -1
- data/spec/unit/parser/functions_spec.rb +73 -23
- data/spec/unit/parser/lexer_spec.rb +133 -8
- data/spec/unit/parser/relationship_spec.rb +24 -0
- data/spec/unit/parser/resource_spec.rb +0 -4
- data/spec/unit/parser/scope_spec.rb +2 -2
- data/spec/unit/property_spec.rb +21 -1
- data/spec/unit/provider/exec/posix_spec.rb +7 -6
- data/spec/unit/provider/file/windows_spec.rb +29 -29
- data/spec/unit/provider/group/groupadd_spec.rb +36 -30
- data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
- data/spec/unit/provider/package/gem_spec.rb +12 -0
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +14 -11
- data/spec/unit/provider/service/redhat_spec.rb +11 -1
- data/spec/unit/provider/service/windows_spec.rb +19 -0
- data/spec/unit/provider/user/ldap_spec.rb +22 -8
- data/spec/unit/provider/user/user_role_add_spec.rb +12 -0
- data/spec/unit/provider/user/useradd_spec.rb +146 -118
- data/spec/unit/provider/user/windows_adsi_spec.rb +24 -2
- data/spec/unit/puppet_spec.rb +10 -0
- data/spec/unit/resource/status_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +73 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +25 -1
- data/spec/unit/ssl/host_spec.rb +73 -27
- data/spec/unit/ssl/key_spec.rb +0 -4
- data/spec/unit/transaction/event_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/type/file/content_spec.rb +6 -4
- data/spec/unit/type/file/{ctime.rb → ctime_spec.rb} +0 -0
- data/spec/unit/type/file/{mtime.rb → mtime_spec.rb} +0 -0
- data/spec/unit/type/file/{type.rb → type_spec.rb} +0 -0
- data/spec/unit/type/file_spec.rb +2 -12
- data/spec/unit/type/host_spec.rb +14 -5
- data/spec/unit/type/mount_spec.rb +8 -0
- data/spec/unit/type/scheduled_task_spec.rb +2 -2
- data/spec/unit/util/adsi_spec.rb +23 -8
- data/spec/unit/util/command_line_spec.rb +11 -2
- data/spec/unit/util/feature_spec.rb +12 -1
- data/spec/unit/util/filetype_spec.rb +161 -55
- data/spec/unit/util/log_spec.rb +1 -1
- data/spec/unit/util/monkey_patches_spec.rb +7 -0
- data/spec/unit/util/rdoc_spec.rb +8 -2
- data/spec/unit/util/selinux_spec.rb +24 -32
- data/spec/unit/util/windows/sid_spec.rb +100 -0
- data/spec/unit/util/zaml_spec.rb +165 -25
- data/spec/unit/util_spec.rb +3 -9
- data/spec/watchr.rb +2 -6
- data/tasks/rake/gem.rake +4 -2
- data/tasks/rake/sign.rake +1 -1
- data/test/language/parser.rb +1 -0
- data/test/language/scope.rb +0 -5
- data/test/language/snippets.rb +1 -2
- data/test/lib/puppettest.rb +16 -27
- data/test/lib/puppettest/parsertesting.rb +0 -1
- data/test/network/authstore.rb +2 -4
- data/test/puppet/defaults.rb +0 -4
- data/test/util/fileparsing.rb +2 -6
- metadata +1706 -1617
- data/conf/osx/preflight +0 -24
- data/spec/spec.opts +0 -4
- data/spec/unit/file_collection/lookup_spec.rb +0 -45
- data/spec/unit/file_collection_spec.rb +0 -52
- data/tasks/rake/apple.rake +0 -176
- data/test/puppet/errortest.rb +0 -19
@@ -1,27 +1,32 @@
|
|
1
1
|
Puppet::Face.define(:node, '0.0.1') do
|
2
2
|
action(:clean) do
|
3
3
|
option "--[no-]unexport" do
|
4
|
-
summary "
|
4
|
+
summary "Whether to remove this node's exported resources from other nodes"
|
5
5
|
end
|
6
6
|
|
7
|
-
summary "Clean up everything a puppetmaster knows about a node"
|
7
|
+
summary "Clean up everything a puppetmaster knows about a node."
|
8
8
|
arguments "<host1> [<host2> ...]"
|
9
|
-
description <<-EOT
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
9
|
+
description <<-'EOT'
|
10
|
+
Clean up everything a puppet master knows about a node, including certificates
|
11
|
+
and storeconfigs data.
|
12
|
+
|
13
|
+
The full list of info cleaned by this action is:
|
14
|
+
|
15
|
+
<Signed certificates> - ($vardir/ssl/ca/signed/node.domain.pem)
|
16
|
+
|
17
|
+
<Cached facts> - ($vardir/yaml/facts/node.domain.yaml)
|
18
|
+
|
19
|
+
<Cached node objects> - ($vardir/yaml/node/node.domain.yaml)
|
20
|
+
|
21
|
+
<Reports> - ($vardir/reports/node.domain)
|
22
|
+
|
23
|
+
<Stored configs> - (in database) The clean action can either remove all
|
24
|
+
data from a host in your storeconfigs database, or, with the
|
25
|
+
<--unexport> option, turn every exported resource supporting ensure to
|
26
|
+
absent so that any other host that collected those resources can remove
|
27
|
+
them. Without unexporting, a removed node's exported resources become
|
28
|
+
unmanaged by Puppet, and may linger as cruft unless you are purging
|
29
|
+
that resource type.
|
25
30
|
EOT
|
26
31
|
|
27
32
|
when_invoked do |*args|
|
data/lib/puppet/face/parser.rb
CHANGED
@@ -24,13 +24,22 @@ Puppet::Face.define(:parser, '0.0.1') do
|
|
24
24
|
Validate two arbitrary manifest files:
|
25
25
|
|
26
26
|
$ puppet parser validate init.pp vhost.pp
|
27
|
+
|
28
|
+
Validate from STDIN:
|
29
|
+
|
30
|
+
$ cat init.pp | puppet parser validate
|
27
31
|
EOT
|
28
32
|
when_invoked do |*args|
|
29
33
|
args.pop
|
30
34
|
files = args
|
31
35
|
if files.empty?
|
32
|
-
|
33
|
-
|
36
|
+
if not STDIN.tty?
|
37
|
+
Puppet[:code] = STDIN.read
|
38
|
+
Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types.clear
|
39
|
+
else
|
40
|
+
files << Puppet[:manifest]
|
41
|
+
Puppet.notice "No manifest specified. Validating the default manifest #{Puppet[:manifest]}"
|
42
|
+
end
|
34
43
|
end
|
35
44
|
files.each do |file|
|
36
45
|
Puppet[:manifest] = file
|
@@ -1,30 +1,19 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This was a simple way to turn file names into singletons,
|
2
|
+
#
|
3
|
+
# The theory was, like:
|
4
|
+
# 1. Turn filenames into singletons.
|
5
|
+
# 2. ????
|
6
|
+
# 3. Huge memory savings!
|
7
|
+
#
|
8
|
+
# In practice it used several MB more memory overall, and it cost more CPU
|
9
|
+
# time, and it added complexity to the code. Which was awesome.
|
10
|
+
#
|
11
|
+
# So, I gutted it. It doesn't do anything any more, but we retain the
|
12
|
+
# external form that people included so that they don't explode so much.
|
13
|
+
#
|
14
|
+
# This should be removed from the system after a graceful deprecation period,
|
15
|
+
# probably about the time that a version of Puppet containing this change is
|
16
|
+
# the last supported version. --daniel 2012-07-17
|
3
17
|
class Puppet::FileCollection
|
4
18
|
require 'puppet/file_collection/lookup'
|
5
|
-
|
6
|
-
def self.collection
|
7
|
-
@collection
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@paths = []
|
12
|
-
@inverse = {}
|
13
|
-
end
|
14
|
-
|
15
|
-
def index(path)
|
16
|
-
if i = @inverse[path]
|
17
|
-
return i
|
18
|
-
else
|
19
|
-
@paths << path
|
20
|
-
i = @inverse[path] = @paths.length - 1
|
21
|
-
return i
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def path(index)
|
26
|
-
@paths[index]
|
27
|
-
end
|
28
|
-
|
29
|
-
@collection = self.new
|
30
19
|
end
|
@@ -1,20 +1,10 @@
|
|
1
1
|
require 'puppet/file_collection'
|
2
2
|
|
3
|
-
# A simple module for looking up file paths and indexes
|
4
|
-
# in a file collection.
|
5
3
|
module Puppet::FileCollection::Lookup
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def file=(path)
|
13
|
-
@file_index = file_collection.index(path)
|
14
|
-
end
|
15
|
-
|
16
|
-
def file
|
17
|
-
return nil unless file_index
|
18
|
-
file_collection.path(file_index)
|
19
|
-
end
|
4
|
+
# Yeah, this is all the external interface that was added to the folks who
|
5
|
+
# included this really was. Thankfully.
|
6
|
+
#
|
7
|
+
# See the comments in `puppet/file_collection.rb` for the annotated version,
|
8
|
+
# or just port your code away from this by adding the accessors on your own.
|
9
|
+
attr_accessor :line, :file
|
20
10
|
end
|
@@ -19,10 +19,10 @@ class Puppet::FileServing::Base
|
|
19
19
|
# Return the full path to our file. Fails if there's no path set.
|
20
20
|
def full_path(dummy_argument=:work_arround_for_ruby_GC_bug)
|
21
21
|
(if relative_path.nil? or relative_path == "" or relative_path == "."
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
path
|
23
|
+
else
|
24
|
+
File.join(path, relative_path)
|
25
|
+
end).gsub(%r{//+}, "/")
|
26
26
|
end
|
27
27
|
|
28
28
|
def initialize(path, options = {})
|
@@ -113,9 +113,7 @@ class Puppet::Resource::Catalog::StaticCompiler < Puppet::Indirector::Code
|
|
113
113
|
|
114
114
|
def remove_existing_resources(children, catalog)
|
115
115
|
existing_names = catalog.resources.collect { |r| r.to_s }
|
116
|
-
|
117
116
|
both = (existing_names & children.keys).inject({}) { |hash, name| hash[name] = true; hash }
|
118
|
-
|
119
117
|
both.each { |name| children.delete(name) }
|
120
118
|
end
|
121
119
|
|
@@ -130,8 +128,9 @@ class Puppet::Resource::Catalog::StaticCompiler < Puppet::Indirector::Code
|
|
130
128
|
Puppet.info "Content for '#{resource[:source]}' already exists"
|
131
129
|
else
|
132
130
|
Puppet.info "Storing content for source '#{resource[:source]}'"
|
133
|
-
content = Puppet::FileServing::Content.find(resource[:source])
|
134
|
-
Puppet::FileBucket::File.new(content.content)
|
131
|
+
content = Puppet::FileServing::Content.indirection.find(resource[:source])
|
132
|
+
file = Puppet::FileBucket::File.new(content.content)
|
133
|
+
Puppet::FileBucket::File.indirection.save(file)
|
135
134
|
end
|
136
135
|
end
|
137
136
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'puppet/indirector/code'
|
2
|
+
require 'puppet/ssl/certificate'
|
3
|
+
|
4
|
+
class Puppet::SSL::Certificate::DisabledCa < Puppet::Indirector::Code
|
5
|
+
desc "Manage SSL certificates on disk, but reject any remote access
|
6
|
+
to the SSL data store. Used when a master has an explicitly disabled
|
7
|
+
CA to prevent clients getting confusing 'success' behaviour."
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@file = Puppet::SSL::Certificate.indirection.terminus(:file)
|
11
|
+
end
|
12
|
+
|
13
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
14
|
+
define_method(name) do |request|
|
15
|
+
if request.remote?
|
16
|
+
raise Puppet::Error, "this master is not a CA"
|
17
|
+
else
|
18
|
+
@file.send(name, request)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'puppet/indirector/code'
|
2
|
+
require 'puppet/ssl/certificate_request'
|
3
|
+
|
4
|
+
class Puppet::SSL::CertificateRequest::DisabledCa < Puppet::Indirector::Code
|
5
|
+
desc "Manage SSL certificate requests on disk, but reject any remote access
|
6
|
+
to the SSL data store. Used when a master has an explicitly disabled CA to
|
7
|
+
prevent clients getting confusing 'success' behaviour."
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@file = Puppet::SSL::CertificateRequest.indirection.terminus(:file)
|
11
|
+
end
|
12
|
+
|
13
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
14
|
+
define_method(name) do |request|
|
15
|
+
if request.remote?
|
16
|
+
raise Puppet::Error, "this master is not a CA"
|
17
|
+
else
|
18
|
+
@file.send(name, request)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'puppet/indirector/code'
|
2
|
+
require 'puppet/ssl/certificate_revocation_list'
|
3
|
+
|
4
|
+
class Puppet::SSL::CertificateRevocationList::DisabledCa < Puppet::Indirector::Code
|
5
|
+
desc "Manage SSL certificate revocation lists, but reject any remote access
|
6
|
+
to the SSL data store. Used when a master has an explicitly disabled CA to
|
7
|
+
prevent clients getting confusing 'success' behaviour."
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@file = Puppet::SSL::CertificateRevocationList.indirection.terminus(:file)
|
11
|
+
end
|
12
|
+
|
13
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
14
|
+
define_method(name) do |request|
|
15
|
+
if request.remote?
|
16
|
+
raise Puppet::Error, "this master is not a CA"
|
17
|
+
else
|
18
|
+
@file.send(name, request)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -50,11 +50,11 @@ class Puppet::Indirector::Face < Puppet::Face
|
|
50
50
|
|
51
51
|
option "--extra HASH" do
|
52
52
|
summary "Extra arguments to pass to the indirection request"
|
53
|
-
description <<-
|
53
|
+
description <<-EOT
|
54
54
|
A terminus can take additional arguments to refine the operation, which
|
55
55
|
are passed as an arbitrary hash to the back-end. Anything passed as
|
56
56
|
the extra value is just send direct to the back-end.
|
57
|
-
|
57
|
+
EOT
|
58
58
|
default_to do Hash.new end
|
59
59
|
end
|
60
60
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'puppet/indirector/code'
|
2
|
+
require 'puppet/ssl/key'
|
3
|
+
|
4
|
+
class Puppet::SSL::Key::DisabledCa < Puppet::Indirector::Code
|
5
|
+
desc "Manage the CA private key, but reject any remote access
|
6
|
+
to the SSL data store. Used when a master has an explicitly disabled CA to
|
7
|
+
prevent clients getting confusing 'success' behaviour."
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@file = Puppet::SSL::Key.indirection.terminus(:file)
|
11
|
+
end
|
12
|
+
|
13
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
14
|
+
define_method(name) do |request|
|
15
|
+
if request.remote?
|
16
|
+
raise Puppet::Error, "this master is not a CA"
|
17
|
+
else
|
18
|
+
@file.send(name, request)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -41,7 +41,19 @@ class Puppet::Node::Exec < Puppet::Indirector::Exec
|
|
41
41
|
|
42
42
|
# Translate the yaml string into Ruby objects.
|
43
43
|
def translate(name, output)
|
44
|
-
|
44
|
+
YAML.load(output).inject({}) do |hash, data|
|
45
|
+
case data[0]
|
46
|
+
when String
|
47
|
+
hash[data[0].intern] = data[1]
|
48
|
+
when Symbol
|
49
|
+
hash[data[0]] = data[1]
|
50
|
+
else
|
51
|
+
raise Puppet::Error, "key is a #{data[0].class}, not a string or symbol"
|
52
|
+
end
|
53
|
+
|
54
|
+
hash
|
55
|
+
end
|
56
|
+
|
45
57
|
rescue => detail
|
46
58
|
raise Puppet::Error, "Could not load external node results for #{name}: #{detail}"
|
47
59
|
end
|
@@ -38,8 +38,8 @@ module Manager
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# First make sure we don't have a method sitting around
|
41
|
-
name =
|
42
|
-
newmethod = "new#{name
|
41
|
+
name = name.intern
|
42
|
+
newmethod = "new#{name}"
|
43
43
|
|
44
44
|
# Used for method manipulation.
|
45
45
|
selfobj = singleton_class
|
@@ -108,17 +108,24 @@ module Manager
|
|
108
108
|
def type(name)
|
109
109
|
@types ||= {}
|
110
110
|
|
111
|
-
|
111
|
+
# We are overwhelmingly symbols here, which usually match, so it is worth
|
112
|
+
# having this special-case to return quickly. Like, 25K to 300 symbols to
|
113
|
+
# strings in this method. --daniel 2012-07-17
|
114
|
+
return @types[name] if @types[name]
|
112
115
|
|
113
|
-
if
|
114
|
-
|
115
|
-
|
116
|
-
if
|
117
|
-
|
118
|
-
end
|
116
|
+
# Try mangling the name, if it is a string.
|
117
|
+
if name.is_a? String
|
118
|
+
name = name.downcase.intern
|
119
|
+
return @types[name] if @types[name]
|
120
|
+
end
|
119
121
|
|
120
|
-
|
122
|
+
# Try loading the type.
|
123
|
+
if typeloader.load(name, Puppet::Node::Environment.current)
|
124
|
+
Puppet.warning "Loaded puppet/type/#{name} but no class was created" unless @types.include? name
|
121
125
|
end
|
126
|
+
|
127
|
+
# ...and I guess that is that, eh.
|
128
|
+
return @types[name]
|
122
129
|
end
|
123
130
|
|
124
131
|
# Create a loader for Puppet types.
|
@@ -179,7 +179,7 @@ module Puppet
|
|
179
179
|
|
180
180
|
# Set the declaration type. Either :allow or :deny.
|
181
181
|
def type=(type)
|
182
|
-
type =
|
182
|
+
type = type.intern
|
183
183
|
raise ArgumentError, "Invalid declaration type #{type}" unless [:allow, :deny].include?(type)
|
184
184
|
@type = type
|
185
185
|
end
|
@@ -131,10 +131,9 @@ class Rights
|
|
131
131
|
|
132
132
|
# A right.
|
133
133
|
class Right < Puppet::Network::AuthStore
|
134
|
-
include Puppet::FileCollection::Lookup
|
135
|
-
|
136
134
|
attr_accessor :name, :key, :acl_type
|
137
135
|
attr_accessor :methods, :environment, :authentication
|
136
|
+
attr_accessor :line, :file
|
138
137
|
|
139
138
|
ALL = [:save, :destroy, :find, :search]
|
140
139
|
|
@@ -53,11 +53,17 @@ class Puppet::Parameter::Value
|
|
53
53
|
# A standard way of converting all of our values, so we're always
|
54
54
|
# comparing apples to apples.
|
55
55
|
def convert(value)
|
56
|
-
|
57
|
-
|
56
|
+
case value
|
57
|
+
when Symbol, '' # can't intern an empty string
|
58
58
|
value
|
59
|
+
when String
|
60
|
+
value.intern
|
61
|
+
when true
|
62
|
+
:true
|
63
|
+
when false
|
64
|
+
:false
|
59
65
|
else
|
60
|
-
value.to_s.
|
66
|
+
value.to_s.intern
|
61
67
|
end
|
62
68
|
end
|
63
69
|
end
|
data/lib/puppet/parser/ast.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'puppet'
|
4
4
|
require 'puppet/util/autoload'
|
5
|
-
require 'puppet/file_collection/lookup'
|
6
5
|
|
7
6
|
# The base class for all of the objects that make up the parse trees.
|
8
7
|
# Handles things like file name, line #, and also does the initialization
|
@@ -11,13 +10,11 @@ class Puppet::Parser::AST
|
|
11
10
|
# Do this so I don't have to type the full path in all of the subclasses
|
12
11
|
AST = Puppet::Parser::AST
|
13
12
|
|
14
|
-
include Puppet::FileCollection::Lookup
|
15
|
-
|
16
13
|
include Puppet::Util::Errors
|
17
14
|
include Puppet::Util::MethodHelper
|
18
15
|
include Puppet::Util::Docs
|
19
16
|
|
20
|
-
attr_accessor :parent, :scope
|
17
|
+
attr_accessor :parent, :scope, :file, :line
|
21
18
|
|
22
19
|
def inspect
|
23
20
|
"( #{self.class} #{self.to_s} #{@children.inspect} )"
|