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
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'puppet/util/adsi'
|
2
|
+
|
3
|
+
Puppet::Type.type(:user).provide :windows_adsi do
|
4
|
+
desc "User management for Windows"
|
5
|
+
|
6
|
+
defaultfor :operatingsystem => :windows
|
7
|
+
confine :operatingsystem => :windows
|
8
|
+
confine :feature => :microsoft_windows
|
9
|
+
|
10
|
+
has_features :manages_homedir
|
11
|
+
|
12
|
+
def user
|
13
|
+
@user ||= Puppet::Util::ADSI::User.new(@resource[:name])
|
14
|
+
end
|
15
|
+
|
16
|
+
def groups
|
17
|
+
user.groups.join(',')
|
18
|
+
end
|
19
|
+
|
20
|
+
def groups=(groups)
|
21
|
+
user.set_groups(groups, @resource[:membership] == :minimum)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
@user = Puppet::Util::ADSI::User.create(@resource[:name])
|
26
|
+
[:comment, :home, :groups].each do |prop|
|
27
|
+
send("#{prop}=", @resource[prop]) if @resource[prop]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def exists?
|
32
|
+
Puppet::Util::ADSI::User.exists?(@resource[:name])
|
33
|
+
end
|
34
|
+
|
35
|
+
def delete
|
36
|
+
Puppet::Util::ADSI::User.delete(@resource[:name])
|
37
|
+
end
|
38
|
+
|
39
|
+
# Only flush if we created or modified a user, not deleted
|
40
|
+
def flush
|
41
|
+
@user.commit if @user
|
42
|
+
end
|
43
|
+
|
44
|
+
def comment
|
45
|
+
user['Description']
|
46
|
+
end
|
47
|
+
|
48
|
+
def comment=(value)
|
49
|
+
user['Description'] = value
|
50
|
+
end
|
51
|
+
|
52
|
+
def home
|
53
|
+
user['HomeDirectory']
|
54
|
+
end
|
55
|
+
|
56
|
+
def home=(value)
|
57
|
+
user['HomeDirectory'] = value
|
58
|
+
end
|
59
|
+
|
60
|
+
[:uid, :gid, :shell].each do |prop|
|
61
|
+
define_method(prop) { nil }
|
62
|
+
|
63
|
+
define_method("#{prop}=") do |v|
|
64
|
+
warning "No support for managing property #{prop} of user #{@resource[:name]} on Windows"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.instances
|
69
|
+
Puppet::Util::ADSI::User.map { |u| new(:ensure => :present, :name => u.name) }
|
70
|
+
end
|
71
|
+
end
|
@@ -224,7 +224,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
|
|
224
224
|
obj = Puppet::Parser::Resource.new(hash.delete("type"), hash.delete("title"), hash)
|
225
225
|
|
226
226
|
# Store the ID, so we can check if we're re-collecting the same resource.
|
227
|
-
obj.
|
227
|
+
obj.collector_id = self.id
|
228
228
|
|
229
229
|
obj
|
230
230
|
end
|
data/lib/puppet/relationship.rb
CHANGED
@@ -8,21 +8,24 @@ Puppet::Reports.register_report(:tagmail) do
|
|
8
8
|
desc "This report sends specific log messages to specific email addresses
|
9
9
|
based on the tags in the log messages.
|
10
10
|
|
11
|
-
See the [
|
11
|
+
See the [documentation on tags](http://projects.puppetlabs.com/projects/puppet/wiki/Using_Tags) for more information.
|
12
12
|
|
13
|
-
To use this report, you must create a `tagmail.conf`
|
14
|
-
specified by `tagmap`
|
13
|
+
To use this report, you must create a `tagmail.conf` file in the location
|
14
|
+
specified by the `tagmap` setting. This is a simple file that maps tags to
|
15
15
|
email addresses: Any log messages in the report that match the specified
|
16
16
|
tags will be sent to the specified email addresses.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
Lines in the `tagmail.conf` file consist of a comma-separated list
|
19
|
+
of tags, a colon, and a comma-separated list of email addresses.
|
20
|
+
Tags can be !negated with a leading exclamation mark, which will
|
21
|
+
subtract any messages with that tag from the set of events handled
|
22
|
+
by that line.
|
22
23
|
|
23
|
-
|
24
|
+
Puppet's log levels (`debug`, `info`, `notice`, `warning`, `err`,
|
25
|
+
`alert`, `emerg`, `crit`, and `verbose`) can also be used as tags,
|
26
|
+
and there is an `all` tag that will always match all log messages.
|
24
27
|
|
25
|
-
|
28
|
+
An example `tagmail.conf`:
|
26
29
|
|
27
30
|
all: me@domain.com
|
28
31
|
webserver, !mailserver: httpadmins@domain.com
|
@@ -30,8 +33,9 @@ Puppet::Reports.register_report(:tagmail) do
|
|
30
33
|
This will send all messages to `me@domain.com`, and all messages from
|
31
34
|
webservers that are not also from mailservers to `httpadmins@domain.com`.
|
32
35
|
|
33
|
-
If you are using anti-spam controls
|
34
|
-
server you should whitelist the sending email (controlled by
|
36
|
+
If you are using anti-spam controls such as grey-listing on your mail
|
37
|
+
server, you should whitelist the sending email address (controlled by
|
38
|
+
`reportform` configuration option) to ensure your email is not discarded as spam.
|
35
39
|
"
|
36
40
|
|
37
41
|
# Find all matching messages.
|
@@ -3,7 +3,6 @@ require 'puppet/indirector'
|
|
3
3
|
require 'puppet/simple_graph'
|
4
4
|
require 'puppet/transaction'
|
5
5
|
|
6
|
-
require 'puppet/util/cacher'
|
7
6
|
require 'puppet/util/pson'
|
8
7
|
|
9
8
|
require 'puppet/util/tagging'
|
@@ -20,7 +19,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
20
19
|
|
21
20
|
include Puppet::Util::Tagging
|
22
21
|
extend Puppet::Util::Pson
|
23
|
-
include Puppet::Util::Cacher::Expirer
|
24
22
|
|
25
23
|
# The host name this is a catalog for.
|
26
24
|
attr_accessor :name
|
@@ -126,10 +124,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
126
124
|
def apply(options = {})
|
127
125
|
@applying = true
|
128
126
|
|
129
|
-
# Expire all of the resource data -- this ensures that all
|
130
|
-
# data we're operating against is entirely current.
|
131
|
-
expire
|
132
|
-
|
133
127
|
Puppet::Util::Storage.load if host_config?
|
134
128
|
|
135
129
|
transaction = Puppet::Transaction.new(self, options[:report])
|
@@ -165,7 +159,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
165
159
|
return transaction
|
166
160
|
ensure
|
167
161
|
@applying = false
|
168
|
-
cleanup
|
169
162
|
end
|
170
163
|
|
171
164
|
# Are we in the middle of applying the catalog?
|
@@ -200,14 +193,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
200
193
|
resource
|
201
194
|
end
|
202
195
|
|
203
|
-
def dependent_data_expired?(ts)
|
204
|
-
if applying?
|
205
|
-
return super
|
206
|
-
else
|
207
|
-
return true
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
196
|
# Turn our catalog graph into an old-style tree of TransObjects and TransBuckets.
|
212
197
|
# LAK:NOTE(20081211): This is a pre-0.25 backward compatibility method.
|
213
198
|
# It can be removed as soon as xmlrpc is killed.
|
@@ -550,11 +535,24 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
550
535
|
|
551
536
|
# Store the classes in the classfile.
|
552
537
|
def write_class_file
|
553
|
-
|
554
|
-
|
555
|
-
|
538
|
+
::File.open(Puppet[:classfile], "w") do |f|
|
539
|
+
f.puts classes.join("\n")
|
540
|
+
end
|
556
541
|
rescue => detail
|
557
|
-
|
542
|
+
Puppet.err "Could not create class file #{Puppet[:classfile]}: #{detail}"
|
543
|
+
end
|
544
|
+
|
545
|
+
# Store the list of resources we manage
|
546
|
+
def write_resource_file
|
547
|
+
::File.open(Puppet[:resourcefile], "w") do |f|
|
548
|
+
to_print = resources.map do |resource|
|
549
|
+
next if resource.type == :component
|
550
|
+
"#{resource.type}[#{resource[resource.name_var]}]"
|
551
|
+
end.compact
|
552
|
+
f.puts to_print.join("\n")
|
553
|
+
end
|
554
|
+
rescue => detail
|
555
|
+
Puppet.err "Could not create resource file #{Puppet[:resourcefile]}: #{detail}"
|
558
556
|
end
|
559
557
|
|
560
558
|
# Produce the graph files if requested.
|
@@ -567,11 +565,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
567
565
|
|
568
566
|
private
|
569
567
|
|
570
|
-
def cleanup
|
571
|
-
# Expire any cached data the resources are keeping.
|
572
|
-
expire
|
573
|
-
end
|
574
|
-
|
575
568
|
# Verify that the given resource isn't defined elsewhere.
|
576
569
|
def fail_on_duplicate_type_and_title(resource)
|
577
570
|
# Short-curcuit the common case,
|
@@ -1,6 +1,6 @@
|
|
1
|
+
require 'monitor'
|
1
2
|
require 'puppet/ssl/host'
|
2
3
|
require 'puppet/ssl/certificate_request'
|
3
|
-
require 'puppet/util/cacher'
|
4
4
|
|
5
5
|
# The class that knows how to sign certificates. It creates
|
6
6
|
# a 'special' SSL::Host whose name is 'ca', thus indicating
|
@@ -17,6 +17,8 @@ class Puppet::SSL::CertificateAuthority
|
|
17
17
|
require 'puppet/ssl/certificate_authority/interface'
|
18
18
|
require 'puppet/network/authstore'
|
19
19
|
|
20
|
+
extend MonitorMixin
|
21
|
+
|
20
22
|
class CertificateVerificationError < RuntimeError
|
21
23
|
attr_accessor :error_code
|
22
24
|
|
@@ -25,10 +27,10 @@ class Puppet::SSL::CertificateAuthority
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def self.singleton_instance
|
31
|
+
synchronize do
|
32
|
+
@singleton_instance ||= new
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def self.ca?
|
data/lib/puppet/ssl/host.rb
CHANGED
@@ -4,7 +4,6 @@ require 'puppet/ssl/key'
|
|
4
4
|
require 'puppet/ssl/certificate'
|
5
5
|
require 'puppet/ssl/certificate_request'
|
6
6
|
require 'puppet/ssl/certificate_revocation_list'
|
7
|
-
require 'puppet/util/cacher'
|
8
7
|
|
9
8
|
# The class that manages all aspects of our SSL certificates --
|
10
9
|
# private keys, public keys, requests, etc.
|
@@ -27,15 +26,12 @@ class Puppet::SSL::Host
|
|
27
26
|
# This accessor is used in instances for indirector requests to hold desired state
|
28
27
|
attr_accessor :desired_state
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
result.key # Make sure it's read in
|
37
|
-
result
|
38
|
-
end
|
29
|
+
def self.localhost
|
30
|
+
return @localhost if @localhost
|
31
|
+
@localhost = new
|
32
|
+
@localhost.generate unless @localhost.certificate
|
33
|
+
@localhost.key
|
34
|
+
@localhost
|
39
35
|
end
|
40
36
|
|
41
37
|
# This is the constant that people will use to mark that a given host is
|
data/lib/puppet/type/augeas.rb
CHANGED
@@ -20,7 +20,8 @@ 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 =
|
23
|
+
@doc = <<-EOT
|
24
|
+
Apply the changes (single or array of changes) to the filesystem
|
24
25
|
via the augeas tool.
|
25
26
|
|
26
27
|
Requires:
|
@@ -30,24 +31,24 @@ Puppet::Type.newtype(:augeas) do
|
|
30
31
|
|
31
32
|
Sample usage with a string:
|
32
33
|
|
33
|
-
augeas{
|
34
|
-
context =>
|
35
|
-
changes =>
|
36
|
-
onlyif =>
|
34
|
+
augeas{"test1" :
|
35
|
+
context => "/files/etc/sysconfig/firstboot",
|
36
|
+
changes => "set RUN_FIRSTBOOT YES",
|
37
|
+
onlyif => "match other_value size > 0",
|
37
38
|
}
|
38
39
|
|
39
40
|
Sample usage with an array and custom lenses:
|
40
41
|
|
41
|
-
augeas{
|
42
|
-
context =>
|
42
|
+
augeas{"jboss_conf":
|
43
|
+
context => "/files",
|
43
44
|
changes => [
|
44
|
-
|
45
|
-
|
45
|
+
"set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress",
|
46
|
+
"set etc/jbossas/jbossas.conf/JAVA_HOME /usr",
|
46
47
|
],
|
47
|
-
load_path =>
|
48
|
+
load_path => "$/usr/share/jbossas/lenses",
|
48
49
|
}
|
49
50
|
|
50
|
-
|
51
|
+
EOT
|
51
52
|
|
52
53
|
newparam (:name) do
|
53
54
|
desc "The name of this task. Used for uniqueness"
|
@@ -95,13 +96,18 @@ Puppet::Type.newtype(:augeas) do
|
|
95
96
|
Commands supported are:
|
96
97
|
|
97
98
|
set [PATH] [VALUE] Sets the value VALUE at loction PATH
|
99
|
+
setm [PATH] [SUB] [VALUE] Sets multiple nodes matching SUB relative to PATH, to VALUE
|
98
100
|
rm [PATH] Removes the node at location PATH
|
99
101
|
remove [PATH] Synonym for rm
|
100
|
-
clear [PATH]
|
102
|
+
clear [PATH] Sets the node at PATH to NULL, creating it if needed
|
101
103
|
ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH.
|
102
104
|
insert [LABEL] [WHERE] [PATH] Synonym for ins
|
105
|
+
mv [PATH] [PATH] Moves a node at PATH to the new location PATH
|
106
|
+
move [PATH] [PATH] Synonym for mv
|
107
|
+
defvar [NAME] [PATH] Sets Augeas variable $NAME to PATH
|
108
|
+
defnode [NAME] [PATH] [VALUE] Sets Augeas variable $NAME to PATH, creating it with VALUE if needed
|
103
109
|
|
104
|
-
If the parameter 'context' is set that value is prepended to PATH"
|
110
|
+
If the parameter 'context' is set that value is prepended to a relative PATH"
|
105
111
|
end
|
106
112
|
|
107
113
|
|
data/lib/puppet/type/cron.rb
CHANGED
@@ -3,11 +3,12 @@ require 'facter'
|
|
3
3
|
require 'puppet/util/filetype'
|
4
4
|
|
5
5
|
Puppet::Type.newtype(:cron) do
|
6
|
-
@doc =
|
7
|
-
and
|
8
|
-
|
9
|
-
minute. While the name of the cron
|
10
|
-
job, it is used by Puppet to store and
|
6
|
+
@doc = <<-EOT
|
7
|
+
Installs and manages cron jobs. Every cron resource requires a command
|
8
|
+
and user attribute, as well as at least one periodic attribute (hour,
|
9
|
+
minute, month, monthday, weekday, or special). While the name of the cron
|
10
|
+
job is not part of the actual job, it is used by Puppet to store and
|
11
|
+
retrieve it.
|
11
12
|
|
12
13
|
If you specify a cron job that matches an existing job in every way
|
13
14
|
except name, then the jobs will be considered equivalent and the
|
@@ -18,30 +19,30 @@ Puppet::Type.newtype(:cron) do
|
|
18
19
|
Example:
|
19
20
|
|
20
21
|
cron { logrotate:
|
21
|
-
command =>
|
22
|
+
command => "/usr/sbin/logrotate",
|
22
23
|
user => root,
|
23
24
|
hour => 2,
|
24
25
|
minute => 0
|
25
26
|
}
|
26
27
|
|
27
|
-
Note that all
|
28
|
+
Note that all periodic attributes can be specified as an array of values:
|
28
29
|
|
29
30
|
cron { logrotate:
|
30
|
-
command =>
|
31
|
+
command => "/usr/sbin/logrotate",
|
31
32
|
user => root,
|
32
33
|
hour => [2, 4]
|
33
34
|
}
|
34
35
|
|
35
|
-
|
36
|
-
your `cron` daemon supports
|
36
|
+
...or using ranges or the step syntax `*/2` (although there's no guarantee
|
37
|
+
that your `cron` daemon supports these):
|
37
38
|
|
38
39
|
cron { logrotate:
|
39
|
-
command =>
|
40
|
+
command => "/usr/sbin/logrotate",
|
40
41
|
user => root,
|
41
42
|
hour => ['2-4'],
|
42
43
|
minute => '*/10'
|
43
44
|
}
|
44
|
-
|
45
|
+
EOT
|
45
46
|
ensurable
|
46
47
|
|
47
48
|
# A base class for all of the Cron parameters, since they all have
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -139,18 +139,12 @@ module Puppet
|
|
139
139
|
newparam(:path) do
|
140
140
|
desc "The search path used for command execution.
|
141
141
|
Commands must be fully qualified if no path is specified. Paths
|
142
|
-
can be specified as an array or as a
|
142
|
+
can be specified as an array or as a '#{File::PATH_SEPARATOR}' separated list."
|
143
143
|
|
144
144
|
# Support both arrays and colon-separated fields.
|
145
145
|
def value=(*values)
|
146
146
|
@value = values.flatten.collect { |val|
|
147
|
-
|
148
|
-
val.split(";")
|
149
|
-
elsif val =~ /^\w:[^:]*$/ # heuristic to avoid splitting a driveletter away
|
150
|
-
val
|
151
|
-
else
|
152
|
-
val.split(":")
|
153
|
-
end
|
147
|
+
val.split(File::PATH_SEPARATOR)
|
154
148
|
}.flatten
|
155
149
|
end
|
156
150
|
end
|
@@ -165,6 +159,7 @@ module Puppet
|
|
165
159
|
# Most validation is handled by the SUIDManager class.
|
166
160
|
validate do |user|
|
167
161
|
self.fail "Only root can execute commands as other users" unless Puppet.features.root?
|
162
|
+
self.fail "Unable to execute commands as other users on Windows" if Puppet.features.microsoft_windows?
|
168
163
|
end
|
169
164
|
end
|
170
165
|
|
@@ -311,17 +306,20 @@ module Puppet
|
|
311
306
|
end
|
312
307
|
|
313
308
|
newcheck(:creates, :parent => Puppet::Parameter::Path) do
|
314
|
-
desc
|
309
|
+
desc <<-EOT
|
310
|
+
A file that this command creates. If this
|
315
311
|
parameter is provided, then the command will only be run
|
316
|
-
if the specified file does not exist
|
312
|
+
if the specified file does not exist.
|
317
313
|
|
318
|
-
exec {
|
319
|
-
cwd =>
|
320
|
-
creates =>
|
321
|
-
path => [
|
314
|
+
exec { "tar -xf /Volumes/nfs02/important.tar":
|
315
|
+
cwd => "/var/tmp",
|
316
|
+
creates => "/var/tmp/myfile",
|
317
|
+
path => ["/usr/bin", "/usr/sbin"]
|
322
318
|
}
|
323
319
|
|
324
|
-
|
320
|
+
In this example, if `/var/tmp/myfile` is ever deleted, the exec
|
321
|
+
will bring it back by re-extracting the tarball.
|
322
|
+
EOT
|
325
323
|
|
326
324
|
accept_arrays
|
327
325
|
|
@@ -425,7 +423,9 @@ module Puppet
|
|
425
423
|
# Stick the cwd in there if we have it
|
426
424
|
reqs << self[:cwd] if self[:cwd]
|
427
425
|
|
428
|
-
|
426
|
+
file_regex = Puppet.features.microsoft_windows? ? %r{^([a-zA-Z]:[\\/]\S+)} : %r{^(/\S+)}
|
427
|
+
|
428
|
+
self[:command].scan(file_regex) { |str|
|
429
429
|
reqs << str
|
430
430
|
}
|
431
431
|
|
@@ -444,7 +444,7 @@ module Puppet
|
|
444
444
|
# fully qualified. It might not be a bad idea to add
|
445
445
|
# unqualified files, but, well, that's a bit more annoying
|
446
446
|
# to do.
|
447
|
-
reqs += line.scan(
|
447
|
+
reqs += line.scan(file_regex)
|
448
448
|
end
|
449
449
|
}
|
450
450
|
|
@@ -16,8 +16,10 @@ module Puppet
|
|
16
16
|
attr_reader :actual_content
|
17
17
|
|
18
18
|
desc "Specify the contents of a file as a string. Newlines, tabs, and
|
19
|
-
spaces can be specified using
|
20
|
-
|
19
|
+
spaces can be specified using standard escaped syntax in
|
20
|
+
double-quoted strings (e.g., \\n for a newline).
|
21
|
+
|
22
|
+
With very small files, you can construct strings directly...
|
21
23
|
|
22
24
|
define resolve(nameserver1, nameserver2, domain, search) {
|
23
25
|
$str = \"search $search
|
@@ -31,7 +33,9 @@ module Puppet
|
|
31
33
|
}
|
32
34
|
}
|
33
35
|
|
34
|
-
|
36
|
+
...but for larger files, this attribute is more useful when combined with the
|
37
|
+
[template](http://docs.puppetlabs.com/references/latest/function.html#template)
|
38
|
+
function."
|
35
39
|
|
36
40
|
# Store a checksum as the value, rather than the actual content.
|
37
41
|
# Simplifies everything.
|
@@ -72,7 +72,7 @@ module Puppet
|
|
72
72
|
self.fail "Could not understand source #{source}: #{detail}"
|
73
73
|
end
|
74
74
|
|
75
|
-
self.fail "Cannot use URLs of type '#{uri.scheme}' as source for fileserving" unless uri.scheme.nil? or %w{file puppet}.include?(uri.scheme)
|
75
|
+
self.fail "Cannot use URLs of type '#{uri.scheme}' as source for fileserving" unless uri.scheme.nil? or %w{file puppet}.include?(uri.scheme) or (Puppet.features.microsoft_windows? and uri.scheme =~ /^[a-z]$/i)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -95,13 +95,14 @@ module Puppet
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# Look up (if necessary) and return remote content.
|
98
|
-
|
98
|
+
def content
|
99
|
+
return @content if @content
|
99
100
|
raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
|
100
101
|
|
101
102
|
unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source)
|
102
103
|
fail "Could not find any content at %s" % metadata.source
|
103
104
|
end
|
104
|
-
tmp.content
|
105
|
+
@content = tmp.content
|
105
106
|
end
|
106
107
|
|
107
108
|
# Copy the values from the source to the resource. Yay.
|
@@ -137,25 +138,27 @@ module Puppet
|
|
137
138
|
! (metadata.nil? or metadata.ftype.nil?)
|
138
139
|
end
|
139
140
|
|
141
|
+
attr_writer :metadata
|
142
|
+
|
140
143
|
# Provide, and retrieve if necessary, the metadata for this file. Fail
|
141
144
|
# if we can't find data about this host, and fail if there are any
|
142
145
|
# problems in our query.
|
143
|
-
|
146
|
+
def metadata
|
147
|
+
return @metadata if @metadata
|
144
148
|
return nil unless value
|
145
|
-
result = nil
|
146
149
|
value.each do |source|
|
147
150
|
begin
|
148
151
|
if data = Puppet::FileServing::Metadata.indirection.find(source)
|
149
|
-
|
150
|
-
|
152
|
+
@metadata = data
|
153
|
+
@metadata.source = source
|
151
154
|
break
|
152
155
|
end
|
153
156
|
rescue => detail
|
154
157
|
fail detail, "Could not retrieve file metadata for #{source}: #{detail}"
|
155
158
|
end
|
156
159
|
end
|
157
|
-
fail "Could not retrieve information from environment #{Puppet[:environment]} source(s) #{value.join(", ")}" unless
|
158
|
-
|
160
|
+
fail "Could not retrieve information from environment #{Puppet[:environment]} source(s) #{value.join(", ")}" unless @metadata
|
161
|
+
@metadata
|
159
162
|
end
|
160
163
|
|
161
164
|
def local?
|
@@ -177,6 +180,8 @@ module Puppet
|
|
177
180
|
private
|
178
181
|
|
179
182
|
def uri
|
183
|
+
return nil if metadata.source =~ /^[a-z]:[\/\\]/i # Abspath for Windows
|
184
|
+
|
180
185
|
@uri ||= URI.parse(URI.escape(metadata.source))
|
181
186
|
end
|
182
187
|
end
|