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
data/lib/puppet/type/augeas.rb
CHANGED
@@ -20,7 +20,7 @@ Puppet::Type.newtype(:augeas) do
|
|
20
20
|
feature :need_to_run?, "If the command should run"
|
21
21
|
feature :execute_changes, "Actually make the changes"
|
22
22
|
|
23
|
-
@doc = <<-EOT
|
23
|
+
@doc = <<-'EOT'
|
24
24
|
Apply a change or an array of changes to the filesystem
|
25
25
|
using the augeas tool.
|
26
26
|
|
data/lib/puppet/type/cron.rb
CHANGED
@@ -3,7 +3,7 @@ require 'facter'
|
|
3
3
|
require 'puppet/util/filetype'
|
4
4
|
|
5
5
|
Puppet::Type.newtype(:cron) do
|
6
|
-
@doc = <<-EOT
|
6
|
+
@doc = <<-'EOT'
|
7
7
|
Installs and manages cron jobs. Every cron resource requires a command
|
8
8
|
and user attribute, as well as at least one periodic attribute (hour,
|
9
9
|
minute, month, monthday, weekday, or special). While the name of the cron
|
@@ -389,7 +389,7 @@ Puppet::Type.newtype(:cron) do
|
|
389
389
|
attr_accessor :uid
|
390
390
|
|
391
391
|
def value(name)
|
392
|
-
name =
|
392
|
+
name = name.intern
|
393
393
|
ret = nil
|
394
394
|
if obj = @parameters[name]
|
395
395
|
ret = obj.should
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -218,8 +218,8 @@ module Puppet
|
|
218
218
|
newparam(:timeout) do
|
219
219
|
desc "The maximum time the command should take. If the command takes
|
220
220
|
longer than the timeout, the command is considered to have failed
|
221
|
-
and will be stopped.
|
222
|
-
|
221
|
+
and will be stopped. The timeout is specified in seconds. The default
|
222
|
+
timeout is 300 seconds and you can set it to 0 to disable the timeout."
|
223
223
|
|
224
224
|
munge do |value|
|
225
225
|
value = value.shift if value.is_a?(Array)
|
@@ -274,7 +274,7 @@ module Puppet
|
|
274
274
|
|
275
275
|
|
276
276
|
newcheck(:refreshonly) do
|
277
|
-
desc <<-EOT
|
277
|
+
desc <<-'EOT'
|
278
278
|
The command should only be run as a
|
279
279
|
refresh mechanism for when a dependent object is changed. It only
|
280
280
|
makes sense to use this option when this command depends on some
|
@@ -311,7 +311,7 @@ module Puppet
|
|
311
311
|
end
|
312
312
|
|
313
313
|
newcheck(:creates, :parent => Puppet::Parameter::Path) do
|
314
|
-
desc <<-EOT
|
314
|
+
desc <<-'EOT'
|
315
315
|
A file that this command creates. If this
|
316
316
|
parameter is provided, then the command will only be run
|
317
317
|
if the specified file does not exist.
|
@@ -336,7 +336,7 @@ module Puppet
|
|
336
336
|
end
|
337
337
|
|
338
338
|
newcheck(:unless) do
|
339
|
-
desc <<-EOT
|
339
|
+
desc <<-'EOT'
|
340
340
|
If this parameter is set, then this `exec` will run unless
|
341
341
|
the command returns 0. For example:
|
342
342
|
|
@@ -378,7 +378,7 @@ module Puppet
|
|
378
378
|
end
|
379
379
|
|
380
380
|
newcheck(:onlyif) do
|
381
|
-
desc <<-EOT
|
381
|
+
desc <<-'EOT'
|
382
382
|
If this parameter is set, then this `exec` will only run if
|
383
383
|
the command returns 0. For example:
|
384
384
|
|
data/lib/puppet/type/file.rb
CHANGED
@@ -35,11 +35,11 @@ Puppet::Type.newtype(:file) do
|
|
35
35
|
parent directories of a file, the file resource will autorequire them."
|
36
36
|
|
37
37
|
def self.title_patterns
|
38
|
-
[ [ /^(.*?)\/*\Z/m, [ [ :path
|
38
|
+
[ [ /^(.*?)\/*\Z/m, [ [ :path ] ] ] ]
|
39
39
|
end
|
40
40
|
|
41
41
|
newparam(:path) do
|
42
|
-
desc <<-EOT
|
42
|
+
desc <<-'EOT'
|
43
43
|
The path to the file to manage. Must be fully qualified.
|
44
44
|
|
45
45
|
On Windows, the path should include the drive letter and should use `/` as
|
@@ -53,20 +53,8 @@ Puppet::Type.newtype(:file) do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
# convert the current path in an index into the collection and the last
|
57
|
-
# path name. The aim is to use less storage for all common paths in a hierarchy
|
58
56
|
munge do |value|
|
59
|
-
|
60
|
-
path, name = ::File.split(::File.expand_path(value))
|
61
|
-
|
62
|
-
{ :index => Puppet::FileCollection.collection.index(path), :name => name }
|
63
|
-
end
|
64
|
-
|
65
|
-
# and the reverse
|
66
|
-
unmunge do |value|
|
67
|
-
basedir = Puppet::FileCollection.collection.path(value[:index])
|
68
|
-
|
69
|
-
::File.join( basedir, value[:name] )
|
57
|
+
::File.expand_path(value)
|
70
58
|
end
|
71
59
|
end
|
72
60
|
|
@@ -521,6 +509,7 @@ Puppet::Type.newtype(:file) do
|
|
521
509
|
# remote system.
|
522
510
|
mark_children_for_purging(children) if self.purge?
|
523
511
|
|
512
|
+
# REVISIT: sort_by is more efficient?
|
524
513
|
result = children.values.sort { |a, b| a[:path] <=> b[:path] }
|
525
514
|
remove_less_specific_files(result)
|
526
515
|
end
|
@@ -530,6 +519,7 @@ Puppet::Type.newtype(:file) do
|
|
530
519
|
# not likely to have many actual conflicts, which is good, because
|
531
520
|
# this is a pretty inefficient implementation.
|
532
521
|
def remove_less_specific_files(files)
|
522
|
+
# REVISIT: is this Windows safe? AltSeparator?
|
533
523
|
mypath = self[:path].split(::File::Separator)
|
534
524
|
other_paths = catalog.vertices.
|
535
525
|
select { |r| r.is_a?(self.class) and r[:path] != self[:path] }.
|
@@ -5,7 +5,7 @@ module Puppet
|
|
5
5
|
require 'puppet/util/symbolic_file_mode'
|
6
6
|
include Puppet::Util::SymbolicFileMode
|
7
7
|
|
8
|
-
desc <<-EOT
|
8
|
+
desc <<-'EOT'
|
9
9
|
Whether to create files that don't currently exist.
|
10
10
|
Possible values are *absent*, *present*, *file*, and *directory*.
|
11
11
|
Specifying `present` will match any form of file existence, and
|
@@ -6,7 +6,7 @@ module Puppet
|
|
6
6
|
require 'puppet/util/symbolic_file_mode'
|
7
7
|
include Puppet::Util::SymbolicFileMode
|
8
8
|
|
9
|
-
desc <<-EOT
|
9
|
+
desc <<-'EOT'
|
10
10
|
The desired permissions mode for the file, in symbolic or numeric
|
11
11
|
notation. Puppet uses traditional Unix permission schemes and translates
|
12
12
|
them to equivalent permissions for systems which represent permissions
|
@@ -48,9 +48,13 @@ module Puppet
|
|
48
48
|
def insync?(value)
|
49
49
|
if not selinux_support?
|
50
50
|
debug("SELinux bindings not found. Ignoring parameter.")
|
51
|
-
|
51
|
+
true
|
52
|
+
elsif not selinux_label_support?(@resource[:path])
|
53
|
+
debug("SELinux not available for this filesystem. Ignoring parameter.")
|
54
|
+
true
|
55
|
+
else
|
56
|
+
super
|
52
57
|
end
|
53
|
-
super
|
54
58
|
end
|
55
59
|
|
56
60
|
def sync
|
@@ -12,7 +12,7 @@ module Puppet
|
|
12
12
|
include Puppet::Util::Diff
|
13
13
|
|
14
14
|
attr_accessor :source, :local
|
15
|
-
desc <<-EOT
|
15
|
+
desc <<-'EOT'
|
16
16
|
A source file, which will be copied into place on the local system.
|
17
17
|
Values can be URIs pointing to remote files, or fully qualified paths to
|
18
18
|
files available on the local system (including files on NFS shares or
|
data/lib/puppet/type/mount.rb
CHANGED
data/lib/puppet/type/package.rb
CHANGED
@@ -306,7 +306,7 @@ module Puppet
|
|
306
306
|
end
|
307
307
|
|
308
308
|
newparam(:install_options, :required_features => :install_options) do
|
309
|
-
desc <<-EOT
|
309
|
+
desc <<-'EOT'
|
310
310
|
A hash of additional options to pass when installing a package. These
|
311
311
|
options are package-specific, and should be documented by the software
|
312
312
|
vendor. The most commonly implemented option is `INSTALLDIR`:
|
data/lib/puppet/type/schedule.rb
CHANGED
@@ -80,7 +80,7 @@ Puppet::Type.newtype(:scheduled_task) do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
newproperty(:trigger, :array_matching => :all) do
|
83
|
-
desc <<-EOT
|
83
|
+
desc <<-'EOT'
|
84
84
|
One or more triggers defining when the task should run. A single trigger is
|
85
85
|
represented as a hash, and multiple triggers can be specified with an array of
|
86
86
|
hashes.
|
data/lib/puppet/type/tidy.rb
CHANGED
@@ -43,7 +43,7 @@ Puppet::Type.newtype(:tidy) do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
newparam(:matches) do
|
46
|
-
desc <<-EOT
|
46
|
+
desc <<-'EOT'
|
47
47
|
One or more (shell type) file glob patterns, which restrict
|
48
48
|
the list of files to be tidied to those whose basenames match
|
49
49
|
at least one of the patterns specified. Multiple patterns can
|
data/lib/puppet/type/whit.rb
CHANGED
@@ -10,18 +10,25 @@ Puppet::Type.newtype(:whit) do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
|
-
# Hide the fact that we're a whit from logs
|
13
|
+
# Hide the fact that we're a whit from logs.
|
14
|
+
#
|
15
|
+
# I hate you, milkman whit. You are so painful, so often.
|
16
|
+
#
|
17
|
+
# In this case the memoized version means we generate a new string about 1.9
|
18
|
+
# percent of the time, and we allocate about 1.6MB less memory, and generate
|
19
|
+
# a whole lot less GC churn.
|
20
|
+
#
|
21
|
+
# That number probably goes up at least O(n) with the complexity of your
|
22
|
+
# catalog, and I suspect beyond that, because that is, like, 10,000 calls
|
23
|
+
# for 200 distinct objects. Even with just linear, that is a constant
|
24
|
+
# factor of, like, 50n. --daniel 2012-07-17
|
14
25
|
def to_s
|
15
|
-
name.sub(/^completed_|^admissible_/, "")
|
16
|
-
end
|
17
|
-
|
18
|
-
def path
|
19
|
-
to_s
|
26
|
+
@to_s ||= name.sub(/^completed_|^admissible_/, "")
|
20
27
|
end
|
28
|
+
alias path to_s
|
21
29
|
|
22
30
|
def refresh
|
23
|
-
# We don't do anything with them, but we need this to
|
24
|
-
#
|
25
|
-
# chain of propagation.
|
31
|
+
# We don't do anything with them, but we need this to show that we are
|
32
|
+
# "refresh aware" and not break the chain of propagation.
|
26
33
|
end
|
27
34
|
end
|
data/lib/puppet/util.rb
CHANGED
@@ -195,17 +195,23 @@ module Util
|
|
195
195
|
|
196
196
|
# Determine in a platform-specific way whether a path is absolute. This
|
197
197
|
# defaults to the local platform if none is specified.
|
198
|
+
#
|
199
|
+
# Escape once for the string literal, and once for the regex.
|
200
|
+
slash = '[\\\\/]'
|
201
|
+
label = '[^\\\\/]+'
|
202
|
+
AbsolutePathWindows = %r!^(?:(?:[A-Z]:#{slash})|(?:#{slash}#{slash}#{label}#{slash}#{label})|(?:#{slash}#{slash}\?#{slash}#{label}))!io
|
203
|
+
AbsolutePathPosix = %r!^/!
|
198
204
|
def absolute_path?(path, platform=nil)
|
199
|
-
#
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
#
|
208
|
-
#
|
205
|
+
# When running an internal subcommand (Application), the app requires puppet
|
206
|
+
# which loads features, which creates an autoloader, which calls this method.
|
207
|
+
# In that case, it isn't necessary to require puppet. When running an external
|
208
|
+
# subcommand or if none was specified, then the CommandLine will call the
|
209
|
+
# `which` method to resolve the external executable, and that requires features.
|
210
|
+
# Rather then moving this require to handle the external subcommand case, or
|
211
|
+
# no subcommand case, I'm undoing the performance change from 20efe94. This
|
212
|
+
# code has been eliminated in 3.x since puppet can be required before loading
|
213
|
+
# the application (since the default vardir/confdir locations are solely
|
214
|
+
# based on user vs. system user, and not the application's run_mode).
|
209
215
|
require 'puppet'
|
210
216
|
|
211
217
|
# Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard
|
@@ -214,8 +220,16 @@ module Util
|
|
214
220
|
# be called during the initialization of features so it can't depend on
|
215
221
|
# that.
|
216
222
|
platform ||= Puppet::Util::Platform.windows? ? :windows : :posix
|
223
|
+
regex = case platform
|
224
|
+
when :windows
|
225
|
+
AbsolutePathWindows
|
226
|
+
when :posix
|
227
|
+
AbsolutePathPosix
|
228
|
+
else
|
229
|
+
raise Puppet::DevError, "unknown platform #{platform} in absolute_path"
|
230
|
+
end
|
217
231
|
|
218
|
-
!! (path =~
|
232
|
+
!! (path =~ regex)
|
219
233
|
end
|
220
234
|
module_function :absolute_path?
|
221
235
|
|
@@ -457,6 +471,7 @@ module Util
|
|
457
471
|
end
|
458
472
|
|
459
473
|
def symbolize(value)
|
474
|
+
Puppet.deprecation_warning "symbolize is deprecated. Call the intern method on the object instead."
|
460
475
|
if value.respond_to? :intern
|
461
476
|
value.intern
|
462
477
|
else
|
@@ -477,6 +492,7 @@ module Util
|
|
477
492
|
end
|
478
493
|
|
479
494
|
def symbolizehash!(hash)
|
495
|
+
Puppet.deprecation_warning "symbolizehash! is deprecated. Use the non-destructive symbolizehash method instead."
|
480
496
|
# this is not the most memory-friendly way to accomplish this, but the
|
481
497
|
# code re-use and clarity seems worthwhile.
|
482
498
|
newhash = symbolizehash(hash)
|
data/lib/puppet/util/adsi.rb
CHANGED
@@ -45,20 +45,18 @@ module Puppet::Util::ADSI
|
|
45
45
|
"#{computer_uri}/#{resource_name},#{resource_type}"
|
46
46
|
end
|
47
47
|
|
48
|
+
def wmi_connection
|
49
|
+
connect(wmi_resource_uri)
|
50
|
+
end
|
51
|
+
|
48
52
|
def execquery(query)
|
49
|
-
|
53
|
+
wmi_connection.execquery(query)
|
50
54
|
end
|
51
55
|
|
52
56
|
def sid_for_account(name)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
query = "SELECT Sid from Win32_Account WHERE Name = '#{name}' AND Domain = '#{domain}' AND LocalAccount = true"
|
57
|
-
else
|
58
|
-
query = "SELECT Sid from Win32_Account WHERE Name = '#{name}' AND LocalAccount = true"
|
59
|
-
end
|
60
|
-
execquery(query).each { |u| sid ||= u.Sid }
|
61
|
-
sid
|
57
|
+
Puppet.deprecation_warning "Puppet::Util::ADSI.sid_for_account is deprecated and will be removed in 3.0, use Puppet::Util::Windows::SID.name_to_account instead."
|
58
|
+
|
59
|
+
Puppet::Util::Windows::Security.name_to_sid(name)
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
@@ -85,19 +83,7 @@ module Puppet::Util::ADSI
|
|
85
83
|
end
|
86
84
|
|
87
85
|
def self.logon(name, password)
|
88
|
-
|
89
|
-
fLOGON32_PROVIDER_DEFAULT = 0
|
90
|
-
|
91
|
-
logon_user = Win32API.new("advapi32", "LogonUser", ['P', 'P', 'P', 'L', 'L', 'P'], 'L')
|
92
|
-
close_handle = Win32API.new("kernel32", "CloseHandle", ['P'], 'V')
|
93
|
-
|
94
|
-
token = ' ' * 4
|
95
|
-
if logon_user.call(name, "", password, fLOGON32_LOGON_NETWORK, fLOGON32_PROVIDER_DEFAULT, token) != 0
|
96
|
-
close_handle.call(token.unpack('L')[0])
|
97
|
-
true
|
98
|
-
else
|
99
|
-
false
|
100
|
-
end
|
86
|
+
Puppet::Util::Windows::User.password_is?(name, password)
|
101
87
|
end
|
102
88
|
|
103
89
|
def [](attribute)
|
@@ -200,6 +186,22 @@ module Puppet::Util::ADSI
|
|
200
186
|
end
|
201
187
|
end
|
202
188
|
|
189
|
+
class UserProfile
|
190
|
+
def self.delete(sid)
|
191
|
+
begin
|
192
|
+
Puppet::Util::ADSI.wmi_connection.Delete("Win32_UserProfile.SID='#{sid}'")
|
193
|
+
rescue => e
|
194
|
+
# http://social.technet.microsoft.com/Forums/en/ITCG/thread/0f190051-ac96-4bf1-a47f-6b864bfacee5
|
195
|
+
# Prior to Vista SP1, there's no builtin way to programmatically
|
196
|
+
# delete user profiles (except for delprof.exe). So try to delete
|
197
|
+
# but warn if we fail
|
198
|
+
raise e unless e.message.include?('80041010')
|
199
|
+
|
200
|
+
Puppet.warning "Cannot delete user profile for '#{sid}' prior to Vista SP1"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
203
205
|
class Group
|
204
206
|
extend Enumerable
|
205
207
|
|
data/lib/puppet/util/autoload.rb
CHANGED
data/lib/puppet/util/classgen.rb
CHANGED
data/lib/puppet/util/feature.rb
CHANGED
@@ -23,7 +23,9 @@ class Puppet::Util::Feature
|
|
23
23
|
end
|
24
24
|
|
25
25
|
meta_def(method) do
|
26
|
-
|
26
|
+
# Positive cache only, except blocks which are executed just once above
|
27
|
+
final = @results[name] || block_given?
|
28
|
+
@results[name] = test(name, options) unless final
|
27
29
|
@results[name]
|
28
30
|
end
|
29
31
|
end
|
@@ -42,14 +42,14 @@ module Puppet::Util::FileParsing
|
|
42
42
|
# Customize this so we can do a bit of validation.
|
43
43
|
def fields=(fields)
|
44
44
|
@fields = fields.collect do |field|
|
45
|
-
r =
|
45
|
+
r = field.intern
|
46
46
|
raise ArgumentError.new("Cannot have fields named #{r}") if INVALID_FIELDS.include?(r)
|
47
47
|
r
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def initialize(type, options = {}, &block)
|
52
|
-
@type =
|
52
|
+
@type = type.intern
|
53
53
|
raise ArgumentError, "Invalid record type #{@type}" unless [:record, :text].include?(@type)
|
54
54
|
|
55
55
|
set_options(options)
|
@@ -97,7 +97,7 @@ module Puppet::Util::FileParsing
|
|
97
97
|
# Customize this so we can do a bit of validation.
|
98
98
|
def optional=(optional)
|
99
99
|
@optional = optional.collect do |field|
|
100
|
-
|
100
|
+
field.intern
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -269,7 +269,7 @@ module Puppet::Util::FileParsing
|
|
269
269
|
raise ArgumentError, "Must include a list of fields" unless options.include?(:fields)
|
270
270
|
|
271
271
|
record = FileRecord.new(:record, options, &block)
|
272
|
-
record.name =
|
272
|
+
record.name = name.intern
|
273
273
|
|
274
274
|
new_line_type(record)
|
275
275
|
end
|
@@ -284,7 +284,7 @@ module Puppet::Util::FileParsing
|
|
284
284
|
raise ArgumentError, "You must provide a :match regex for text lines" unless options.include?(:match)
|
285
285
|
|
286
286
|
record = FileRecord.new(:text, options, &block)
|
287
|
-
record.name =
|
287
|
+
record.name = name.intern
|
288
288
|
|
289
289
|
new_line_type(record)
|
290
290
|
end
|
@@ -338,11 +338,11 @@ module Puppet::Util::FileParsing
|
|
338
338
|
end
|
339
339
|
|
340
340
|
def valid_attr?(type, attr)
|
341
|
-
type =
|
342
|
-
if record = record_type(type) and record.fields.include?(
|
341
|
+
type = type.intern
|
342
|
+
if record = record_type(type) and record.fields.include?(attr.intern)
|
343
343
|
return true
|
344
344
|
else
|
345
|
-
if
|
345
|
+
if attr.intern == :ensure
|
346
346
|
return true
|
347
347
|
else
|
348
348
|
false
|
@@ -367,7 +367,7 @@ module Puppet::Util::FileParsing
|
|
367
367
|
|
368
368
|
# Retrieve the record object.
|
369
369
|
def record_type(type)
|
370
|
-
@record_types[
|
370
|
+
@record_types[type.intern]
|
371
371
|
end
|
372
372
|
end
|
373
373
|
|