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
@@ -15,11 +15,11 @@ class Puppet::FileBucket::File
|
|
15
15
|
attr :bucket_path
|
16
16
|
|
17
17
|
def initialize( contents, options = {} )
|
18
|
-
raise ArgumentError
|
19
|
-
@contents
|
18
|
+
raise ArgumentError.new("contents must be a String, got a #{contents.class}") unless contents.is_a?(String)
|
19
|
+
@contents = contents
|
20
20
|
|
21
21
|
@bucket_path = options.delete(:bucket_path)
|
22
|
-
raise ArgumentError
|
22
|
+
raise ArgumentError.new("Unknown option(s): #{options.keys.join(', ')}") unless options.empty?
|
23
23
|
end
|
24
24
|
|
25
25
|
def checksum_type
|
@@ -1,7 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Created by Luke Kanies on 2007-10-22.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
5
1
|
require 'puppet/file_serving'
|
6
2
|
|
7
3
|
# The base class for Content and Metadata; provides common
|
@@ -53,7 +49,10 @@ class Puppet::FileServing::Base
|
|
53
49
|
# Set our base path.
|
54
50
|
attr_reader :path
|
55
51
|
def path=(path)
|
56
|
-
|
52
|
+
unless path =~ /^#{::File::SEPARATOR}/ or path =~ /^[a-z]:[\/\\]/i
|
53
|
+
raise ArgumentError.new("Paths must be fully qualified")
|
54
|
+
end
|
55
|
+
|
57
56
|
@path = path
|
58
57
|
end
|
59
58
|
|
@@ -1,30 +1,24 @@
|
|
1
|
-
|
2
|
-
# Created by Luke Kanies on 2007-10-16.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
1
|
+
require 'monitor'
|
5
2
|
require 'puppet'
|
6
3
|
require 'puppet/file_serving'
|
7
4
|
require 'puppet/file_serving/mount'
|
8
5
|
require 'puppet/file_serving/mount/file'
|
9
6
|
require 'puppet/file_serving/mount/modules'
|
10
7
|
require 'puppet/file_serving/mount/plugins'
|
11
|
-
require 'puppet/util/cacher'
|
12
8
|
|
13
9
|
class Puppet::FileServing::Configuration
|
14
10
|
require 'puppet/file_serving/configuration/parser'
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
extend MonitorMixin
|
13
|
+
|
14
|
+
def self.configuration
|
15
|
+
synchronize do
|
16
|
+
@configuration ||= new
|
17
|
+
end
|
19
18
|
end
|
20
19
|
|
21
20
|
Mount = Puppet::FileServing::Mount
|
22
21
|
|
23
|
-
# Create our singleton configuration.
|
24
|
-
def self.create
|
25
|
-
configuration
|
26
|
-
end
|
27
|
-
|
28
22
|
private_class_method :new
|
29
23
|
|
30
24
|
attr_reader :mounts
|
@@ -1,7 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Created by Luke Kanies on 2007-10-22.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
5
1
|
require 'find'
|
6
2
|
require 'puppet/file_serving'
|
7
3
|
require 'puppet/file_serving/metadata'
|
@@ -59,8 +55,13 @@ class Puppet::FileServing::Fileset
|
|
59
55
|
end
|
60
56
|
|
61
57
|
def initialize(path, options = {})
|
62
|
-
|
63
|
-
|
58
|
+
if Puppet.features.microsoft_windows?
|
59
|
+
# REMIND: UNC path
|
60
|
+
path = path.chomp(File::SEPARATOR) unless path =~ /^[A-Za-z]:\/$/
|
61
|
+
else
|
62
|
+
path = path.chomp(File::SEPARATOR) unless path == File::SEPARATOR
|
63
|
+
end
|
64
|
+
raise ArgumentError.new("Fileset paths must be fully qualified: #{path}") unless File.expand_path(path) == path
|
64
65
|
|
65
66
|
@path = path
|
66
67
|
|
@@ -1,7 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Created by Luke Kanies on 2007-10-18.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
5
1
|
require 'uri'
|
6
2
|
require 'puppet/file_serving'
|
7
3
|
|
@@ -17,6 +13,7 @@ module Puppet::FileServing::IndirectionHooks
|
|
17
13
|
|
18
14
|
# Short-circuit to :file if it's a fully-qualified path or specifies a 'file' protocol.
|
19
15
|
return PROTOCOL_MAP["file"] if request.key =~ /^#{::File::SEPARATOR}/
|
16
|
+
return PROTOCOL_MAP["file"] if request.key =~ /^[a-z]:[\/\\]/i
|
20
17
|
return PROTOCOL_MAP["file"] if request.protocol == "file"
|
21
18
|
|
22
19
|
# We're heading over the wire the protocol is 'puppet' and we've got a server name or we're not named 'apply' or 'puppet'
|
@@ -1,18 +1,15 @@
|
|
1
|
-
require 'puppet/util/cacher'
|
2
|
-
|
3
1
|
require 'puppet/file_serving/mount'
|
4
2
|
|
5
3
|
class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
4
|
+
def self.localmap
|
5
|
+
@localmap ||= {
|
6
|
+
"h" => Facter.value("hostname"),
|
7
|
+
"H" => [
|
8
|
+
Facter.value("hostname"),
|
9
|
+
Facter.value("domain")
|
10
|
+
].join("."),
|
11
|
+
"d" => Facter.value("domain")
|
12
|
+
}
|
16
13
|
end
|
17
14
|
|
18
15
|
def complete_path(relative_path, node)
|
@@ -1,10 +1,5 @@
|
|
1
|
-
#
|
2
|
-
# Created by Luke Kanies on 2007-10-16.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
5
1
|
require 'puppet/network/authstore'
|
6
2
|
require 'puppet/util/logging'
|
7
|
-
require 'puppet/util/cacher'
|
8
3
|
require 'puppet/file_serving'
|
9
4
|
require 'puppet/file_serving/metadata'
|
10
5
|
require 'puppet/file_serving/content'
|
data/lib/puppet/file_serving.rb
CHANGED
@@ -49,7 +49,6 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
49
49
|
|
50
50
|
def initialize
|
51
51
|
set_server_facts
|
52
|
-
setup_database_backend if Puppet[:storeconfigs]
|
53
52
|
end
|
54
53
|
|
55
54
|
# Is our compiler part of a network, or are we just local?
|
@@ -151,21 +150,4 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
151
150
|
end
|
152
151
|
end
|
153
152
|
end
|
154
|
-
|
155
|
-
def setup_database_backend
|
156
|
-
raise Puppet::Error, "Rails is missing; cannot store configurations" unless Puppet.features.rails?
|
157
|
-
Puppet::Rails.init
|
158
|
-
end
|
159
|
-
|
160
|
-
# Mark that the node has checked in. LAK:FIXME this needs to be moved into
|
161
|
-
# the Node class, or somewhere that's got abstract backends.
|
162
|
-
def update_node_check(node)
|
163
|
-
if Puppet.features.rails? and Puppet[:storeconfigs]
|
164
|
-
Puppet::Rails.connect
|
165
|
-
|
166
|
-
host = Puppet::Rails::Host.find_or_create_by_name(node.name)
|
167
|
-
host.last_freshcheck = Time.now
|
168
|
-
host.save
|
169
|
-
end
|
170
|
-
end
|
171
153
|
end
|
@@ -9,12 +9,12 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
|
|
9
9
|
|
10
10
|
def self.load_fact_plugins
|
11
11
|
# Add any per-module fact directories to the factpath
|
12
|
-
module_fact_dirs = Puppet[:modulepath].split(
|
12
|
+
module_fact_dirs = Puppet[:modulepath].split(File::PATH_SEPARATOR).collect do |d|
|
13
13
|
["lib", "plugins"].map do |subdirectory|
|
14
14
|
Dir.glob("#{d}/*/#{subdirectory}/facter")
|
15
15
|
end
|
16
16
|
end.flatten
|
17
|
-
dirs = module_fact_dirs + Puppet[:factpath].split(
|
17
|
+
dirs = module_fact_dirs + Puppet[:factpath].split(File::PATH_SEPARATOR)
|
18
18
|
x = dirs.each do |dir|
|
19
19
|
load_facts_in_dir(dir)
|
20
20
|
end
|
@@ -1,7 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Created by Luke Kanies on 2007-10-19.
|
3
|
-
# Copyright (c) 2007. All rights reserved.
|
4
|
-
|
5
1
|
require 'puppet/file_serving/configuration'
|
6
2
|
require 'puppet/file_serving/fileset'
|
7
3
|
require 'puppet/file_serving/terminus_helper'
|
@@ -64,6 +60,6 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
|
|
64
60
|
|
65
61
|
# Our fileserver configuration, if needed.
|
66
62
|
def configuration
|
67
|
-
Puppet::FileServing::Configuration.
|
63
|
+
Puppet::FileServing::Configuration.configuration
|
68
64
|
end
|
69
65
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'puppet/util/docs'
|
2
2
|
require 'puppet/indirector/envelope'
|
3
3
|
require 'puppet/indirector/request'
|
4
|
-
require 'puppet/util/cacher'
|
5
4
|
|
6
5
|
# The class that connects functional classes with their different collection
|
7
6
|
# back-ends. Each indirection has a set of associated terminus classes,
|
8
7
|
# each of which is a subclass of Puppet::Indirector::Terminus.
|
9
8
|
class Puppet::Indirector::Indirection
|
10
|
-
include Puppet::Util::Cacher
|
11
9
|
include Puppet::Util::Docs
|
12
10
|
|
13
11
|
@@indirections = []
|
@@ -33,6 +31,8 @@ class Puppet::Indirector::Indirection
|
|
33
31
|
|
34
32
|
attr_accessor :name, :model
|
35
33
|
|
34
|
+
attr_reader :termini
|
35
|
+
|
36
36
|
# Create and return our cache terminus.
|
37
37
|
def cache
|
38
38
|
raise(Puppet::DevError, "Tried to cache when no cache class was set") unless cache_class
|
@@ -88,6 +88,7 @@ class Puppet::Indirector::Indirection
|
|
88
88
|
def initialize(model, name, options = {})
|
89
89
|
@model = model
|
90
90
|
@name = name
|
91
|
+
@termini = {}
|
91
92
|
|
92
93
|
@cache_class = nil
|
93
94
|
@terminus_class = nil
|
@@ -313,7 +314,4 @@ class Puppet::Indirector::Indirection
|
|
313
314
|
end
|
314
315
|
klass.new
|
315
316
|
end
|
316
|
-
|
317
|
-
# Cache our terminus instances indefinitely, but make it easy to clean them up.
|
318
|
-
cached_attr(:termini) { Hash.new }
|
319
317
|
end
|
@@ -76,7 +76,9 @@ class Puppet::Indirector::Request
|
|
76
76
|
# because it rewrites the key. We could otherwise strip server/port/etc
|
77
77
|
# info out in the REST class, but it seemed bad design for the REST
|
78
78
|
# class to rewrite the key.
|
79
|
-
if key.to_s =~
|
79
|
+
if key.to_s =~ /^[a-z]:[\/\\]/i # It's an absolute path for Windows.
|
80
|
+
@key = key
|
81
|
+
elsif key.to_s =~ /^\w+:\/\// # it's a URI
|
80
82
|
set_uri_key(key)
|
81
83
|
else
|
82
84
|
@key = key
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'puppet/indirector/active_record'
|
2
|
+
|
3
|
+
class Puppet::Resource::ActiveRecord < Puppet::Indirector::ActiveRecord
|
4
|
+
def search(request)
|
5
|
+
type = request_to_type_name(request)
|
6
|
+
host = request.options[:host]
|
7
|
+
filter = request.options[:filter]
|
8
|
+
|
9
|
+
if filter and filter[1] =~ /^(and|or)$/i then
|
10
|
+
raise Puppet::Error, "Complex search on StoreConfigs resources is not supported"
|
11
|
+
end
|
12
|
+
|
13
|
+
query = build_active_record_query(type, host, filter)
|
14
|
+
Puppet::Rails::Resource.find(:all, query)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def request_to_type_name(request)
|
19
|
+
name = request.key.split('/', 2)[0]
|
20
|
+
type = Puppet::Type.type(name) or raise Puppet::Error, "Could not find type #{name}"
|
21
|
+
type.name
|
22
|
+
end
|
23
|
+
|
24
|
+
def filter_to_active_record(filter)
|
25
|
+
# Don't call me if you don't have a filter, please.
|
26
|
+
filter.is_a?(Array) or raise ArgumentError, "active record filters must be arrays"
|
27
|
+
a, op, b = filter
|
28
|
+
|
29
|
+
case op
|
30
|
+
when /^(and|or)$/i then
|
31
|
+
extra = []
|
32
|
+
first, args = filter_to_active_record a
|
33
|
+
extra += args
|
34
|
+
|
35
|
+
second, args = filter_to_active_record b
|
36
|
+
extra += args
|
37
|
+
|
38
|
+
return "(#{first}) #{op.upcase} (#{second})", extra
|
39
|
+
|
40
|
+
when "==", "!=" then
|
41
|
+
op = '=' if op == '==' # SQL, yayz!
|
42
|
+
case a
|
43
|
+
when "title" then
|
44
|
+
return "title #{op} ?", [b]
|
45
|
+
|
46
|
+
when "tag" then
|
47
|
+
return "puppet_tags.name #{op} ?", [b]
|
48
|
+
|
49
|
+
else
|
50
|
+
return "param_names.name = ? AND param_values.value #{op} ?", [a, b]
|
51
|
+
end
|
52
|
+
|
53
|
+
else
|
54
|
+
raise ArgumentError, "unknown operator #{op.inspect} in #{filter.inspect}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def build_active_record_query(type, host, filter)
|
59
|
+
raise Puppet::DevError, "Cannot collect resources for a nil host" unless host
|
60
|
+
|
61
|
+
search = "(exported=? AND restype=?)"
|
62
|
+
# Some versions of ActiveRecord just to_s a symbol, which our type is, but
|
63
|
+
# others preserve the symbol-nature, which causes our storage (string) and
|
64
|
+
# query (symbol) to mismatch. So, manually stringify. --daniel 2011-09-08
|
65
|
+
arguments = [true, type.to_s]
|
66
|
+
|
67
|
+
if filter then
|
68
|
+
sql, values = filter_to_active_record(filter)
|
69
|
+
search += " AND #{sql}"
|
70
|
+
arguments += values
|
71
|
+
end
|
72
|
+
|
73
|
+
# note: we're not eagerly including any relations here because it can
|
74
|
+
# create large numbers of objects that we will just throw out later. We
|
75
|
+
# used to eagerly include param_names/values but the way the search filter
|
76
|
+
# is built ruined those efforts and we were eagerly loading only the
|
77
|
+
# searched parameter and not the other ones.
|
78
|
+
query = {}
|
79
|
+
case search
|
80
|
+
when /puppet_tags/
|
81
|
+
query = { :joins => { :resource_tags => :puppet_tag } }
|
82
|
+
when /param_name/
|
83
|
+
query = { :joins => { :param_values => :param_name } }
|
84
|
+
end
|
85
|
+
|
86
|
+
# We're going to collect objects from rails, but we don't want any
|
87
|
+
# objects from this host.
|
88
|
+
if host = Puppet::Rails::Host.find_by_name(host)
|
89
|
+
search += " AND (host_id != ?)"
|
90
|
+
arguments << host.id
|
91
|
+
end
|
92
|
+
|
93
|
+
query[:conditions] = [search, *arguments]
|
94
|
+
|
95
|
+
query
|
96
|
+
end
|
97
|
+
end
|
@@ -52,8 +52,12 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
|
|
52
52
|
(collection_directory || file_location) or raise Puppet::DevError, "No file or directory setting provided; terminus #{self.class.name} cannot function"
|
53
53
|
end
|
54
54
|
|
55
|
-
# Use a setting to determine our path.
|
56
55
|
def path(name)
|
56
|
+
if name =~ Puppet::Indirector::BadNameRegexp then
|
57
|
+
Puppet.crit("directory traversal detected in #{self.class}: #{name.inspect}")
|
58
|
+
raise ArgumentError, "invalid key"
|
59
|
+
end
|
60
|
+
|
57
61
|
if ca?(name) and ca_location
|
58
62
|
ca_location
|
59
63
|
elsif collection_directory
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Puppet::Indirector::StoreConfigs < Puppet::Indirector::Terminus
|
2
|
+
def initialize
|
3
|
+
super
|
4
|
+
# This will raise if the indirection can't be found, so we can assume it
|
5
|
+
# is always set to a valid instance from here on in.
|
6
|
+
@target = indirection.terminus Puppet[:storeconfigs_backend]
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :target
|
10
|
+
|
11
|
+
def head(request)
|
12
|
+
target.head request
|
13
|
+
end
|
14
|
+
|
15
|
+
def find(request)
|
16
|
+
target.find request
|
17
|
+
end
|
18
|
+
|
19
|
+
def search(request)
|
20
|
+
target.search request
|
21
|
+
end
|
22
|
+
|
23
|
+
def save(request)
|
24
|
+
target.save request
|
25
|
+
end
|
26
|
+
|
27
|
+
def destroy(request)
|
28
|
+
target.save request
|
29
|
+
end
|
30
|
+
end
|
@@ -43,6 +43,11 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
|
|
43
43
|
|
44
44
|
# Return the path to a given node's file.
|
45
45
|
def path(name,ext='.yaml')
|
46
|
+
if name =~ Puppet::Indirector::BadNameRegexp then
|
47
|
+
Puppet.crit("directory traversal detected in #{self.class}: #{name.inspect}")
|
48
|
+
raise ArgumentError, "invalid key"
|
49
|
+
end
|
50
|
+
|
46
51
|
base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir]
|
47
52
|
File.join(base, self.class.indirection_name.to_s, name.to_s + ext)
|
48
53
|
end
|
data/lib/puppet/indirector.rb
CHANGED
@@ -82,11 +82,6 @@ class Puppet::Network::Client
|
|
82
82
|
|
83
83
|
self.read_cert
|
84
84
|
|
85
|
-
# We have to start the HTTP connection manually before we start
|
86
|
-
# sending it requests or keep-alive won't work. Note that with #1010,
|
87
|
-
# we don't currently actually want keep-alive.
|
88
|
-
@driver.start if @driver.respond_to? :start and Puppet::Network::HttpPool.keep_alive?
|
89
|
-
|
90
85
|
@local = false
|
91
86
|
elsif hash.include?(driverparam)
|
92
87
|
@driver = hash[driverparam]
|
@@ -1,53 +1,14 @@
|
|
1
1
|
require 'puppet/ssl/host'
|
2
2
|
require 'net/https'
|
3
|
-
require 'puppet/util/cacher'
|
4
3
|
|
5
4
|
module Puppet::Network; end
|
6
5
|
|
7
|
-
# Manage Net::HTTP instances for keep-alive.
|
8
6
|
module Puppet::Network::HttpPool
|
9
|
-
class << self
|
10
|
-
include Puppet::Util::Cacher
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
cached_attr(:http_cache) { Hash.new }
|
15
|
-
end
|
16
|
-
|
17
7
|
# Use the global localhost instance.
|
18
8
|
def self.ssl_host
|
19
9
|
Puppet::SSL::Host.localhost
|
20
10
|
end
|
21
11
|
|
22
|
-
# 2008/03/23
|
23
|
-
# LAK:WARNING: Enabling this has a high propability of
|
24
|
-
# causing corrupt files and who knows what else. See #1010.
|
25
|
-
HTTP_KEEP_ALIVE = false
|
26
|
-
|
27
|
-
def self.keep_alive?
|
28
|
-
HTTP_KEEP_ALIVE
|
29
|
-
end
|
30
|
-
|
31
|
-
# Clear our http cache, closing all connections.
|
32
|
-
def self.clear_http_instances
|
33
|
-
http_cache.each do |name, connection|
|
34
|
-
connection.finish if connection.started?
|
35
|
-
end
|
36
|
-
Puppet::Util::Cacher.expire
|
37
|
-
end
|
38
|
-
|
39
|
-
# Make sure we set the driver up when we read the cert in.
|
40
|
-
def self.read_cert
|
41
|
-
if val = super # This calls read_cert from the Puppet::SSLCertificates::Support module.
|
42
|
-
# Clear out all of our connections, since they previously had no cert and now they
|
43
|
-
# should have them.
|
44
|
-
clear_http_instances
|
45
|
-
return val
|
46
|
-
else
|
47
|
-
return false
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
12
|
# Use cert information from a Puppet client to set up the http object.
|
52
13
|
def self.cert_setup(http)
|
53
14
|
# Just no-op if we don't have certs.
|
@@ -63,21 +24,6 @@ module Puppet::Network::HttpPool
|
|
63
24
|
# Retrieve a cached http instance if caching is enabled, else return
|
64
25
|
# a new one.
|
65
26
|
def self.http_instance(host, port, reset = false)
|
66
|
-
# We overwrite the uninitialized @http here with a cached one.
|
67
|
-
key = "#{host}:#{port}"
|
68
|
-
|
69
|
-
# Return our cached instance if we've got a cache, as long as we're not
|
70
|
-
# resetting the instance.
|
71
|
-
if keep_alive?
|
72
|
-
return http_cache[key] if ! reset and http_cache[key]
|
73
|
-
|
74
|
-
# Clean up old connections if we have them.
|
75
|
-
if http = http_cache[key]
|
76
|
-
http_cache.delete(key)
|
77
|
-
http.finish if http.started?
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
27
|
args = [host, port]
|
82
28
|
if Puppet[:http_proxy_host] == "none"
|
83
29
|
args << nil << nil
|
@@ -97,8 +43,6 @@ module Puppet::Network::HttpPool
|
|
97
43
|
|
98
44
|
cert_setup(http)
|
99
45
|
|
100
|
-
http_cache[key] = http if keep_alive?
|
101
|
-
|
102
46
|
http
|
103
47
|
end
|
104
48
|
end
|