puppet 3.0.2 → 3.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/Gemfile +13 -11
- data/README.md +9 -7
- data/README_DEVELOPER.md +21 -30
- data/bin/extlookup2hiera +0 -0
- data/conf/auth.conf +42 -26
- data/conf/fileserver.conf +41 -0
- data/conf/tagmail.conf +16 -0
- data/examples/hiera/modules/data/manifests/common.pp +2 -1
- data/examples/hiera/modules/ntp/manifests/config.pp +4 -3
- data/examples/hiera/modules/ntp/manifests/data.pp +2 -1
- data/examples/hiera/modules/users/manifests/common.pp +2 -1
- data/examples/hiera/modules/users/manifests/dc1.pp +2 -1
- data/examples/hiera/modules/users/manifests/development.pp +2 -1
- data/examples/hiera/site.pp +1 -1
- data/ext/debian/fileserver.conf +39 -15
- data/ext/envpuppet +2 -0
- data/ext/gentoo/puppet/fileserver.conf +41 -12
- data/ext/ips/puppet-agent +1 -6
- data/ext/ips/puppetagent.xml +0 -4
- data/ext/osx/postflight.erb +109 -0
- data/ext/project_data.yaml +2 -2
- data/ext/redhat/fileserver.conf +41 -12
- data/ext/redhat/puppet.spec.erb +8 -13
- data/install.rb +2 -5
- data/lib/puppet.rb +30 -13
- data/lib/puppet/application.rb +34 -16
- data/lib/puppet/application/agent.rb +4 -4
- data/lib/puppet/application/master.rb +25 -5
- data/lib/puppet/defaults.rb +11 -7
- data/lib/puppet/dsl.rb +7 -3
- data/lib/puppet/dsl/actions.rb +283 -0
- data/lib/puppet/dsl/blank_slate.rb +55 -0
- data/lib/puppet/dsl/context.rb +393 -0
- data/lib/puppet/dsl/parser.rb +57 -0
- data/lib/puppet/dsl/resource_decorator.rb +56 -0
- data/lib/puppet/dsl/resource_reference.rb +95 -0
- data/lib/puppet/dsl/type_reference.rb +102 -0
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/face/help.rb +2 -4
- data/lib/puppet/face/man.rb +8 -2
- data/lib/puppet/feature/pson.rb +1 -3
- data/lib/puppet/indirector/catalog/active_record.rb +3 -0
- data/lib/puppet/indirector/catalog/compiler.rb +1 -2
- data/lib/puppet/indirector/catalog/queue.rb +4 -0
- data/lib/puppet/indirector/catalog/static_compiler.rb +30 -0
- data/lib/puppet/indirector/catalog/store_configs.rb +3 -0
- data/lib/puppet/indirector/certificate_request/rest.rb +1 -0
- data/lib/puppet/indirector/certificate_revocation_list/rest.rb +1 -0
- data/lib/puppet/indirector/certificate_status/file.rb +4 -0
- data/lib/puppet/indirector/certificate_status/rest.rb +1 -0
- data/lib/puppet/indirector/facts/active_record.rb +3 -0
- data/lib/puppet/indirector/facts/couch.rb +3 -0
- data/lib/puppet/indirector/facts/inventory_active_record.rb +4 -0
- data/lib/puppet/indirector/facts/store_configs.rb +3 -0
- data/lib/puppet/indirector/file_metadata/rest.rb +2 -0
- data/lib/puppet/indirector/instrumentation_data/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_data/rest.rb +3 -0
- data/lib/puppet/indirector/instrumentation_listener/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_listener/rest.rb +3 -0
- data/lib/puppet/indirector/instrumentation_probe/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_probe/rest.rb +3 -0
- data/lib/puppet/indirector/node/active_record.rb +3 -0
- data/lib/puppet/indirector/node/rest.rb +2 -2
- data/lib/puppet/indirector/node/store_configs.rb +3 -0
- data/lib/puppet/indirector/node/write_only_yaml.rb +32 -0
- data/lib/puppet/indirector/queue.rb +0 -1
- data/lib/puppet/indirector/request.rb +1 -2
- data/lib/puppet/indirector/resource/active_record.rb +4 -0
- data/lib/puppet/indirector/resource/ral.rb +3 -0
- data/lib/puppet/indirector/resource/rest.rb +3 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/run/local.rb +3 -0
- data/lib/puppet/indirector/ssl_file.rb +16 -14
- data/lib/puppet/indirector/status/local.rb +3 -0
- data/lib/puppet/indirector/status/rest.rb +4 -0
- data/lib/puppet/interface.rb +78 -3
- data/lib/puppet/interface/action.rb +39 -3
- data/lib/puppet/interface/action_builder.rb +74 -1
- data/lib/puppet/interface/action_manager.rb +33 -3
- data/lib/puppet/interface/documentation.rb +116 -5
- data/lib/puppet/interface/face_collection.rb +6 -7
- data/lib/puppet/interface/option.rb +10 -1
- data/lib/puppet/interface/option_builder.rb +29 -1
- data/lib/puppet/interface/option_manager.rb +21 -6
- data/lib/puppet/metatype/manager.rb +47 -9
- data/lib/puppet/module_tool.rb +0 -1
- data/lib/puppet/network/formats.rb +0 -2
- data/lib/puppet/node.rb +2 -3
- data/lib/puppet/node/environment.rb +14 -1
- data/lib/puppet/parameter.rb +309 -44
- data/lib/puppet/parameter/package_options.rb +5 -0
- data/lib/puppet/parameter/path.rb +26 -3
- data/lib/puppet/parameter/value.rb +30 -6
- data/lib/puppet/parameter/value_collection.rb +82 -20
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/parser/ast/definition.rb +2 -5
- data/lib/puppet/parser/ast/hostclass.rb +2 -3
- data/lib/puppet/parser/ast/node.rb +2 -5
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/compiler.rb +10 -0
- data/lib/puppet/parser/functions.rb +111 -7
- data/lib/puppet/parser/functions/create_resources.rb +23 -2
- data/lib/puppet/parser/functions/defined.rb +1 -1
- data/lib/puppet/parser/functions/extlookup.rb +2 -1
- data/lib/puppet/parser/functions/fail.rb +1 -1
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +1 -1
- data/lib/puppet/parser/functions/hiera.rb +1 -1
- data/lib/puppet/parser/functions/hiera_array.rb +1 -1
- data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/include.rb +1 -1
- data/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/lib/puppet/parser/functions/md5.rb +1 -1
- data/lib/puppet/parser/functions/realize.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +54 -57
- data/lib/puppet/parser/functions/require.rb +1 -0
- data/lib/puppet/parser/functions/search.rb +1 -1
- data/lib/puppet/parser/functions/sha1.rb +1 -1
- data/lib/puppet/parser/functions/shellquote.rb +1 -1
- data/lib/puppet/parser/functions/split.rb +1 -2
- data/lib/puppet/parser/functions/sprintf.rb +7 -10
- data/lib/puppet/parser/functions/tag.rb +1 -1
- data/lib/puppet/parser/functions/tagged.rb +1 -1
- data/lib/puppet/parser/functions/template.rb +1 -1
- data/lib/puppet/parser/functions/versioncmp.rb +1 -5
- data/lib/puppet/parser/parser_support.rb +11 -27
- data/lib/puppet/parser/scope.rb +48 -4
- data/lib/puppet/parser/type_loader.rb +31 -7
- data/lib/puppet/property.rb +304 -70
- data/lib/puppet/property/ensure.rb +14 -1
- data/lib/puppet/property/keyvalue.rb +17 -8
- data/lib/puppet/property/list.rb +3 -0
- data/lib/puppet/property/ordered_list.rb +7 -0
- data/lib/puppet/provider.rb +275 -53
- data/lib/puppet/provider/augeas/augeas.rb +17 -3
- data/lib/puppet/provider/confiner.rb +30 -1
- data/lib/puppet/provider/group/pw.rb +2 -2
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkgin.rb +2 -0
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +10 -6
- data/lib/puppet/provider/service/init.rb +1 -1
- data/lib/puppet/provider/service/service.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +2 -2
- data/lib/puppet/provider/user/useradd.rb +2 -3
- data/lib/puppet/reference/configuration.rb +6 -0
- data/lib/puppet/reports.rb +44 -4
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +38 -25
- data/lib/puppet/resource/type.rb +14 -6
- data/lib/puppet/settings.rb +66 -142
- data/lib/puppet/settings/config_file.rb +99 -0
- data/lib/puppet/settings/file_setting.rb +92 -24
- data/lib/puppet/settings/value_translator.rb +15 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/test/test_helper.rb +8 -3
- data/lib/puppet/transaction.rb +1 -2
- data/lib/puppet/transaction/report.rb +122 -13
- data/lib/puppet/type.rb +763 -150
- data/lib/puppet/type/augeas.rb +4 -0
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/group.rb +1 -1
- data/lib/puppet/type/file/mode.rb +2 -0
- data/lib/puppet/type/file/selcontext.rb +1 -0
- data/lib/puppet/type/group.rb +12 -0
- data/lib/puppet/type/mount.rb +2 -2
- data/lib/puppet/type/notify.rb +1 -1
- data/lib/puppet/type/router.rb +1 -1
- data/lib/puppet/type/service.rb +1 -0
- data/lib/puppet/type/ssh_authorized_key.rb +3 -1
- data/lib/puppet/type/user.rb +8 -1
- data/lib/puppet/util.rb +8 -0
- data/lib/puppet/util/autoload.rb +7 -10
- data/lib/puppet/util/classgen.rb +58 -33
- data/lib/puppet/util/command_line.rb +120 -77
- data/lib/puppet/util/constant_inflector.rb +2 -0
- data/lib/puppet/util/execution.rb +63 -33
- data/lib/puppet/util/filetype.rb +1 -1
- data/lib/puppet/util/manifest_filetype_helper.rb +22 -0
- data/lib/puppet/util/methodhelper.rb +19 -0
- data/lib/puppet/util/monkey_patches.rb +46 -0
- data/lib/puppet/util/plugins.rb +2 -2
- data/lib/puppet/util/provider_features.rb +24 -8
- data/lib/puppet/util/rubygems.rb +8 -1
- data/lib/puppet/util/zaml.rb +1 -1
- data/lib/puppet/version.rb +74 -3
- data/spec/integration/application/apply_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +1 -0
- data/spec/integration/dsl/classes_spec.rb +191 -0
- data/spec/integration/dsl/defaults_spec.rb +38 -0
- data/spec/integration/dsl/definitions_spec.rb +73 -0
- data/spec/integration/dsl/functions_spec.rb +95 -0
- data/spec/integration/dsl/nodes_spec.rb +96 -0
- data/spec/integration/dsl/params_spec.rb +146 -0
- data/spec/integration/dsl/relationships_spec.rb +46 -0
- data/spec/integration/dsl/resources_spec.rb +202 -0
- data/spec/integration/dsl/type_loading_spec.rb +64 -0
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/network/formats_spec.rb +32 -45
- data/spec/integration/parser/collector_spec.rb +105 -25
- data/spec/integration/parser/scope_spec.rb +64 -1
- data/spec/integration/resource/catalog_spec.rb +2 -4
- data/spec/integration/type/package_spec.rb +1 -1
- data/spec/lib/matchers/catalog.rb +50 -0
- data/spec/lib/puppet_spec/compiler.rb +11 -0
- data/spec/lib/puppet_spec/dsl.rb +29 -0
- data/spec/spec_helper.rb +17 -3
- data/spec/unit/application/agent_spec.rb +0 -1
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +11 -4
- data/spec/unit/application/indirection_base_spec.rb +4 -8
- data/spec/unit/application/kick_spec.rb +5 -2
- data/spec/unit/application/master_spec.rb +0 -6
- data/spec/unit/application_spec.rb +38 -14
- data/spec/unit/dsl/actions_spec.rb +402 -0
- data/spec/unit/dsl/blank_slate_spec.rb +27 -0
- data/spec/unit/dsl/context_spec.rb +678 -0
- data/spec/unit/dsl/parser_spec.rb +56 -0
- data/spec/unit/dsl/resource_decorator_spec.rb +94 -0
- data/spec/unit/dsl/resource_reference_spec.rb +150 -0
- data/spec/unit/dsl/type_reference_spec.rb +164 -0
- data/spec/unit/face/help_spec.rb +5 -7
- data/spec/unit/indirector/certificate_request/rest_spec.rb +4 -0
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +4 -0
- data/spec/unit/indirector/certificate_status/rest_spec.rb +4 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +5 -0
- data/spec/unit/indirector/hiera_spec.rb +3 -1
- data/spec/unit/indirector/queue_spec.rb +1 -7
- data/spec/unit/indirector/ssl_file_spec.rb +66 -39
- data/spec/unit/module_spec.rb +1 -1
- data/spec/unit/network/authstore_spec.rb +22 -1
- data/spec/unit/network/formats_spec.rb +1 -1
- data/spec/unit/node/environment_spec.rb +13 -0
- data/spec/unit/parser/collector_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +26 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +12 -1
- data/spec/unit/parser/functions/extlookup_spec.rb +4 -4
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +4 -4
- data/spec/unit/parser/functions/split_spec.rb +4 -4
- data/spec/unit/parser/functions/sprintf_spec.rb +2 -2
- data/spec/unit/parser/functions/versioncmp_spec.rb +4 -4
- data/spec/unit/parser/functions_spec.rb +51 -1
- data/spec/unit/parser/parser_spec.rb +0 -14
- data/spec/unit/parser/type_loader_spec.rb +15 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +31 -0
- data/spec/unit/provider/package/apt_spec.rb +0 -2
- data/spec/unit/provider/package/pip_spec.rb +12 -2
- data/spec/unit/provider/service/freebsd_spec.rb +8 -0
- data/spec/unit/provider/service/gentoo_spec.rb +20 -20
- data/spec/unit/provider/service/openrc_spec.rb +20 -20
- data/spec/unit/provider/service/src_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_spec.rb +0 -8
- data/spec/unit/provider/service/windows_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +2 -9
- data/spec/unit/relationship_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +2 -2
- data/spec/unit/resource/type_spec.rb +49 -25
- data/spec/unit/resource_spec.rb +34 -2
- data/spec/unit/settings/config_file_spec.rb +100 -0
- data/spec/unit/settings/file_setting_spec.rb +87 -84
- data/spec/unit/settings/value_translator_spec.rb +77 -0
- data/spec/unit/settings_spec.rb +96 -29
- data/spec/unit/type/file/ensure_spec.rb +75 -36
- data/spec/unit/type/file_spec.rb +0 -68
- data/spec/unit/type/group_spec.rb +10 -0
- data/spec/unit/util/autoload_spec.rb +6 -0
- data/spec/unit/util/command_line_spec.rb +54 -62
- data/spec/unit/util/manifest_filetype_helper_spec.rb +29 -0
- data/spec/unit/util/metric_spec.rb +0 -9
- data/spec/unit/util/posix_spec.rb +0 -4
- data/spec/unit/util/rdoc_spec.rb +0 -12
- data/spec/unit/util/zaml_spec.rb +188 -130
- data/spec/unit/version_spec.rb +42 -0
- metadata +123 -90
- data/README_HIERA.md +0 -148
- data/conf/epm.list +0 -8
- data/conf/namespaceauth.conf +0 -20
- data/conf/puppet-queue.conf +0 -10
- data/examples/allatonce +0 -13
- data/examples/assignments +0 -11
- data/examples/components +0 -73
- data/examples/etc/init.d/sleeper +0 -70
- data/examples/etc/otherfile +0 -0
- data/examples/etc/puppet/fileserver.conf +0 -13
- data/examples/etc/puppet/namespaceauth.conf +0 -20
- data/examples/etc/puppet/puppet.conf +0 -10
- data/examples/etc/puppet/tagmail.conf +0 -1
- data/examples/execs +0 -16
- data/examples/file.bl +0 -11
- data/examples/filedefaults +0 -10
- data/examples/fileparsing +0 -116
- data/examples/filerecursion +0 -15
- data/examples/functions +0 -3
- data/examples/groups +0 -7
- data/examples/head +0 -30
- data/examples/importing +0 -8
- data/examples/mac_dscl.pp +0 -28
- data/examples/mac_dscl_revert.pp +0 -26
- data/examples/mac_pkgdmg.pp +0 -7
- data/examples/modules/sample_module.pp +0 -10
- data/examples/modules/sample_module/lib/puppet/parser/functions/hostname_to_dn.rb +0 -36
- data/examples/modules/sample_module/manifests/init.pp +0 -12
- data/examples/modules/sample_module/templates/sample.erb +0 -5
- data/examples/nodes +0 -20
- data/examples/one +0 -8
- data/examples/relationships +0 -34
- data/examples/selectors +0 -28
- data/examples/simpletests +0 -11
- data/examples/svncommit +0 -13
- data/lib/puppet/dsl/resource_api.rb +0 -120
- data/lib/puppet/dsl/resource_type_api.rb +0 -34
- data/spec/integration/parser/ruby_manifest_spec.rb +0 -127
- data/spec/unit/dsl/resource_api_spec.rb +0 -180
- data/spec/unit/dsl/resource_type_api_spec.rb +0 -53
@@ -2,6 +2,9 @@ require 'puppet/node/facts'
|
|
2
2
|
require 'puppet/indirector/couch'
|
3
3
|
class Puppet::Node::Facts::Couch < Puppet::Indirector::Couch
|
4
4
|
|
5
|
+
desc "Store facts in CouchDB. This should not be used with the inventory service;
|
6
|
+
it is for more obscure custom integrations. If you are wondering whether you
|
7
|
+
should use it, you shouldn't; use PuppetDB instead."
|
5
8
|
# Return the facts object or nil if there is no document
|
6
9
|
def find(request)
|
7
10
|
doc = super
|
@@ -6,6 +6,10 @@ require 'puppet/util/retryaction'
|
|
6
6
|
|
7
7
|
class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord
|
8
8
|
|
9
|
+
desc "Medium-performance fact storage suitable for the inventory service.
|
10
|
+
Most users should use PuppetDB instead. Note: ActiveRecord-based storeconfigs
|
11
|
+
and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
12
|
+
|
9
13
|
def initialize
|
10
14
|
Puppet.deprecation_warning "ActiveRecord-based storeconfigs and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
11
15
|
super
|
@@ -5,6 +5,9 @@ require 'puppet/node'
|
|
5
5
|
class Puppet::Node::ActiveRecord < Puppet::Indirector::ActiveRecord
|
6
6
|
use_ar_model Puppet::Rails::Host
|
7
7
|
|
8
|
+
desc "A component of ActiveRecord storeconfigs. ActiveRecord-based storeconfigs
|
9
|
+
and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
Puppet.deprecation_warning "ActiveRecord-based storeconfigs and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
10
13
|
super
|
@@ -2,6 +2,6 @@ require 'puppet/node'
|
|
2
2
|
require 'puppet/indirector/rest'
|
3
3
|
|
4
4
|
class Puppet::Node::Rest < Puppet::Indirector::REST
|
5
|
-
desc "
|
6
|
-
|
5
|
+
desc "Get a node via REST. Puppet agent uses this to allow the puppet master
|
6
|
+
to override its environment."
|
7
7
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'puppet/node'
|
2
|
+
require 'puppet/indirector/yaml'
|
3
|
+
|
4
|
+
# This is a WriteOnlyYaml terminus that exists only for the purpose of being able to write
|
5
|
+
# node cache data that later can be read by the YAML terminus.
|
6
|
+
# The use case this supports is to make it possible to search among the "current nodes"
|
7
|
+
# when Puppet DB (recommended) or other central storage of information is not available.
|
8
|
+
#
|
9
|
+
# @see puppet issue 16753
|
10
|
+
# @see Puppet::Application::Master#setup_node_cache
|
11
|
+
# @api private
|
12
|
+
#
|
13
|
+
class Puppet::Node::WriteOnlyYaml < Puppet::Indirector::Yaml
|
14
|
+
desc "Store node information as flat files, serialized using YAML,
|
15
|
+
does not deserialize (write only)."
|
16
|
+
|
17
|
+
# Overridden to always return nil. This is a write only terminus.
|
18
|
+
# @param [Object] request Ignored.
|
19
|
+
# @return [nil] This implementation always return nil'
|
20
|
+
# @api
|
21
|
+
def find(request)
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
# Overridden to always return nil. This is a write only terminus.
|
26
|
+
# @param [Object] request Ignored.
|
27
|
+
# @return [nil] This implementation always return nil
|
28
|
+
# @api
|
29
|
+
def search(request)
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
@@ -16,8 +16,7 @@ class Puppet::Indirector::Request
|
|
16
16
|
|
17
17
|
OPTION_ATTRIBUTES = [:ip, :node, :authenticated, :ignore_terminus, :ignore_cache, :instance, :environment]
|
18
18
|
|
19
|
-
|
20
|
-
Puppet.features.pson? and ::PSON.register_document_type('IndirectorRequest',self)
|
19
|
+
::PSON.register_document_type('IndirectorRequest',self)
|
21
20
|
|
22
21
|
def self.from_pson(json)
|
23
22
|
raise ArgumentError, "No indirection name provided in json data" unless indirection_name = json['type']
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'puppet/indirector/active_record'
|
2
2
|
|
3
3
|
class Puppet::Resource::ActiveRecord < Puppet::Indirector::ActiveRecord
|
4
|
+
|
5
|
+
desc "A component of ActiveRecord storeconfigs. ActiveRecord-based storeconfigs
|
6
|
+
and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
7
|
+
|
4
8
|
def initialize
|
5
9
|
Puppet.deprecation_warning "ActiveRecord-based storeconfigs and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
|
6
10
|
super
|
@@ -82,13 +82,9 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
|
|
82
82
|
|
83
83
|
# Find the file on disk, returning an instance of the model.
|
84
84
|
def find(request)
|
85
|
-
|
86
|
-
|
87
|
-
return nil unless FileTest.exist?(path) or rename_files_with_uppercase(path)
|
85
|
+
filename = rename_files_with_uppercase(path(request.key))
|
88
86
|
|
89
|
-
|
90
|
-
result.read(path)
|
91
|
-
result
|
87
|
+
filename ? create_model(request.key, filename) : nil
|
92
88
|
end
|
93
89
|
|
94
90
|
# Save our file to disk.
|
@@ -106,16 +102,20 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
|
|
106
102
|
# an instance for every file in the directory.
|
107
103
|
def search(request)
|
108
104
|
dir = collection_directory
|
109
|
-
Dir.entries(dir).
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
result
|
114
|
-
end
|
105
|
+
Dir.entries(dir).
|
106
|
+
select { |file| file =~ /\.pem$/ }.
|
107
|
+
collect { |file| create_model(file.sub(/\.pem$/, ''), File.join(dir, file)) }.
|
108
|
+
compact
|
115
109
|
end
|
116
110
|
|
117
111
|
private
|
118
112
|
|
113
|
+
def create_model(name, path)
|
114
|
+
result = model.new(name)
|
115
|
+
result.read(path)
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
119
|
# Demeterish pointers to class info.
|
120
120
|
def collection_directory
|
121
121
|
self.class.collection_directory
|
@@ -135,6 +135,8 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
|
|
135
135
|
# which we'll be EOL'ing at some point. This method was added at 20080702
|
136
136
|
# and should be removed at some point.
|
137
137
|
def rename_files_with_uppercase(file)
|
138
|
+
return file if FileTest.exist?(file)
|
139
|
+
|
138
140
|
dir, short = File.split(file)
|
139
141
|
return nil unless FileTest.exist?(dir)
|
140
142
|
|
@@ -147,10 +149,10 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
|
|
147
149
|
|
148
150
|
full_file = File.join(dir, real_file)
|
149
151
|
|
150
|
-
Puppet.
|
152
|
+
Puppet.deprecation_warning "Automatic downcasing and renaming of ssl files is deprecated; please request the file using its correct case: #{full_file}"
|
151
153
|
File.rename(full_file, file)
|
152
154
|
|
153
|
-
|
155
|
+
file
|
154
156
|
end
|
155
157
|
|
156
158
|
# Yield a filehandle set up appropriately, either with our settings doing
|
@@ -2,4 +2,8 @@ require 'puppet/indirector/status'
|
|
2
2
|
require 'puppet/indirector/rest'
|
3
3
|
|
4
4
|
class Puppet::Indirector::Status::Rest < Puppet::Indirector::REST
|
5
|
+
|
6
|
+
desc "Get puppet master's status via REST. Useful because it tests the health
|
7
|
+
of both the web server and the indirector."
|
8
|
+
|
5
9
|
end
|
data/lib/puppet/interface.rb
CHANGED
@@ -4,6 +4,7 @@ require 'puppet/interface/documentation'
|
|
4
4
|
require 'prettyprint'
|
5
5
|
require 'semver'
|
6
6
|
|
7
|
+
# @api public
|
7
8
|
class Puppet::Interface
|
8
9
|
include FullDocs
|
9
10
|
|
@@ -22,19 +23,38 @@ class Puppet::Interface
|
|
22
23
|
class << self
|
23
24
|
# This is just so we can search for actions. We only use its
|
24
25
|
# list of directories to search.
|
25
|
-
|
26
|
+
|
27
|
+
# @api private
|
28
|
+
# @deprecated
|
26
29
|
def autoloader
|
30
|
+
Puppet.deprecation_warning("Puppet::Interface.autoloader is deprecated; please use Puppet::Interface#loader instead")
|
27
31
|
@autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/face")
|
28
32
|
end
|
29
33
|
|
34
|
+
# Lists all loaded faces
|
35
|
+
# @return [Array<Symbol>] The names of the loaded faces
|
30
36
|
def faces
|
31
37
|
Puppet::Interface::FaceCollection.faces
|
32
38
|
end
|
33
39
|
|
40
|
+
# Register a face
|
41
|
+
# @param instance [Puppet::Interface] The face
|
42
|
+
# @return [void]
|
43
|
+
# @api private
|
34
44
|
def register(instance)
|
35
45
|
Puppet::Interface::FaceCollection.register(instance)
|
36
46
|
end
|
37
47
|
|
48
|
+
# Defines a new Face.
|
49
|
+
# @todo Talk about using Faces DSL inside the block
|
50
|
+
#
|
51
|
+
# @param name [Symbol] the name of the face
|
52
|
+
# @param version [String] the version of the face (this should
|
53
|
+
# conform to {http://semver.org/ Semantic Versioning})
|
54
|
+
# @overload define(name, version, {|| ... })
|
55
|
+
# @return [Puppet::Interface] The created face
|
56
|
+
# @api public
|
57
|
+
# @dsl Faces
|
38
58
|
def define(name, version, &block)
|
39
59
|
face = Puppet::Interface::FaceCollection[name, version]
|
40
60
|
if face.nil? then
|
@@ -50,12 +70,30 @@ class Puppet::Interface
|
|
50
70
|
return face
|
51
71
|
end
|
52
72
|
|
73
|
+
# Retrieves a face by name and version. Use `:current` for the
|
74
|
+
# version to get the most recent available version.
|
75
|
+
#
|
76
|
+
# @param name [Symbol] the name of the face
|
77
|
+
# @param version [String, :current] the version of the face
|
78
|
+
#
|
79
|
+
# @return [Puppet::Interface] the face
|
80
|
+
#
|
81
|
+
# @api public
|
53
82
|
def face?(name, version)
|
54
83
|
Puppet::Interface::FaceCollection[name, version]
|
55
84
|
end
|
56
85
|
|
86
|
+
# Retrieves a face by name and version
|
87
|
+
#
|
88
|
+
# @param name [Symbol] the name of the face
|
89
|
+
# @param version [String] the version of the face
|
90
|
+
#
|
91
|
+
# @return [Puppet::Interface] the face
|
92
|
+
#
|
93
|
+
# @api public
|
57
94
|
def [](name, version)
|
58
95
|
unless face = Puppet::Interface::FaceCollection[name, version]
|
96
|
+
# REVISIT (#18042) no sense in rechecking if version == :current -- josh
|
59
97
|
if current = Puppet::Interface::FaceCollection[name, :current]
|
60
98
|
raise Puppet::Error, "Could not find version #{version} of #{name}"
|
61
99
|
else
|
@@ -66,6 +104,11 @@ class Puppet::Interface
|
|
66
104
|
face
|
67
105
|
end
|
68
106
|
|
107
|
+
# Retrieves an action for a face
|
108
|
+
# @param name [Symbol] The face
|
109
|
+
# @param action [Symbol] The action name
|
110
|
+
# @param version [String, :current] The version of the face
|
111
|
+
# @return [Puppet::Interface::Action] The action
|
69
112
|
def find_action(name, action, version = :current)
|
70
113
|
Puppet::Interface::FaceCollection.get_action_for_face(name, action, version)
|
71
114
|
end
|
@@ -76,15 +119,35 @@ class Puppet::Interface
|
|
76
119
|
# the same instance between build-time and the runtime instance. When that
|
77
120
|
# splits out this should merge into a module that both the action and face
|
78
121
|
# include. --daniel 2011-04-17
|
122
|
+
|
123
|
+
|
124
|
+
# Returns the synopsis for the face. This shows basic usage and global
|
125
|
+
# options.
|
126
|
+
# @return [String] usage synopsis
|
127
|
+
# @api private
|
79
128
|
def synopsis
|
80
129
|
build_synopsis self.name, '<action>'
|
81
130
|
end
|
82
131
|
|
83
132
|
|
84
133
|
########################################################################
|
85
|
-
|
134
|
+
|
135
|
+
# The name of the face
|
136
|
+
# @return [Symbol]
|
137
|
+
# @api private
|
138
|
+
attr_reader :name
|
139
|
+
|
140
|
+
# The version of the face
|
141
|
+
# @return [SemVer]
|
142
|
+
attr_reader :version
|
143
|
+
|
144
|
+
# The autoloader instance for the face
|
145
|
+
# @return [Puppet::Util::Autoload]
|
146
|
+
# @api private
|
147
|
+
attr_reader :loader
|
86
148
|
private :loader
|
87
149
|
|
150
|
+
# @api private
|
88
151
|
def initialize(name, version, &block)
|
89
152
|
unless SemVer.valid?(version)
|
90
153
|
raise ArgumentError, "Cannot create face #{name.inspect} with invalid version number '#{version}'!"
|
@@ -103,11 +166,16 @@ class Puppet::Interface
|
|
103
166
|
instance_eval(&block) if block_given?
|
104
167
|
end
|
105
168
|
|
106
|
-
#
|
169
|
+
# Loads all actions defined in other files.
|
170
|
+
#
|
171
|
+
# @return [void]
|
172
|
+
# @api private
|
107
173
|
def load_actions
|
108
174
|
loader.loadall
|
109
175
|
end
|
110
176
|
|
177
|
+
# Returns a string representation with the face's name and version
|
178
|
+
# @return [String]
|
111
179
|
def to_s
|
112
180
|
"Puppet::Face[#{name.inspect}, #{version.inspect}]"
|
113
181
|
end
|
@@ -123,6 +191,8 @@ class Puppet::Interface
|
|
123
191
|
# all this away, replace it with something nice, and work out if we should
|
124
192
|
# be making this visible to the outside world... --daniel 2011-04-14
|
125
193
|
private
|
194
|
+
# @return [void]
|
195
|
+
# @api private
|
126
196
|
def __invoke_decorations(type, action, passed_args = [], passed_options = {})
|
127
197
|
[:before, :after].member?(type) or fail "unknown decoration type #{type}"
|
128
198
|
|
@@ -142,10 +212,15 @@ class Puppet::Interface
|
|
142
212
|
end
|
143
213
|
end
|
144
214
|
|
215
|
+
# @return [void]
|
216
|
+
# @api private
|
145
217
|
def __add_method(name, proc)
|
146
218
|
meta_def(name, &proc)
|
147
219
|
method(name).unbind
|
148
220
|
end
|
221
|
+
|
222
|
+
# @return [void]
|
223
|
+
# @api private
|
149
224
|
def self.__add_method(name, proc)
|
150
225
|
define_method(name, proc)
|
151
226
|
instance_method(name)
|