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/provider.rb
CHANGED
@@ -33,7 +33,7 @@ class Puppet::Provider
|
|
33
33
|
attr_accessor :resource
|
34
34
|
|
35
35
|
def self.command(name)
|
36
|
-
name =
|
36
|
+
name = name.intern
|
37
37
|
|
38
38
|
if defined?(@commands) and command = @commands[name]
|
39
39
|
# nothing
|
@@ -144,7 +144,7 @@ class Puppet::Provider
|
|
144
144
|
# for those providers that use prefetch and flush.
|
145
145
|
def self.mk_resource_methods
|
146
146
|
[resource_type.validproperties, resource_type.parameters].flatten.each do |attr|
|
147
|
-
attr =
|
147
|
+
attr = attr.intern
|
148
148
|
next if attr == :name
|
149
149
|
define_method(attr) do
|
150
150
|
@property_hash[attr] || :absent
|
@@ -162,7 +162,7 @@ class Puppet::Provider
|
|
162
162
|
# and path to the block (really only used by 'commands').
|
163
163
|
def self.optional_commands(hash)
|
164
164
|
hash.each do |name, path|
|
165
|
-
name =
|
165
|
+
name = name.intern
|
166
166
|
@commands[name] = path
|
167
167
|
|
168
168
|
yield(name, path) if block_given?
|
@@ -239,7 +239,7 @@ class Puppet::Provider
|
|
239
239
|
|
240
240
|
# Get a parameter value.
|
241
241
|
def get(param)
|
242
|
-
@property_hash[
|
242
|
+
@property_hash[param.intern] || :absent
|
243
243
|
end
|
244
244
|
|
245
245
|
def initialize(resource = nil)
|
@@ -270,7 +270,7 @@ class Puppet::Provider
|
|
270
270
|
# Set passed params as the current values.
|
271
271
|
def set(params)
|
272
272
|
params.each do |param, value|
|
273
|
-
@property_hash[
|
273
|
+
@property_hash[param.intern] = value
|
274
274
|
end
|
275
275
|
end
|
276
276
|
|
@@ -6,7 +6,7 @@ Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do
|
|
6
6
|
confine :operatingsystem => :windows
|
7
7
|
defaultfor :operatingsystem => :windows
|
8
8
|
|
9
|
-
desc <<-EOT
|
9
|
+
desc <<-'EOT'
|
10
10
|
Execute external binaries on Windows systems. As with the `posix`
|
11
11
|
provider, this provider directly calls the command with the arguments
|
12
12
|
given, without passing it through a shell or performing any interpolation.
|
@@ -11,38 +11,19 @@ Puppet::Type.type(:file).provide :windows do
|
|
11
11
|
include Puppet::Util::Windows::Security
|
12
12
|
end
|
13
13
|
|
14
|
-
ERROR_INVALID_SID_STRUCTURE = 1337
|
15
|
-
|
16
|
-
def id2name(id)
|
17
|
-
# If it's a valid sid, get the name. Otherwise, it's already a name, so
|
18
|
-
# just return it.
|
19
|
-
begin
|
20
|
-
if string_to_sid_ptr(id)
|
21
|
-
name = nil
|
22
|
-
Puppet::Util::ADSI.execquery(
|
23
|
-
"SELECT Name FROM Win32_Account WHERE SID = '#{id}'
|
24
|
-
AND LocalAccount = true"
|
25
|
-
).each { |a| name ||= a.name }
|
26
|
-
return name
|
27
|
-
end
|
28
|
-
rescue Puppet::Util::Windows::Error => e
|
29
|
-
raise unless e.code == ERROR_INVALID_SID_STRUCTURE
|
30
|
-
end
|
31
|
-
|
32
|
-
id
|
33
|
-
end
|
34
|
-
|
35
14
|
# Determine if the account is valid, and if so, return the UID
|
36
15
|
def name2id(value)
|
37
|
-
|
38
|
-
|
39
|
-
begin
|
40
|
-
return value if string_to_sid_ptr(value)
|
41
|
-
rescue Puppet::Util::Windows::Error => e
|
42
|
-
raise unless e.code == ERROR_INVALID_SID_STRUCTURE
|
43
|
-
end
|
16
|
+
Puppet::Util::Windows::Security.name_to_sid(value)
|
17
|
+
end
|
44
18
|
|
45
|
-
|
19
|
+
# If it's a valid SID, get the name. Otherwise, it's already a name,
|
20
|
+
# so just return it.
|
21
|
+
def id2name(id)
|
22
|
+
if Puppet::Util::Windows::Security.valid_sid?(id)
|
23
|
+
Puppet::Util::Windows::Security.sid_to_name(id)
|
24
|
+
else
|
25
|
+
id
|
26
|
+
end
|
46
27
|
end
|
47
28
|
|
48
29
|
# We use users and groups interchangeably, so use the same methods for both
|
@@ -7,7 +7,7 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
|
|
7
7
|
|
8
8
|
commands :add => "groupadd", :delete => "groupdel", :modify => "groupmod"
|
9
9
|
|
10
|
-
has_feature :system_groups
|
10
|
+
has_feature :system_groups unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem)
|
11
11
|
|
12
12
|
verify :gid, "GID must be an integer" do |value|
|
13
13
|
value.is_a? Integer
|
@@ -21,10 +21,9 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
cmd << "-o" if @resource.allowdupe?
|
24
|
-
cmd << "-r" if @resource.system?
|
24
|
+
cmd << "-r" if @resource.system? and self.class.system_groups?
|
25
25
|
cmd << @resource[:name]
|
26
26
|
|
27
27
|
cmd
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
@@ -12,7 +12,7 @@ Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
12
12
|
not specify one, but it is a potentially expensive operation, as it
|
13
13
|
iterates across all existing groups to pick the appropriate next one."
|
14
14
|
|
15
|
-
confine :
|
15
|
+
confine :feature => :ldap, :false => (Puppet[:ldapuser] == "")
|
16
16
|
|
17
17
|
# We're mapping 'members' here because we want to make it
|
18
18
|
# easy for the ldap user provider to manage groups. This
|
data/lib/puppet/provider/ldap.rb
CHANGED
@@ -46,7 +46,11 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
46
46
|
@property_hash[:ensure] = :present
|
47
47
|
self.class.resource_type.validproperties.each do |property|
|
48
48
|
if val = resource.should(property)
|
49
|
-
|
49
|
+
if property.to_s == 'gid'
|
50
|
+
self.gid = val
|
51
|
+
else
|
52
|
+
@property_hash[property] = val
|
53
|
+
end
|
50
54
|
end
|
51
55
|
end
|
52
56
|
end
|
@@ -6,13 +6,13 @@ require 'puppet'
|
|
6
6
|
class Puppet::Provider::NameService < Puppet::Provider
|
7
7
|
class << self
|
8
8
|
def autogen_default(param)
|
9
|
-
defined?(@autogen_defaults) ? @autogen_defaults[
|
9
|
+
defined?(@autogen_defaults) ? @autogen_defaults[param.intern] : nil
|
10
10
|
end
|
11
11
|
|
12
12
|
def autogen_defaults(hash)
|
13
13
|
@autogen_defaults ||= {}
|
14
14
|
hash.each do |param, value|
|
15
|
-
@autogen_defaults[
|
15
|
+
@autogen_defaults[param.intern] = value
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -112,7 +112,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
112
112
|
# Autogenerate a value. Mostly used for uid/gid, but also used heavily
|
113
113
|
# with DirectoryServices, because DirectoryServices is stupid.
|
114
114
|
def autogen(field)
|
115
|
-
field =
|
115
|
+
field = field.intern
|
116
116
|
id_generators = {:user => :uid, :group => :gid}
|
117
117
|
if id_generators[@resource.class.name] == field
|
118
118
|
return autogen_id(field)
|
@@ -500,7 +500,7 @@ class DirectoryService < Puppet::Provider::NameService
|
|
500
500
|
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
501
501
|
# JJM: The following line just maps the NS name to the DS name
|
502
502
|
# e.g. { :uid => 'UniqueID' }
|
503
|
-
exec_arg_vector << @@ns_to_ds_attribute_map[
|
503
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[param.intern]
|
504
504
|
# JJM: The following line sends the actual value to set the property to
|
505
505
|
exec_arg_vector << value.to_s
|
506
506
|
begin
|
@@ -555,7 +555,7 @@ class DirectoryService < Puppet::Provider::NameService
|
|
555
555
|
add_members(nil, value)
|
556
556
|
else
|
557
557
|
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
558
|
-
exec_arg_vector << @@ns_to_ds_attribute_map[
|
558
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[property.intern]
|
559
559
|
next if property == :password # skip setting the password here
|
560
560
|
exec_arg_vector << value.to_s
|
561
561
|
begin
|
@@ -20,7 +20,9 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
20
20
|
else
|
21
21
|
gem_list_command << "--remote"
|
22
22
|
end
|
23
|
-
|
23
|
+
if options[:source]
|
24
|
+
gem_list_command << "--source" << options[:source]
|
25
|
+
end
|
24
26
|
if name = options[:justme]
|
25
27
|
gem_list_command << name + "$"
|
26
28
|
end
|
@@ -104,7 +106,9 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
104
106
|
|
105
107
|
def latest
|
106
108
|
# This always gets the latest version available.
|
107
|
-
|
109
|
+
gemlist_options = {:justme => resource[:name]}
|
110
|
+
gemlist_options.merge!({:source => resource[:source]}) unless resource[:source].nil?
|
111
|
+
hash = self.class.gemlist(gemlist_options)
|
108
112
|
|
109
113
|
hash[:ensure][0]
|
110
114
|
end
|
@@ -20,7 +20,8 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
20
20
|
search_format = "<category> <name> [<installedversions:LASTVERSION>] [<bestversion:LASTVERSION>] <homepage> <description>\n"
|
21
21
|
|
22
22
|
begin
|
23
|
-
|
23
|
+
eix_file = File.directory?("/var/cache/eix") ? "/var/cache/eix/portage.eix" : "/var/cache/eix"
|
24
|
+
update_eix if !FileUtils.uptodate?(eix_file, %w{/usr/bin/eix /usr/portage/metadata/timestamp})
|
24
25
|
|
25
26
|
search_output = nil
|
26
27
|
Puppet::Util::Execution.withenv :LASTVERSION => version_format do
|
@@ -81,7 +82,8 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
81
82
|
search_value = package_name
|
82
83
|
|
83
84
|
begin
|
84
|
-
|
85
|
+
eix_file = File.directory?("/var/cache/eix") ? "/var/cache/eix/portage.eix" : "/var/cache/eix"
|
86
|
+
update_eix if !FileUtils.uptodate?(eix_file, %w{/usr/bin/eix /usr/portage/metadata/timestamp})
|
85
87
|
|
86
88
|
search_output = nil
|
87
89
|
Puppet::Util::Execution.withenv :LASTVERSION => version_format do
|
@@ -127,7 +127,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
127
127
|
# Override the default method with a lot more functionality.
|
128
128
|
def self.mk_resource_methods
|
129
129
|
[resource_type.validproperties, resource_type.parameters].flatten.each do |attr|
|
130
|
-
attr =
|
130
|
+
attr = attr.intern
|
131
131
|
define_method(attr) do
|
132
132
|
# if @property_hash.empty?
|
133
133
|
# # Note that this swaps the provider out from under us.
|
@@ -125,7 +125,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
125
125
|
|
126
126
|
# By comparing account SIDs we don't have to worry about case
|
127
127
|
# sensitivity, or canonicalization of the account name.
|
128
|
-
Puppet::Util::
|
128
|
+
Puppet::Util::Windows::Security.name_to_sid(current) == Puppet::Util::Windows::Security.name_to_sid(should[0])
|
129
129
|
end
|
130
130
|
|
131
131
|
def trigger_insync?(current, should)
|
@@ -202,7 +202,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def user=(value)
|
205
|
-
self.fail("Invalid user: #{value}") unless Puppet::Util::
|
205
|
+
self.fail("Invalid user: #{value}") unless Puppet::Util::Windows::Security.name_to_sid(value)
|
206
206
|
|
207
207
|
if value.to_s.downcase != 'system'
|
208
208
|
task.set_account_information(value, resource[:password])
|
@@ -1,5 +1,5 @@
|
|
1
|
-
Puppet::Type.type(:service).provide :base do
|
2
|
-
desc "The simplest form of service support.
|
1
|
+
Puppet::Type.type(:service).provide :base, :parent => :service do
|
2
|
+
desc "The simplest form of Unix service support.
|
3
3
|
|
4
4
|
You have to specify enough about your service for this to work; the
|
5
5
|
minimum you can specify is a binary for starting the process, and this
|
@@ -11,10 +11,6 @@ Puppet::Type.type(:service).provide :base do
|
|
11
11
|
|
12
12
|
commands :kill => "kill"
|
13
13
|
|
14
|
-
def self.instances
|
15
|
-
[]
|
16
|
-
end
|
17
|
-
|
18
14
|
# Get the process ID for a running process. Requires the 'pattern'
|
19
15
|
# parameter.
|
20
16
|
def getpid
|
@@ -35,20 +31,6 @@ Puppet::Type.type(:service).provide :base do
|
|
35
31
|
nil
|
36
32
|
end
|
37
33
|
|
38
|
-
# How to restart the process.
|
39
|
-
def restart
|
40
|
-
if @resource[:restart] or restartcmd
|
41
|
-
ucommand(:restart)
|
42
|
-
else
|
43
|
-
self.stop
|
44
|
-
self.start
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# There is no default command, which causes other methods to be used
|
49
|
-
def restartcmd
|
50
|
-
end
|
51
|
-
|
52
34
|
# Check if the process is running. Prefer the 'status' parameter,
|
53
35
|
# then 'statuscmd' method, then look in the process table. We give
|
54
36
|
# the object the option to not return a status command, which might
|
@@ -119,26 +101,5 @@ Puppet::Type.type(:service).provide :base do
|
|
119
101
|
# There is no default command, which causes other methods to be used
|
120
102
|
def stopcmd
|
121
103
|
end
|
122
|
-
|
123
|
-
# A simple wrapper so execution failures are a bit more informative.
|
124
|
-
def texecute(type, command, fof = true)
|
125
|
-
begin
|
126
|
-
# #565: Services generally produce no output, so squelch them.
|
127
|
-
execute(command, :failonfail => fof, :squelch => true)
|
128
|
-
rescue Puppet::ExecutionFailure => detail
|
129
|
-
@resource.fail "Could not #{type} #{@resource.ref}: #{detail}"
|
130
|
-
end
|
131
|
-
nil
|
132
|
-
end
|
133
|
-
|
134
|
-
# Use either a specified command or the default for our provider.
|
135
|
-
def ucommand(type, fof = true)
|
136
|
-
if c = @resource[type]
|
137
|
-
cmd = [c]
|
138
|
-
else
|
139
|
-
cmd = [send("#{type}cmd")].flatten
|
140
|
-
end
|
141
|
-
texecute(type, cmd, fof)
|
142
|
-
end
|
143
104
|
end
|
144
105
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# author Brice Figureau <brice-puppet@daysofwonder.com>
|
4
4
|
Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
5
|
-
desc <<-EOT
|
5
|
+
desc <<-'EOT'
|
6
6
|
Daemontools service management.
|
7
7
|
|
8
8
|
This provider manages daemons supervised by D.J. Bernstein daemontools.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'facter/util/plist'
|
2
2
|
Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
3
|
-
desc <<-EOT
|
3
|
+
desc <<-'EOT'
|
4
4
|
This provider manages jobs with `launchd`, which is the default service
|
5
5
|
framework for Mac OS X (and may be available for use on other platforms).
|
6
6
|
|
@@ -21,9 +21,12 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
|
|
21
21
|
|
22
22
|
# Remove the symlinks
|
23
23
|
def disable
|
24
|
-
|
24
|
+
# The off method operates on run levels 2,3,4 and 5 by default We ensure
|
25
|
+
# all run levels are turned off because the reset method may turn on the
|
26
|
+
# service in run levels 0, 1 and/or 6
|
27
|
+
output = chkconfig("--level", "0123456", @resource[:name], :off)
|
25
28
|
rescue Puppet::ExecutionFailure
|
26
|
-
|
29
|
+
raise Puppet::Error, "Could not disable #{self.name}: #{output}"
|
27
30
|
end
|
28
31
|
|
29
32
|
def enabled?
|
@@ -47,7 +50,7 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
|
|
47
50
|
def enable
|
48
51
|
output = chkconfig(@resource[:name], :on)
|
49
52
|
rescue Puppet::ExecutionFailure => detail
|
50
|
-
|
53
|
+
raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
|
51
54
|
end
|
52
55
|
|
53
56
|
def initscript
|
@@ -70,6 +73,4 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
|
|
70
73
|
def stopcmd
|
71
74
|
[command(:service), @resource[:name], "stop"]
|
72
75
|
end
|
73
|
-
|
74
76
|
end
|
75
|
-
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Puppet::Type.type(:service).provide :service do
|
2
|
+
desc "The simplest form of service support."
|
3
|
+
|
4
|
+
def self.instances
|
5
|
+
[]
|
6
|
+
end
|
7
|
+
|
8
|
+
# How to restart the process.
|
9
|
+
def restart
|
10
|
+
if @resource[:restart] or restartcmd
|
11
|
+
ucommand(:restart)
|
12
|
+
else
|
13
|
+
self.stop
|
14
|
+
self.start
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# There is no default command, which causes other methods to be used
|
19
|
+
def restartcmd
|
20
|
+
end
|
21
|
+
|
22
|
+
# A simple wrapper so execution failures are a bit more informative.
|
23
|
+
def texecute(type, command, fof = true)
|
24
|
+
begin
|
25
|
+
# #565: Services generally produce no output, so squelch them.
|
26
|
+
execute(command, :failonfail => fof, :squelch => true)
|
27
|
+
rescue Puppet::ExecutionFailure => detail
|
28
|
+
@resource.fail "Could not #{type} #{@resource.ref}: #{detail}"
|
29
|
+
end
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
# Use either a specified command or the default for our provider.
|
34
|
+
def ucommand(type, fof = true)
|
35
|
+
if c = @resource[type]
|
36
|
+
cmd = [c]
|
37
|
+
else
|
38
|
+
cmd = [send("#{type}cmd")].flatten
|
39
|
+
end
|
40
|
+
texecute(type, cmd, fof)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|