puppet 2.7.3 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +166 -0
- data/install.rb +27 -7
- data/lib/puppet/application/agent.rb +29 -29
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/inspect.rb +9 -1
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/application/queue.rb +1 -1
- data/lib/puppet/application/resource.rb +3 -0
- data/lib/puppet/application.rb +4 -5
- data/lib/puppet/configurer.rb +1 -4
- data/lib/puppet/defaults.rb +45 -15
- data/lib/puppet/feature/base.rb +28 -17
- data/lib/puppet/feature/rails.rb +0 -3
- data/lib/puppet/feature/rubygems.rb +0 -3
- data/lib/puppet/file_bucket/dipper.rb +3 -2
- data/lib/puppet/file_bucket/file.rb +3 -3
- data/lib/puppet/file_serving/base.rb +4 -5
- data/lib/puppet/file_serving/configuration.rb +7 -13
- data/lib/puppet/file_serving/content.rb +0 -4
- data/lib/puppet/file_serving/fileset.rb +7 -6
- data/lib/puppet/file_serving/indirection_hooks.rb +1 -4
- data/lib/puppet/file_serving/metadata.rb +0 -4
- data/lib/puppet/file_serving/mount/file.rb +9 -12
- data/lib/puppet/file_serving/mount.rb +0 -5
- data/lib/puppet/file_serving/terminus_helper.rb +0 -4
- data/lib/puppet/file_serving.rb +0 -4
- data/lib/puppet/indirector/catalog/compiler.rb +0 -18
- data/lib/puppet/indirector/catalog/store_configs.rb +5 -0
- data/lib/puppet/indirector/direct_file_server.rb +0 -4
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/store_configs.rb +5 -0
- data/lib/puppet/indirector/file_content/file.rb +0 -4
- data/lib/puppet/indirector/file_content/file_server.rb +0 -4
- data/lib/puppet/indirector/file_content/rest.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file_server.rb +0 -4
- data/lib/puppet/indirector/file_metadata/rest.rb +0 -4
- data/lib/puppet/indirector/file_server.rb +1 -5
- data/lib/puppet/indirector/indirection.rb +3 -5
- data/lib/puppet/indirector/node/store_configs.rb +5 -0
- data/lib/puppet/indirector/request.rb +3 -1
- data/lib/puppet/indirector/resource/active_record.rb +97 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/ssl_file.rb +5 -1
- data/lib/puppet/indirector/store_configs.rb +30 -0
- data/lib/puppet/indirector/yaml.rb +5 -0
- data/lib/puppet/indirector.rb +7 -0
- data/lib/puppet/network/client.rb +0 -5
- data/lib/puppet/network/http_pool.rb +0 -56
- data/lib/puppet/node/environment.rb +9 -11
- data/lib/puppet/parameter/path.rb +1 -5
- data/lib/puppet/parameter.rb +1 -7
- data/lib/puppet/parser/ast/collection.rb +2 -2
- data/lib/puppet/parser/ast/collexpr.rb +10 -39
- data/lib/puppet/parser/collector.rb +41 -90
- data/lib/puppet/parser/compiler.rb +0 -3
- data/lib/puppet/parser/functions/create_resources.rb +22 -10
- data/lib/puppet/parser/functions/versioncmp.rb +9 -6
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/provider/augeas/augeas.rb +5 -3
- data/lib/puppet/provider/cron/crontab.rb +2 -2
- data/lib/puppet/provider/exec/posix.rb +23 -96
- data/lib/puppet/provider/exec/shell.rb +11 -2
- data/lib/puppet/provider/exec/windows.rb +35 -0
- data/lib/puppet/provider/exec.rb +79 -0
- data/lib/puppet/provider/group/windows_adsi.rb +48 -0
- data/lib/puppet/provider/host/parsed.rb +3 -0
- data/lib/puppet/provider/macauthorization/macauthorization.rb +4 -4
- data/lib/puppet/provider/mount.rb +0 -3
- data/lib/puppet/provider/naginator.rb +0 -3
- data/lib/puppet/provider/package/appdmg.rb +0 -1
- data/lib/puppet/provider/package/apple.rb +3 -7
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/aptitude.rb +0 -1
- data/lib/puppet/provider/package/aptrpm.rb +0 -1
- data/lib/puppet/provider/package/blastwave.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +5 -6
- data/lib/puppet/provider/package/fink.rb +3 -4
- data/lib/puppet/provider/package/freebsd.rb +0 -1
- data/lib/puppet/provider/package/gem.rb +0 -1
- data/lib/puppet/provider/package/hpux.rb +3 -3
- data/lib/puppet/provider/package/macports.rb +0 -1
- data/lib/puppet/provider/package/msi.rb +82 -0
- data/lib/puppet/provider/package/openbsd.rb +18 -19
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +0 -1
- data/lib/puppet/provider/package/pkgdmg.rb +9 -7
- data/lib/puppet/provider/package/pkgutil.rb +0 -1
- data/lib/puppet/provider/package/ports.rb +0 -1
- data/lib/puppet/provider/package/portupgrade.rb +183 -193
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +0 -1
- data/lib/puppet/provider/package/sunfreeware.rb +0 -2
- data/lib/puppet/provider/package/up2date.rb +0 -1
- data/lib/puppet/provider/package/urpmi.rb +0 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package.rb +4 -3
- data/lib/puppet/provider/service/systemd.rb +64 -0
- data/lib/puppet/provider/service/windows.rb +110 -0
- data/lib/puppet/provider/user/windows_adsi.rb +71 -0
- data/lib/puppet/rails/resource.rb +1 -1
- data/lib/puppet/relationship.rb +0 -3
- data/lib/puppet/reports/tagmail.rb +15 -11
- data/lib/puppet/resource/catalog.rb +17 -24
- data/lib/puppet/ssl/certificate_authority.rb +7 -5
- data/lib/puppet/ssl/host.rb +6 -10
- data/lib/puppet/type/augeas.rb +19 -13
- data/lib/puppet/type/cron.rb +13 -12
- data/lib/puppet/type/exec.rb +17 -17
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/source.rb +14 -9
- data/lib/puppet/type/file.rb +44 -23
- data/lib/puppet/type/filebucket.rb +13 -5
- data/lib/puppet/type/package.rb +14 -1
- data/lib/puppet/type/service.rb +11 -1
- data/lib/puppet/type/ssh_authorized_key.rb +3 -1
- data/lib/puppet/type.rb +8 -17
- data/lib/puppet/util/adsi.rb +278 -0
- data/lib/puppet/util/autoload.rb +0 -2
- data/lib/puppet/util/cacher.rb +15 -67
- data/lib/puppet/util/feature.rb +0 -3
- data/lib/puppet/util/graph.rb +0 -3
- data/lib/puppet/util/ldap/connection.rb +0 -3
- data/lib/puppet/util/ldap/generator.rb +0 -3
- data/lib/puppet/util/ldap.rb +0 -3
- data/lib/puppet/util/log_paths.rb +0 -3
- data/lib/puppet/util/network_device/cisco/device.rb +2 -1
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/pidlock.rb +5 -1
- data/lib/puppet/util/rdoc/parser.rb +3 -1
- data/lib/puppet/util/run_mode.rb +2 -2
- data/lib/puppet/util/settings/file_setting.rb +3 -2
- data/lib/puppet/util/settings.rb +4 -6
- data/lib/puppet/util/suidmanager.rb +62 -15
- data/lib/puppet/util.rb +113 -131
- data/lib/puppet.rb +1 -1
- data/spec/integration/application/doc_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +22 -17
- data/spec/integration/file_serving/content_spec.rb +0 -6
- data/spec/integration/file_serving/metadata_spec.rb +0 -6
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/integration/indirector/direct_file_server_spec.rb +5 -7
- data/spec/integration/indirector/file_content/file_server_spec.rb +2 -6
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -5
- data/spec/integration/network/server/webrick_spec.rb +6 -9
- data/spec/integration/node/facts_spec.rb +0 -6
- data/spec/integration/node_spec.rb +3 -4
- data/spec/integration/parser/compiler_spec.rb +2 -1
- data/spec/integration/parser/parser_spec.rb +2 -4
- data/spec/integration/provider/mount_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +13 -3
- data/spec/integration/provider/ssh_authorized_key_spec.rb +4 -4
- data/spec/integration/reports_spec.rb +0 -4
- data/spec/integration/resource/catalog_spec.rb +0 -5
- data/spec/integration/ssl/certificate_authority_spec.rb +6 -14
- data/spec/integration/ssl/certificate_request_spec.rb +10 -17
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +8 -13
- data/spec/integration/ssl/host_spec.rb +8 -14
- data/spec/integration/transaction/report_spec.rb +0 -5
- data/spec/integration/transaction_spec.rb +11 -13
- data/spec/integration/type/file_spec.rb +16 -16
- data/spec/integration/type/tidy_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +2 -2
- data/spec/integration/util_spec.rb +13 -0
- data/spec/lib/puppet_spec/files.rb +18 -10
- data/spec/shared_behaviours/file_server_terminus.rb +1 -5
- data/spec/shared_behaviours/file_serving.rb +0 -4
- data/spec/shared_behaviours/memory_terminus.rb +0 -4
- data/spec/shared_behaviours/path_parameters.rb +20 -18
- data/spec/shared_behaviours/store_configs_terminus.rb +21 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/agent_spec.rb +0 -4
- data/spec/unit/application/apply_spec.rb +8 -2
- data/spec/unit/application/certificate_spec.rb +2 -0
- data/spec/unit/application/device_spec.rb +8 -6
- data/spec/unit/application/inspect_spec.rb +2 -1
- data/spec/unit/application/master_spec.rb +7 -2
- data/spec/unit/application/queue_spec.rb +3 -4
- data/spec/unit/application/resource_spec.rb +26 -0
- data/spec/unit/application/secret_agent_spec.rb +3 -1
- data/spec/unit/application_spec.rb +4 -0
- data/spec/unit/configurer/downloader_spec.rb +4 -3
- data/spec/unit/configurer_spec.rb +11 -4
- data/spec/unit/daemon_spec.rb +3 -1
- data/spec/unit/face/ca_spec.rb +1 -1
- data/spec/unit/face/node_spec.rb +5 -1
- data/spec/unit/face/secret_agent_spec.rb +3 -1
- data/spec/unit/file_bucket/dipper_spec.rb +4 -4
- data/spec/unit/file_bucket/file_spec.rb +9 -3
- data/spec/unit/file_serving/configuration_spec.rb +26 -37
- data/spec/unit/file_serving/fileset_spec.rb +71 -55
- data/spec/unit/file_serving/indirection_hooks_spec.rb +0 -4
- data/spec/unit/file_serving/mount/file_spec.rb +163 -169
- data/spec/unit/file_serving/terminus_helper_spec.rb +0 -4
- data/spec/unit/indirector/catalog/compiler_spec.rb +0 -22
- data/spec/unit/indirector/catalog/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -5
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_status/file_spec.rb +1 -1
- data/spec/unit/indirector/direct_file_server_spec.rb +0 -4
- data/spec/unit/indirector/facts/facter_spec.rb +0 -4
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +3 -0
- data/spec/unit/indirector/facts/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -3
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_content/file_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_spec.rb +0 -4
- data/spec/unit/indirector/file_server_spec.rb +1 -5
- data/spec/unit/indirector/indirection_spec.rb +0 -4
- data/spec/unit/indirector/key/ca_spec.rb +0 -4
- data/spec/unit/indirector/key/file_spec.rb +0 -4
- data/spec/unit/indirector/node/store_configs_spec.rb +16 -0
- data/spec/unit/indirector/report/processor_spec.rb +0 -4
- data/spec/unit/indirector/resource/active_record_spec.rb +192 -0
- data/spec/unit/indirector/resource/ral_spec.rb +1 -1
- data/spec/unit/indirector/resource/store_configs_spec.rb +12 -0
- data/spec/unit/indirector/resource_type/parser_spec.rb +3 -3
- data/spec/unit/indirector/ssl_file_spec.rb +25 -6
- data/spec/unit/indirector/store_configs_spec.rb +8 -0
- data/spec/unit/indirector/yaml_spec.rb +14 -0
- data/spec/unit/module_spec.rb +2 -2
- data/spec/unit/network/handler/fileserver_spec.rb +5 -5
- data/spec/unit/network/http/mongrel_spec.rb +0 -4
- data/spec/unit/network/http/webrick_spec.rb +5 -9
- data/spec/unit/network/http_pool_spec.rb +4 -75
- data/spec/unit/network/http_spec.rb +0 -4
- data/spec/unit/network/server_spec.rb +0 -4
- data/spec/unit/node/environment_spec.rb +18 -31
- data/spec/unit/node/facts_spec.rb +0 -4
- data/spec/unit/node_spec.rb +1 -8
- data/spec/unit/other/selinux_spec.rb +3 -1
- data/spec/unit/parameter_spec.rb +0 -10
- data/spec/unit/parser/ast/collexpr_spec.rb +17 -13
- data/spec/unit/parser/collector_spec.rb +147 -263
- data/spec/unit/parser/compiler_spec.rb +3 -1
- data/spec/unit/parser/files_spec.rb +7 -4
- data/spec/unit/parser/functions/extlookup_spec.rb +6 -3
- data/spec/unit/parser/functions/sprintf_spec.rb +2 -1
- data/spec/unit/parser/type_loader_spec.rb +7 -7
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -0
- data/spec/unit/provider/exec/posix_spec.rb +102 -106
- data/spec/unit/provider/exec/shell_spec.rb +1 -1
- data/spec/unit/provider/exec/windows_spec.rb +119 -0
- data/spec/unit/provider/group/ldap_spec.rb +0 -4
- data/spec/unit/provider/group/windows_adsi_spec.rb +79 -0
- data/spec/unit/provider/ldap_spec.rb +0 -4
- data/spec/unit/provider/macauthorization_spec.rb +5 -0
- data/spec/unit/provider/mount/parsed_spec.rb +1 -5
- data/spec/unit/provider/package/msi_spec.rb +170 -0
- data/spec/unit/provider/service/redhat_spec.rb +2 -0
- data/spec/unit/provider/service/smf_spec.rb +3 -0
- data/spec/unit/provider/service/systemd_spec.rb +25 -0
- data/spec/unit/provider/service/windows_spec.rb +166 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/ldap_spec.rb +0 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +110 -0
- data/spec/unit/relationship_spec.rb +0 -4
- data/spec/unit/resource/catalog_spec.rb +37 -25
- data/spec/unit/resource/status_spec.rb +4 -2
- data/spec/unit/resource_spec.rb +5 -5
- data/spec/unit/simple_graph_spec.rb +0 -4
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -2
- data/spec/unit/ssl/host_spec.rb +12 -13
- data/spec/unit/ssl/inventory_spec.rb +2 -2
- data/spec/unit/sslcertificates/ca_spec.rb +6 -10
- data/spec/unit/transaction/event_manager_spec.rb +4 -2
- data/spec/unit/transaction/event_spec.rb +3 -1
- data/spec/unit/transaction/report_spec.rb +2 -6
- data/spec/unit/transaction/resource_harness_spec.rb +9 -5
- data/spec/unit/transaction_spec.rb +3 -1
- data/spec/unit/type/cron_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +80 -47
- data/spec/unit/type/file/checksum_spec.rb +9 -8
- data/spec/unit/type/file/content_spec.rb +2 -1
- data/spec/unit/type/file/selinux_spec.rb +10 -8
- data/spec/unit/type/file/source_spec.rb +18 -36
- data/spec/unit/type/file_spec.rb +170 -217
- data/spec/unit/type/group_spec.rb +1 -1
- data/spec/unit/type/mount_spec.rb +5 -5
- data/spec/unit/type/noop_metaparam_spec.rb +3 -1
- data/spec/unit/type/package_spec.rb +15 -3
- data/spec/unit/type/resources_spec.rb +2 -2
- data/spec/unit/type/service_spec.rb +19 -4
- data/spec/unit/type/ssh_authorized_key_spec.rb +10 -4
- data/spec/unit/type/tidy_spec.rb +3 -1
- data/spec/unit/type/user_spec.rb +1 -1
- data/spec/unit/type_spec.rb +29 -34
- data/spec/unit/util/adsi_spec.rb +202 -0
- data/spec/unit/util/autoload_spec.rb +23 -19
- data/spec/unit/util/backups_spec.rb +16 -13
- data/spec/unit/util/cacher_spec.rb +64 -141
- data/spec/unit/util/checksums_spec.rb +0 -4
- data/spec/unit/util/constant_inflector_spec.rb +0 -4
- data/spec/unit/util/execution_stub_spec.rb +1 -1
- data/spec/unit/util/ldap/connection_spec.rb +0 -4
- data/spec/unit/util/ldap/generator_spec.rb +0 -4
- data/spec/unit/util/ldap/manager_spec.rb +0 -4
- data/spec/unit/util/log_spec.rb +4 -2
- data/spec/unit/util/logging_spec.rb +2 -2
- data/spec/unit/util/nagios_maker_spec.rb +0 -4
- data/spec/unit/util/network_device/cisco/device_spec.rb +2 -1
- data/spec/unit/util/network_device/cisco/facts_spec.rb +3 -1
- data/spec/unit/util/network_device/config_spec.rb +5 -3
- data/spec/unit/util/rdoc/parser_spec.rb +7 -1
- data/spec/unit/util/run_mode_spec.rb +6 -2
- data/spec/unit/util/settings/file_setting_spec.rb +29 -2
- data/spec/unit/util/settings_spec.rb +28 -15
- data/spec/unit/util/storage_spec.rb +1 -1
- data/spec/unit/util/suidmanager_spec.rb +310 -0
- data/spec/unit/util/tagging_spec.rb +0 -4
- data/spec/unit/util_spec.rb +335 -0
- data/test/language/ast/variable.rb +0 -4
- data/test/lib/puppettest/support/resources.rb +0 -4
- data/test/lib/puppettest/testcase.rb +0 -4
- data/test/lib/puppettest.rb +0 -1
- data/test/network/handler/master.rb +0 -5
- data/test/network/server/webrick.rb +5 -22
- data/test/ral/manager/attributes.rb +0 -4
- data/test/ral/manager/instances.rb +0 -4
- data/test/ral/manager/manager.rb +0 -4
- data/test/ral/providers/cron/crontab.rb +1 -0
- data/test/ral/providers/service/base.rb +0 -4
- data/test/ral/type/filesources.rb +0 -1
- data/test/ral/type/resources.rb +0 -4
- data/test/util/utiltest.rb +0 -13
- metadata +36 -9
- data/spec/unit/network/client_spec.rb +0 -45
- data/test/puppet/tc_suidmanager.rb +0 -120
@@ -3,8 +3,17 @@ Puppet::Type.type(:exec).provide :shell, :parent => :posix do
|
|
3
3
|
|
4
4
|
confine :feature => :posix
|
5
5
|
|
6
|
-
desc
|
7
|
-
|
6
|
+
desc <<-EOT
|
7
|
+
Passes the provided command through `/bin/sh`; only available on
|
8
|
+
POSIX systems. This allows the use of shell globbing and built-ins, and
|
9
|
+
does not require that the path to a command be fully-qualified. Although
|
10
|
+
this can be more convenient than the `posix` provider, it also means that
|
11
|
+
you need to be more careful with escaping; as ever, with great power comes
|
12
|
+
etc. etc.
|
13
|
+
|
14
|
+
This provider closely resembles the behavior of the `exec` type
|
15
|
+
in Puppet 0.25.x.
|
16
|
+
EOT
|
8
17
|
|
9
18
|
def run(command, check = false)
|
10
19
|
command = %Q{/bin/sh -c "#{command.gsub(/"/,'\"')}"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'puppet/provider/exec'
|
2
|
+
|
3
|
+
Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do
|
4
|
+
include Puppet::Util::Execution
|
5
|
+
|
6
|
+
confine :feature => :microsoft_windows
|
7
|
+
defaultfor :feature => :microsoft_windows
|
8
|
+
|
9
|
+
desc "Execute external binaries directly, on Windows systems.
|
10
|
+
This does not pass through a shell, or perform any interpolation, but
|
11
|
+
only directly calls the command with the arguments given."
|
12
|
+
|
13
|
+
# Verify that we have the executable
|
14
|
+
def checkexe(command)
|
15
|
+
exe = extractexe(command)
|
16
|
+
|
17
|
+
if absolute_path?(exe)
|
18
|
+
if !File.exists?(exe)
|
19
|
+
raise ArgumentError, "Could not find command '#{exe}'"
|
20
|
+
elsif !File.file?(exe)
|
21
|
+
raise ArgumentError, "'#{exe}' is a #{File.ftype(exe)}, not a file"
|
22
|
+
end
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
26
|
+
path = resource[:path] || []
|
27
|
+
|
28
|
+
exts = [".exe", ".ps1", ".bat", ".com", ""]
|
29
|
+
withenv :PATH => path.join(File::PATH_SEPARATOR) do
|
30
|
+
return if exts.any? {|ext| which(exe + ext) }
|
31
|
+
end
|
32
|
+
|
33
|
+
raise ArgumentError, "Could not find command '#{exe}'"
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Puppet::Provider::Exec < Puppet::Provider
|
2
|
+
include Puppet::Util::Execution
|
3
|
+
|
4
|
+
def run(command, check = false)
|
5
|
+
output = nil
|
6
|
+
status = nil
|
7
|
+
dir = nil
|
8
|
+
|
9
|
+
checkexe(command)
|
10
|
+
|
11
|
+
if dir = resource[:cwd]
|
12
|
+
unless File.directory?(dir)
|
13
|
+
if check
|
14
|
+
dir = nil
|
15
|
+
else
|
16
|
+
self.fail "Working directory '#{dir}' does not exist"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
dir ||= Dir.pwd
|
22
|
+
|
23
|
+
debug "Executing#{check ? " check": ""} '#{command}'"
|
24
|
+
begin
|
25
|
+
# Do our chdir
|
26
|
+
Dir.chdir(dir) do
|
27
|
+
environment = {}
|
28
|
+
|
29
|
+
environment[:PATH] = resource[:path].join(File::PATH_SEPARATOR) if resource[:path]
|
30
|
+
|
31
|
+
if envlist = resource[:environment]
|
32
|
+
envlist = [envlist] unless envlist.is_a? Array
|
33
|
+
envlist.each do |setting|
|
34
|
+
if setting =~ /^(\w+)=((.|\n)+)$/
|
35
|
+
env_name = $1
|
36
|
+
value = $2
|
37
|
+
if environment.include?(env_name) || environment.include?(env_name.to_sym)
|
38
|
+
warning "Overriding environment setting '#{env_name}' with '#{value}'"
|
39
|
+
end
|
40
|
+
environment[env_name] = value
|
41
|
+
else
|
42
|
+
warning "Cannot understand environment setting #{setting.inspect}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
withenv environment do
|
48
|
+
Timeout::timeout(resource[:timeout]) do
|
49
|
+
output, status = Puppet::Util::SUIDManager.
|
50
|
+
run_and_capture(command, resource[:user], resource[:group])
|
51
|
+
end
|
52
|
+
# The shell returns 127 if the command is missing.
|
53
|
+
if status.exitstatus == 127
|
54
|
+
raise ArgumentError, output
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
rescue Errno::ENOENT => detail
|
59
|
+
self.fail detail.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
return output, status
|
63
|
+
end
|
64
|
+
|
65
|
+
def extractexe(command)
|
66
|
+
# easy case: command was quoted
|
67
|
+
if command =~ /^"([^"]+)"/
|
68
|
+
$1
|
69
|
+
else
|
70
|
+
command.split(/ /)[0]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def validatecmd(command)
|
75
|
+
exe = extractexe(command)
|
76
|
+
# if we're not fully qualified, require a path
|
77
|
+
self.fail "'#{command}' is not qualified and no path was specified. Please qualify the command or specify a path." if !absolute_path?(exe) and resource[:path].nil?
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'puppet/util/adsi'
|
2
|
+
|
3
|
+
Puppet::Type.type(:group).provide :windows_adsi do
|
4
|
+
desc "Group management for Windows"
|
5
|
+
|
6
|
+
defaultfor :operatingsystem => :windows
|
7
|
+
confine :operatingsystem => :windows
|
8
|
+
confine :feature => :microsoft_windows
|
9
|
+
|
10
|
+
has_features :manages_members
|
11
|
+
|
12
|
+
def group
|
13
|
+
@group ||= Puppet::Util::ADSI::Group.new(@resource[:name])
|
14
|
+
end
|
15
|
+
|
16
|
+
def members
|
17
|
+
group.members
|
18
|
+
end
|
19
|
+
|
20
|
+
def members=(members)
|
21
|
+
group.set_members(members)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
@group = Puppet::Util::ADSI::Group.create(@resource[:name])
|
26
|
+
self.members = @resource[:members]
|
27
|
+
end
|
28
|
+
|
29
|
+
def exists?
|
30
|
+
Puppet::Util::ADSI::Group.exists?(@resource[:name])
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete
|
34
|
+
Puppet::Util::ADSI::Group.delete(@resource[:name])
|
35
|
+
end
|
36
|
+
|
37
|
+
def gid
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def gid=(value)
|
42
|
+
warning "No support for managing property gid of group #{@resource[:name]} on Windows"
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.instances
|
46
|
+
Puppet::Util::ADSI::Group.map { |g| new(:ensure => :present, :name => g.name) }
|
47
|
+
end
|
48
|
+
end
|
@@ -14,13 +14,13 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe
|
|
14
14
|
|
15
15
|
confine :operatingsystem => :darwin
|
16
16
|
|
17
|
-
# This should be confined based on macosx_productversion
|
18
|
-
#
|
19
|
-
# is
|
17
|
+
# This should be confined based on macosx_productversion
|
18
|
+
# but puppet resource doesn't make the facts available and
|
19
|
+
# that interface is heavily used with this provider.
|
20
20
|
if FileTest.exists?("/usr/bin/sw_vers")
|
21
21
|
product_version = sw_vers "-productVersion"
|
22
22
|
|
23
|
-
confine :true =>
|
23
|
+
confine :true => unless /^10\.[0-4]/.match(product_version)
|
24
24
|
true
|
25
25
|
end
|
26
26
|
end
|
@@ -13,13 +13,10 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
|
|
13
13
|
|
14
14
|
def self.instances
|
15
15
|
instance_by_name.collect do |name|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
:name => name,
|
16
|
+
self.new(
|
17
|
+
:name => name,
|
20
18
|
:provider => :apple,
|
21
|
-
|
22
|
-
:ensure => :installed
|
19
|
+
:ensure => :installed
|
23
20
|
)
|
24
21
|
end
|
25
22
|
end
|
@@ -48,4 +45,3 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
|
|
48
45
|
installer "-pkg", source, "-target", "/"
|
49
46
|
end
|
50
47
|
end
|
51
|
-
|
@@ -102,16 +102,15 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
102
102
|
|
103
103
|
# list out our specific package
|
104
104
|
begin
|
105
|
-
|
106
|
-
|
107
|
-
"
|
108
|
-
|
109
|
-
|
105
|
+
output = dpkgquery(
|
106
|
+
"-W",
|
107
|
+
"--showformat",
|
108
|
+
'${Status} ${Package} ${Version}\\n',
|
109
|
+
@resource[:name]
|
110
110
|
)
|
111
111
|
rescue Puppet::ExecutionFailure
|
112
112
|
# dpkg-query exits 1 if the package is not found.
|
113
113
|
return {:ensure => :purged, :status => 'missing', :name => @resource[:name], :error => 'ok'}
|
114
|
-
|
115
114
|
end
|
116
115
|
|
117
116
|
hash = self.class.parse_line(output) || {:ensure => :absent, :status => 'missing', :name => @resource[:name], :error => 'ok'}
|
@@ -48,11 +48,11 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
|
|
48
48
|
|
49
49
|
if output =~ /Candidate:\s+(\S+)\s/
|
50
50
|
return $1
|
51
|
-
|
51
|
+
else
|
52
52
|
self.err "Could not find latest version"
|
53
53
|
return nil
|
54
|
-
|
55
|
-
|
54
|
+
end
|
55
|
+
end
|
56
56
|
|
57
57
|
#
|
58
58
|
# preseeds answers to dpkg-set-selection from the "responsefile"
|
@@ -79,4 +79,3 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
|
|
79
79
|
aptget '-y', '-q', 'remove', '--purge', @resource[:name]
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
@@ -27,10 +27,10 @@ Puppet::Type.type(:package).provide :hpux, :parent => Puppet::Provider::Package
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def query
|
30
|
-
|
31
|
-
|
30
|
+
swlist resource[:name]
|
31
|
+
{:ensure => :present}
|
32
32
|
rescue
|
33
|
-
|
33
|
+
{:ensure => :absent}
|
34
34
|
end
|
35
35
|
|
36
36
|
def uninstall
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'puppet/provider/package'
|
2
|
+
|
3
|
+
Puppet::Type.type(:package).provide(:msi, :parent => Puppet::Provider::Package) do
|
4
|
+
desc "Package management by installing and removing MSIs."
|
5
|
+
|
6
|
+
confine :operatingsystem => :windows
|
7
|
+
defaultfor :operatingsystem => :windows
|
8
|
+
|
9
|
+
has_feature :install_options
|
10
|
+
|
11
|
+
# This is just here to make sure we can find it, and fail if we
|
12
|
+
# can't. Unfortunately, we need to do "special" quoting of the
|
13
|
+
# install options or msiexec.exe won't know what to do with them, if
|
14
|
+
# the value contains a space.
|
15
|
+
commands :msiexec => "msiexec.exe"
|
16
|
+
|
17
|
+
def self.instances
|
18
|
+
Dir.entries(installed_listing_dir).reject {|d| d == '.' or d == '..'}.collect do |name|
|
19
|
+
new(:name => File.basename(name, '.yml'), :provider => :msi, :ensure => :installed)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def query
|
24
|
+
{:name => resource[:name], :ensure => :installed} if FileTest.exists?(state_file)
|
25
|
+
end
|
26
|
+
|
27
|
+
def install
|
28
|
+
properties_for_command = nil
|
29
|
+
if resource[:install_options]
|
30
|
+
properties_for_command = resource[:install_options].collect do |k,v|
|
31
|
+
property = shell_quote k
|
32
|
+
value = shell_quote v
|
33
|
+
|
34
|
+
"#{property}=#{value}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Unfortunately, we can't use the msiexec method defined earlier,
|
39
|
+
# because of the special quoting we need to do around the MSI
|
40
|
+
# properties to use.
|
41
|
+
execute ['msiexec.exe', '/qn', '/norestart', '/i', shell_quote(resource[:source]), properties_for_command].flatten.compact.join(' ')
|
42
|
+
|
43
|
+
File.open(state_file, 'w') do |f|
|
44
|
+
metadata = {
|
45
|
+
'name' => resource[:name],
|
46
|
+
'install_options' => resource[:install_options],
|
47
|
+
'source' => resource[:source]
|
48
|
+
}
|
49
|
+
|
50
|
+
f.puts(YAML.dump metadata)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def uninstall
|
55
|
+
msiexec '/qn', '/norestart', '/x', resource[:source]
|
56
|
+
|
57
|
+
File.delete state_file
|
58
|
+
end
|
59
|
+
|
60
|
+
def validate_source(value)
|
61
|
+
fail("The source parameter is required when using the MSI provider.") if value.nil?
|
62
|
+
fail("The source parameter cannot be empty when using the MSI provider.") if value.empty?
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def self.installed_listing_dir
|
68
|
+
listing_dir = File.join(Puppet[:vardir], 'db', 'package', 'msi')
|
69
|
+
|
70
|
+
FileUtils.mkdir_p listing_dir unless File.directory? listing_dir
|
71
|
+
|
72
|
+
listing_dir
|
73
|
+
end
|
74
|
+
|
75
|
+
def state_file
|
76
|
+
File.join(self.class.installed_listing_dir, "#{resource[:name]}.yml")
|
77
|
+
end
|
78
|
+
|
79
|
+
def shell_quote(value)
|
80
|
+
value.include?(' ') ? %Q["#{value.gsub(/"/, '\"')}"] : value
|
81
|
+
end
|
82
|
+
end
|
@@ -72,27 +72,27 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def get_version
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
75
|
+
execpipe([command(:pkginfo), " -I ", @resource[:name]]) do |process|
|
76
|
+
# our regex for matching pkg_info output
|
77
|
+
regex = /^(.*)-(\d[^-]*)[-]?(\D*)(.*)$/
|
78
|
+
fields = [ :name, :version, :flavor ]
|
79
|
+
master_version = 0
|
80
|
+
|
81
|
+
process.each do |line|
|
82
|
+
if match = regex.match(line.split[0])
|
83
|
+
# now we return the first version, unless ensure is latest
|
84
|
+
version = match.captures[1]
|
85
|
+
return version unless @resource[:ensure] == "latest"
|
86
|
+
|
87
|
+
master_version = version unless master_version > version
|
89
88
|
end
|
90
|
-
|
91
|
-
return master_version unless master_version == 0
|
92
|
-
raise Puppet::Error, "#{version} is not available for this package"
|
93
89
|
end
|
90
|
+
|
91
|
+
return master_version unless master_version == 0
|
92
|
+
raise Puppet::Error, "#{version} is not available for this package"
|
93
|
+
end
|
94
94
|
rescue Puppet::ExecutionFailure
|
95
|
-
|
95
|
+
return nil
|
96
96
|
end
|
97
97
|
|
98
98
|
def query
|
@@ -113,4 +113,3 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
|
|
113
113
|
pkgdelete @resource[:name]
|
114
114
|
end
|
115
115
|
end
|
116
|
-
|
@@ -12,7 +12,13 @@ require 'puppet/provider/package'
|
|
12
12
|
require 'facter/util/plist'
|
13
13
|
|
14
14
|
Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do
|
15
|
-
desc "Package management based on Apple's Installer.app and
|
15
|
+
desc "Package management based on Apple's Installer.app and
|
16
|
+
DiskUtility.app. This package works by checking the contents of a
|
17
|
+
DMG image for Apple pkg or mpkg files. Any number of pkg or mpkg
|
18
|
+
files may exist in the root directory of the DMG file system. Sub
|
19
|
+
directories are not checked for packages. See `the wiki docs
|
20
|
+
<http://projects.puppetlabs.com/projects/puppet/wiki/Package_Management_With_Dmg_Patterns>`
|
21
|
+
for more detail."
|
16
22
|
|
17
23
|
confine :operatingsystem => :darwin
|
18
24
|
defaultfor :operatingsystem => :darwin
|
@@ -33,13 +39,10 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
33
39
|
|
34
40
|
def self.instances
|
35
41
|
instance_by_name.collect do |name|
|
36
|
-
|
37
42
|
new(
|
38
|
-
|
39
|
-
:name => name,
|
43
|
+
:name => name,
|
40
44
|
:provider => :pkgdmg,
|
41
|
-
|
42
|
-
:ensure => :installed
|
45
|
+
:ensure => :installed
|
43
46
|
)
|
44
47
|
end
|
45
48
|
end
|
@@ -124,4 +127,3 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
124
127
|
self.class.installpkgdmg(source,name)
|
125
128
|
end
|
126
129
|
end
|
127
|
-
|