puppet 3.5.1-x86-mingw32 → 3.6.0.rc1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CONTRIBUTING.md +5 -0
- data/Gemfile +17 -9
- data/README.md +1 -0
- data/conf/fileserver.conf +4 -3
- data/ext/README.environment +8 -0
- data/ext/build_defaults.yaml +1 -1
- data/ext/debian/control +2 -2
- data/ext/debian/puppet-common.dirs +4 -0
- data/ext/debian/rules +4 -0
- data/ext/emacs/puppet-mode-init.el +1 -1
- data/ext/emacs/puppet-mode.el +36 -17
- data/ext/redhat/client.init +3 -3
- data/ext/redhat/puppet.spec.erb +9 -0
- data/ext/systemd/puppet.service +3 -4
- data/ext/systemd/puppetmaster.service +1 -3
- data/install.rb +1 -1
- data/lib/puppet.rb +2 -1
- data/lib/puppet/agent.rb +1 -1
- data/lib/puppet/application.rb +17 -17
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/configurer.rb +4 -1
- data/lib/puppet/configurer/downloader.rb +13 -12
- data/lib/puppet/configurer/plugin_handler.rb +3 -3
- data/lib/puppet/context.rb +6 -1
- data/lib/puppet/defaults.rb +82 -12
- data/lib/puppet/environments.rb +169 -13
- data/lib/puppet/external/nagios/grammar.ry +2 -0
- data/lib/puppet/external/nagios/parser.rb +28 -19
- data/lib/puppet/face/config.rb +19 -6
- data/lib/puppet/face/module/generate.rb +209 -7
- data/lib/puppet/face/module/install.rb +17 -16
- data/lib/puppet/face/module/list.rb +83 -82
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +10 -9
- data/lib/puppet/face/parser.rb +3 -2
- data/lib/puppet/face/plugin.rb +8 -4
- data/lib/puppet/file_bucket/dipper.rb +6 -3
- data/lib/puppet/file_bucket/file.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +1 -1
- data/lib/puppet/file_system/memory_file.rb +27 -1
- data/lib/puppet/file_system/memory_impl.rb +15 -1
- data/lib/puppet/forge.rb +148 -52
- data/lib/puppet/forge/cache.rb +5 -1
- data/lib/puppet/forge/errors.rb +10 -0
- data/lib/puppet/forge/repository.rb +61 -26
- data/lib/puppet/functions.rb +548 -0
- data/lib/puppet/functions/assert_type.rb +42 -0
- data/lib/puppet/functions/import.rb +7 -0
- data/lib/puppet/indirector/facts/facter.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
- data/lib/puppet/indirector/rest.rb +18 -0
- data/lib/puppet/loaders.rb +20 -0
- data/lib/puppet/module.rb +2 -2
- data/lib/puppet/module_tool.rb +40 -14
- data/lib/puppet/module_tool/applications.rb +0 -1
- data/lib/puppet/module_tool/applications/application.rb +35 -26
- data/lib/puppet/module_tool/applications/builder.rb +16 -6
- data/lib/puppet/module_tool/applications/checksummer.rb +25 -19
- data/lib/puppet/module_tool/applications/installer.rb +196 -35
- data/lib/puppet/module_tool/applications/searcher.rb +1 -0
- data/lib/puppet/module_tool/applications/uninstaller.rb +7 -1
- data/lib/puppet/module_tool/applications/unpacker.rb +57 -31
- data/lib/puppet/module_tool/applications/upgrader.rb +221 -65
- data/lib/puppet/module_tool/checksums.rb +5 -8
- data/lib/puppet/module_tool/errors/installer.rb +12 -44
- data/lib/puppet/module_tool/errors/shared.rb +84 -11
- data/lib/puppet/module_tool/errors/upgrader.rb +16 -45
- data/lib/puppet/module_tool/install_directory.rb +7 -6
- data/lib/puppet/module_tool/installed_modules.rb +92 -0
- data/lib/puppet/module_tool/local_tarball.rb +91 -0
- data/lib/puppet/module_tool/metadata.rb +119 -115
- data/lib/puppet/module_tool/modulefile.rb +9 -9
- data/lib/puppet/module_tool/shared_behaviors.rb +19 -7
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +79 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +18 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb +1 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +7 -0
- data/lib/puppet/module_tool/tar.rb +3 -7
- data/lib/puppet/module_tool/tar/gnu.rb +21 -9
- data/lib/puppet/module_tool/tar/mini.rb +2 -8
- data/lib/puppet/network/http/api/v1.rb +1 -1
- data/lib/puppet/network/http/api/v2/authorization.rb +4 -2
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/network/http_pool.rb +15 -6
- data/lib/puppet/node/environment.rb +91 -20
- data/lib/puppet/parser/ast/pops_bridge.rb +44 -3
- data/lib/puppet/parser/collector.rb +1 -1
- data/lib/puppet/parser/compiler.rb +50 -7
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/generate.rb +1 -1
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/pops.rb +22 -1
- data/lib/puppet/pops/adapters.rb +8 -1
- data/lib/puppet/pops/binder/bindings_composer.rb +1 -1
- data/lib/puppet/pops/binder/bindings_factory.rb +1 -1
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
- data/lib/puppet/pops/binder/producers.rb +2 -2
- data/lib/puppet/pops/evaluator/access_operator.rb +65 -25
- data/lib/puppet/pops/evaluator/callable_signature.rb +101 -0
- data/lib/puppet/pops/evaluator/closure.rb +57 -2
- data/lib/puppet/pops/evaluator/compare_operator.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +9 -11
- data/lib/puppet/pops/evaluator/runtime3_support.rb +72 -21
- data/lib/puppet/pops/functions/dispatch.rb +71 -0
- data/lib/puppet/pops/functions/dispatcher.rb +237 -0
- data/lib/puppet/pops/functions/function.rb +77 -0
- data/lib/puppet/pops/issues.rb +12 -0
- data/lib/puppet/pops/loader/base_loader.rb +102 -0
- data/lib/puppet/pops/loader/dependency_loader.rb +60 -0
- data/lib/puppet/pops/loader/gem_support.rb +49 -0
- data/lib/puppet/pops/loader/loader.rb +180 -0
- data/lib/puppet/pops/loader/loader_paths.rb +137 -0
- data/lib/puppet/pops/loader/module_loaders.rb +242 -0
- data/lib/puppet/pops/loader/null_loader.rb +44 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +34 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +109 -0
- data/lib/puppet/pops/loader/simple_environment_loader.rb +20 -0
- data/lib/puppet/pops/loader/static_loader.rb +69 -0
- data/lib/puppet/pops/loader/uri_helper.rb +22 -0
- data/lib/puppet/pops/loaders.rb +240 -0
- data/lib/puppet/pops/model/factory.rb +13 -5
- data/lib/puppet/pops/model/model_tree_dumper.rb +12 -4
- data/lib/puppet/pops/parser/egrammar.ra +31 -18
- data/lib/puppet/pops/parser/eparser.rb +1137 -1106
- data/lib/puppet/pops/parser/lexer2.rb +17 -16
- data/lib/puppet/pops/semantic_error.rb +17 -0
- data/lib/puppet/pops/types/type_calculator.rb +150 -15
- data/lib/puppet/pops/types/type_factory.rb +69 -0
- data/lib/puppet/pops/types/type_parser.rb +9 -0
- data/lib/puppet/pops/types/types.rb +65 -4
- data/lib/puppet/pops/validation/checker4_0.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -1
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +2 -2
- data/lib/puppet/provider/cron/crontab.rb +13 -2
- data/lib/puppet/provider/package.rb +24 -0
- data/lib/puppet/provider/package/apt.rb +6 -1
- data/lib/puppet/provider/package/gem.rb +8 -2
- data/lib/puppet/provider/package/msi.rb +0 -15
- data/lib/puppet/provider/package/openbsd.rb +0 -24
- data/lib/puppet/provider/package/rpm.rb +3 -29
- data/lib/puppet/provider/package/windows.rb +0 -15
- data/lib/puppet/provider/package/yum.rb +101 -24
- data/lib/puppet/provider/package/yumhelper.py +31 -1
- data/lib/puppet/provider/package/zypper.rb +10 -28
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +3 -0
- data/lib/puppet/provider/service/openbsd.rb +318 -0
- data/lib/puppet/provider/service/redhat.rb +6 -3
- data/lib/puppet/provider/service/systemd.rb +2 -2
- data/lib/puppet/provider/yumrepo/inifile.rb +115 -42
- data/lib/puppet/resource.rb +13 -9
- data/lib/puppet/resource/catalog.rb +12 -6
- data/lib/puppet/resource/type_collection.rb +3 -3
- data/lib/puppet/settings.rb +57 -36
- data/lib/puppet/settings/config_file.rb +5 -0
- data/lib/puppet/settings/environment_conf.rb +147 -0
- data/lib/puppet/settings/ttl_setting.rb +48 -0
- data/lib/puppet/ssl/certificate_authority.rb +2 -3
- data/lib/puppet/ssl/certificate_authority/autosign_command.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +4 -4
- data/lib/puppet/ssl/validator/default_validator.rb +2 -2
- data/lib/puppet/status.rb +1 -1
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/type/augeas.rb +13 -1
- data/lib/puppet/type/cron.rb +32 -18
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/file/checksum.rb +15 -5
- data/lib/puppet/type/file/content.rb +3 -1
- data/lib/puppet/type/file/source.rb +5 -5
- data/lib/puppet/type/package.rb +12 -17
- data/lib/puppet/type/resources.rb +3 -1
- data/lib/puppet/type/scheduled_task.rb +4 -5
- data/lib/puppet/type/service.rb +12 -2
- data/lib/puppet/type/user.rb +106 -0
- data/lib/puppet/type/yumrepo.rb +9 -1
- data/lib/puppet/util/checksums.rb +60 -1
- data/lib/puppet/util/diff.rb +3 -1
- data/lib/puppet/util/execution.rb +20 -16
- data/lib/puppet/util/feature.rb +3 -0
- data/lib/puppet/util/logging.rb +19 -12
- data/lib/puppet/util/rubygems.rb +10 -0
- data/lib/puppet/util/watched_file.rb +1 -1
- data/lib/puppet/util/windows/security.rb +5 -3
- data/lib/puppet/vendor/load_semantic.rb +1 -0
- data/lib/puppet/vendor/require_vendored.rb +2 -0
- data/lib/puppet/vendor/semantic/Gemfile +20 -0
- data/lib/puppet/vendor/semantic/Rakefile +69 -0
- data/lib/puppet/vendor/semantic/lib/semantic.rb +7 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency.rb +181 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph.rb +60 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph_node.rb +117 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +46 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +25 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/unsatisfiable_graph.rb +31 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version.rb +168 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +424 -0
- data/lib/puppet/vendor/semantic/spec/spec_helper.rb +24 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +141 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +162 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +143 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +5 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +44 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +383 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +307 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +608 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/java.tgz +0 -0
- data/spec/fixtures/stdlib.tgz +0 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/usee/lib/puppet/functions/usee/callee.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/lib/puppet/functions/user/caller.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/metadata.json +9 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +19 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/lib/puppet/functions/moduleb/rb_func_b.rb +6 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/manifests/init.pp +3 -0
- data/spec/fixtures/unit/provider/naginator/define_empty_param +6 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +7 -0
- data/spec/fixtures/unit/type/user/authorized_keys +5 -0
- data/spec/integration/application/apply_spec.rb +1 -2
- data/spec/integration/configurer_spec.rb +2 -2
- data/spec/integration/faces/plugin_spec.rb +62 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +1 -1
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/node/environment_spec.rb +2 -2
- data/spec/integration/parser/future_compiler_spec.rb +96 -142
- data/spec/integration/parser/ruby_manifest_spec.rb +0 -5
- data/spec/integration/provider/cron/crontab_spec.rb +35 -0
- data/spec/integration/type/file_spec.rb +74 -72
- data/spec/integration/util/windows/security_spec.rb +17 -0
- data/spec/lib/matchers/resource.rb +45 -13
- data/spec/lib/puppet_spec/files.rb +18 -0
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +56 -0
- data/spec/lib/puppet_spec/module_tool/stub_source.rb +133 -0
- data/spec/shared_contexts/checksums.rb +55 -0
- data/spec/unit/application/apply_spec.rb +10 -7
- data/spec/unit/application/doc_spec.rb +17 -10
- data/spec/unit/application/indirection_base_spec.rb +18 -10
- data/spec/unit/application/inspect_spec.rb +22 -20
- data/spec/unit/configurer/downloader_spec.rb +7 -6
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
- data/spec/unit/configurer_spec.rb +1 -1
- data/spec/unit/context_spec.rb +23 -0
- data/spec/unit/environments_spec.rb +274 -16
- data/spec/unit/face/config_spec.rb +111 -11
- data/spec/unit/face/module/install_spec.rb +14 -85
- data/spec/unit/face/module/list_spec.rb +108 -62
- data/spec/unit/face/module/search_spec.rb +1 -1
- data/spec/unit/face/module/uninstall_spec.rb +21 -42
- data/spec/unit/face/parser_spec.rb +5 -2
- data/spec/unit/file_bucket/dipper_spec.rb +92 -86
- data/spec/unit/file_bucket/file_spec.rb +23 -75
- data/spec/unit/file_serving/metadata_spec.rb +74 -74
- data/spec/unit/forge/module_release_spec.rb +131 -0
- data/spec/unit/forge/repository_spec.rb +21 -20
- data/spec/unit/forge_spec.rb +99 -23
- data/spec/unit/functions/assert_type_spec.rb +59 -0
- data/spec/unit/functions4_spec.rb +671 -0
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +2 -2
- data/spec/unit/indirector/facts/facter_spec.rb +9 -3
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +156 -155
- data/spec/unit/indirector/rest_spec.rb +8 -0
- data/spec/unit/interface/face_collection_spec.rb +35 -23
- data/spec/unit/module_spec.rb +20 -8
- data/spec/unit/module_tool/applications/builder_spec.rb +40 -12
- data/spec/unit/module_tool/applications/checksummer_spec.rb +86 -105
- data/spec/unit/module_tool/applications/installer_spec.rb +293 -261
- data/spec/unit/module_tool/applications/searcher_spec.rb +1 -1
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +90 -154
- data/spec/unit/module_tool/applications/unpacker_spec.rb +12 -12
- data/spec/unit/module_tool/applications/upgrader_spec.rb +286 -18
- data/spec/unit/module_tool/metadata_spec.rb +223 -14
- data/spec/unit/module_tool/tar/gnu_spec.rb +12 -9
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/module_tool/tar_spec.rb +4 -18
- data/spec/unit/module_tool_spec.rb +123 -27
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http_pool_spec.rb +21 -0
- data/spec/unit/network/rights_spec.rb +10 -8
- data/spec/unit/node/environment_spec.rb +27 -2
- data/spec/unit/parser/collector_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/generate_spec.rb +4 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +50 -11
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +25 -0
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +44 -0
- data/spec/unit/pops/loaders/loader_paths_spec.rb +66 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +105 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +119 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +46 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +145 -10
- data/spec/unit/pops/types/type_factory_spec.rb +101 -0
- data/spec/unit/pops/types/type_parser_spec.rb +22 -0
- data/spec/unit/property/list_spec.rb +9 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +58 -11
- data/spec/unit/provider/cron/crontab_spec.rb +1 -0
- data/spec/unit/provider/cron/parsed_spec.rb +15 -0
- data/spec/unit/provider/naginator_spec.rb +14 -0
- data/spec/unit/provider/package/apt_spec.rb +78 -64
- data/spec/unit/provider/package/gem_spec.rb +15 -0
- data/spec/unit/provider/package/rpm_spec.rb +6 -6
- data/spec/unit/provider/package/windows_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +199 -104
- data/spec/unit/provider/package/zypper_spec.rb +41 -15
- data/spec/unit/provider/service/openbsd_spec.rb +129 -22
- data/spec/unit/provider/service/redhat_spec.rb +18 -4
- data/spec/unit/provider/service/systemd_spec.rb +5 -9
- data/spec/unit/provider/service/upstart_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +10 -0
- data/spec/unit/provider/yumrepo/inifile_spec.rb +171 -15
- data/spec/unit/resource/catalog_spec.rb +20 -104
- data/spec/unit/resource/type_collection_spec.rb +10 -9
- data/spec/unit/settings/config_file_spec.rb +29 -6
- data/spec/unit/settings/environment_conf_spec.rb +51 -0
- data/spec/unit/settings_spec.rb +97 -12
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -0
- data/spec/unit/type/augeas_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +6 -7
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/content_spec.rb +277 -207
- data/spec/unit/type/file_spec.rb +9 -7
- data/spec/unit/type/user_spec.rb +106 -18
- data/spec/unit/type/yumrepo_spec.rb +8 -0
- data/spec/unit/util/checksums_spec.rb +12 -5
- data/spec/unit/util/diff_spec.rb +8 -0
- data/spec/unit/util/execution_spec.rb +4 -4
- data/spec/unit/util/feature_spec.rb +2 -0
- data/spec/unit/util/logging_spec.rb +14 -4
- data/spec/unit/util/rdoc/parser_spec.rb +5 -4
- data/spec/unit/util/rubygems_spec.rb +14 -0
- data/tasks/parallel.rake +2 -2
- metadata +154 -21
- checksums.yaml +0 -7
- data/lib/puppet/module_tool/applications/generator.rb +0 -142
- data/lib/puppet/module_tool/skeleton.rb +0 -37
- data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +0 -11
- data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +0 -16
- data/lib/puppet/module_tool/tar/solaris.rb +0 -5
- data/spec/fixtures/unit/provider/service/systemd/list_units_services +0 -17
- data/spec/unit/module_tool/tar/solaris_spec.rb +0 -22
@@ -128,7 +128,7 @@ describe Puppet::Resource::Catalog::StaticCompiler do
|
|
128
128
|
options[:request] ||= request
|
129
129
|
|
130
130
|
# Build a catalog suitable for the static compiler to operate on
|
131
|
-
catalog = Puppet::Resource::Catalog.new("#{options[:request].key}")
|
131
|
+
catalog = Puppet::Resource::Catalog.new("#{options[:request].key}", Puppet::Node::Environment.remote(:testing))
|
132
132
|
|
133
133
|
# Mock out the fileserver, otherwise converting the catalog to a
|
134
134
|
fake_fileserver_metadata = fileserver_metadata(options)
|
@@ -139,7 +139,7 @@ describe Puppet::Resource::Catalog::StaticCompiler do
|
|
139
139
|
indirection.stubs(:find).with do |uri, opts|
|
140
140
|
expect(uri).to eq options[:source].sub('puppet:///','')
|
141
141
|
expect(opts[:links]).to eq :manage
|
142
|
-
expect(opts[:environment]).to eq
|
142
|
+
expect(opts[:environment]).to eq "testing"
|
143
143
|
end.returns(fake_fileserver_metadata)
|
144
144
|
|
145
145
|
# I want a resource that all the file resources require and another
|
@@ -3,7 +3,10 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
require 'puppet/indirector/facts/facter'
|
5
5
|
|
6
|
+
module PuppetNodeFactsFacter
|
6
7
|
describe Puppet::Node::Facts::Facter do
|
8
|
+
FS = Puppet::FileSystem
|
9
|
+
|
7
10
|
it "should be a subclass of the Code terminus" do
|
8
11
|
Puppet::Node::Facts::Facter.superclass.should equal(Puppet::Indirector::Code)
|
9
12
|
end
|
@@ -173,8 +176,6 @@ describe Puppet::Node::Facts::Facter do
|
|
173
176
|
it "should load all facts from the modules" do
|
174
177
|
Puppet::Node::Facts::Facter.stubs(:load_facts_in_dir)
|
175
178
|
|
176
|
-
Puppet[:modulepath] = [one, two].join(File::PATH_SEPARATOR)
|
177
|
-
|
178
179
|
Dir.stubs(:glob).returns []
|
179
180
|
Dir.expects(:glob).with("#{one}/*/lib/facter").returns %w{oneA oneB}
|
180
181
|
Dir.expects(:glob).with("#{two}/*/lib/facter").returns %w{twoA twoB}
|
@@ -184,7 +185,11 @@ describe Puppet::Node::Facts::Facter do
|
|
184
185
|
Puppet::Node::Facts::Facter.expects(:load_facts_in_dir).with("twoA")
|
185
186
|
Puppet::Node::Facts::Facter.expects(:load_facts_in_dir).with("twoB")
|
186
187
|
|
187
|
-
|
188
|
+
FS.overlay(FS::MemoryFile.a_directory(one), FS::MemoryFile.a_directory(two)) do
|
189
|
+
Puppet.override(:current_environment => Puppet::Node::Environment.create(:testing, [one, two], "")) do
|
190
|
+
Puppet::Node::Facts::Facter.load_fact_plugins
|
191
|
+
end
|
192
|
+
end
|
188
193
|
end
|
189
194
|
|
190
195
|
it "should include module plugin facts when present", :if => Puppet.features.external_facts? do
|
@@ -195,3 +200,4 @@ describe Puppet::Node::Facts::Facter do
|
|
195
200
|
end
|
196
201
|
end
|
197
202
|
end
|
203
|
+
end
|
@@ -4,16 +4,12 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/indirector/file_bucket_file/file'
|
5
5
|
require 'puppet/util/platform'
|
6
6
|
|
7
|
-
describe Puppet::FileBucketFile::File do
|
7
|
+
describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
8
8
|
include PuppetSpec::Files
|
9
9
|
|
10
10
|
describe "non-stubbing tests" do
|
11
11
|
include PuppetSpec::Files
|
12
12
|
|
13
|
-
before do
|
14
|
-
Puppet[:bucketdir] = tmpdir('bucketdir')
|
15
|
-
end
|
16
|
-
|
17
13
|
def save_bucket_file(contents, path = "/who_cares")
|
18
14
|
bucket_file = Puppet::FileBucket::File.new(contents)
|
19
15
|
Puppet::FileBucket::File.indirection.save(bucket_file, "#{bucket_file.name}#{path}")
|
@@ -64,93 +60,102 @@ describe Puppet::FileBucketFile::File do
|
|
64
60
|
end
|
65
61
|
|
66
62
|
describe "when supplying a path" do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
it "should leave the paths file alone if the path is already stored" do
|
78
|
-
checksum = save_bucket_file("stuff", "/foo/bar")
|
79
|
-
|
80
|
-
checksum = save_bucket_file("stuff", "/foo/bar")
|
63
|
+
with_digest_algorithms do
|
64
|
+
it "should store the path if not already stored" do
|
65
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
66
|
+
|
67
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
68
|
+
contents_file = "#{dir_path}/contents"
|
69
|
+
paths_file = "#{dir_path}/paths"
|
70
|
+
Puppet::FileSystem.binread(contents_file).should == plaintext
|
71
|
+
Puppet::FileSystem.read(paths_file).should == "foo/bar\n"
|
72
|
+
end
|
81
73
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
74
|
+
it "should leave the paths file alone if the path is already stored" do
|
75
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
76
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
77
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
78
|
+
Puppet::FileSystem.binread("#{dir_path}/contents").should == plaintext
|
79
|
+
File.read("#{dir_path}/paths").should == "foo/bar\n"
|
80
|
+
end
|
86
81
|
|
87
|
-
|
88
|
-
|
82
|
+
it "should store an additional path if the new path differs from those already stored" do
|
83
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
89
84
|
|
90
|
-
|
85
|
+
checksum = save_bucket_file(plaintext, "/foo/baz")
|
91
86
|
|
92
|
-
|
93
|
-
|
94
|
-
|
87
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
88
|
+
Puppet::FileSystem.binread("#{dir_path}/contents").should == plaintext
|
89
|
+
File.read("#{dir_path}/paths").should == "foo/bar\nfoo/baz\n"
|
90
|
+
end
|
95
91
|
end
|
96
92
|
end
|
97
93
|
|
98
94
|
describe "when not supplying a path" do
|
99
|
-
|
100
|
-
|
95
|
+
with_digest_algorithms do
|
96
|
+
it "should save the file and create an empty paths file" do
|
97
|
+
checksum = save_bucket_file(plaintext, "")
|
101
98
|
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
100
|
+
Puppet::FileSystem.binread("#{dir_path}/contents").should == plaintext
|
101
|
+
File.read("#{dir_path}/paths").should == ""
|
102
|
+
end
|
105
103
|
end
|
106
104
|
end
|
107
105
|
end
|
108
106
|
|
109
107
|
describe "when servicing a head/find request" do
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
108
|
+
with_digest_algorithms do
|
109
|
+
let(:not_bucketed_plaintext) { "other stuff" }
|
110
|
+
let(:not_bucketed_checksum) { digest(not_bucketed_plaintext) }
|
111
|
+
|
112
|
+
describe "when supplying a path" do
|
113
|
+
it "should return false/nil if the file isn't bucketed" do
|
114
|
+
Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{not_bucketed_checksum}/foo/bar").should == false
|
115
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{not_bucketed_checksum}/foo/bar").should == nil
|
116
|
+
end
|
115
117
|
|
116
|
-
|
117
|
-
|
118
|
+
it "should return false/nil if the file is bucketed but with a different path" do
|
119
|
+
checksum = save_bucket_file("I'm the contents of a file", '/foo/bar')
|
118
120
|
|
119
|
-
|
120
|
-
|
121
|
-
|
121
|
+
Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}/foo/baz").should == false
|
122
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}/foo/baz").should == nil
|
123
|
+
end
|
122
124
|
|
123
|
-
|
124
|
-
|
125
|
+
it "should return true/file if the file is already bucketed with the given path" do
|
126
|
+
contents = "I'm the contents of a file"
|
125
127
|
|
126
|
-
|
128
|
+
checksum = save_bucket_file(contents, '/foo/bar')
|
127
129
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}/foo/bar").should == true
|
131
|
+
find_result = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}/foo/bar")
|
132
|
+
find_result.checksum.should == "{#{digest_algorithm}}#{checksum}"
|
133
|
+
find_result.to_s.should == contents
|
134
|
+
end
|
132
135
|
end
|
133
|
-
end
|
134
136
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
137
|
+
describe "when not supplying a path" do
|
138
|
+
[false, true].each do |trailing_slash|
|
139
|
+
describe "#{trailing_slash ? 'with' : 'without'} a trailing slash" do
|
140
|
+
trailing_string = trailing_slash ? '/' : ''
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
142
|
+
it "should return false/nil if the file isn't bucketed" do
|
143
|
+
Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{not_bucketed_checksum}#{trailing_string}").should == false
|
144
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{not_bucketed_checksum}#{trailing_string}").should == nil
|
145
|
+
end
|
144
146
|
|
145
|
-
|
146
|
-
|
147
|
+
it "should return true/file if the file is already bucketed" do
|
148
|
+
# this one replaces most of the lets in the "when
|
149
|
+
# digest_digest_algorithm is set..." shared context, but it still needs digest_algorithm
|
150
|
+
contents = "I'm the contents of a file"
|
147
151
|
|
148
|
-
|
152
|
+
checksum = save_bucket_file(contents, '/foo/bar')
|
149
153
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
+
Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}#{trailing_string}").should == true
|
155
|
+
find_result = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}#{trailing_string}")
|
156
|
+
find_result.checksum.should == "{#{digest_algorithm}}#{checksum}"
|
157
|
+
find_result.to_s.should == contents
|
158
|
+
end
|
154
159
|
end
|
155
160
|
end
|
156
161
|
end
|
@@ -158,124 +163,120 @@ describe Puppet::FileBucketFile::File do
|
|
158
163
|
end
|
159
164
|
|
160
165
|
describe "when diffing files", :unless => Puppet.features.microsoft_windows? do
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
end
|
166
|
+
with_digest_algorithms do
|
167
|
+
let(:not_bucketed_plaintext) { "other stuff" }
|
168
|
+
let(:not_bucketed_checksum) { digest(not_bucketed_plaintext) }
|
165
169
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
diff = Puppet::FileBucket::File.indirection.find("md5/#{checksum1}", :diff_with => checksum2)
|
171
|
-
diff.should == <<HERE
|
172
|
-
2c2
|
173
|
-
< bar
|
174
|
-
---
|
175
|
-
> biz
|
176
|
-
HERE
|
177
|
-
end
|
170
|
+
it "should generate an empty string if there is no diff" do
|
171
|
+
checksum = save_bucket_file("I'm the contents of a file")
|
172
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}", :diff_with => checksum).should == ''
|
173
|
+
end
|
178
174
|
|
179
|
-
|
180
|
-
|
181
|
-
|
175
|
+
it "should generate a proper diff if there is a diff" do
|
176
|
+
checksum1 = save_bucket_file("foo\nbar\nbaz")
|
177
|
+
checksum2 = save_bucket_file("foo\nbiz\nbaz")
|
182
178
|
|
183
|
-
|
184
|
-
|
185
|
-
end
|
186
|
-
|
179
|
+
diff = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum1}", :diff_with => checksum2)
|
180
|
+
diff.should == "2c2\n< bar\n---\n> biz\n"
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should raise an exception if the hash to diff against isn't found" do
|
184
|
+
checksum = save_bucket_file("whatever")
|
185
|
+
|
186
|
+
expect do
|
187
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}", :diff_with => not_bucketed_checksum)
|
188
|
+
end.to raise_error "could not find diff_with #{not_bucketed_checksum}"
|
189
|
+
end
|
187
190
|
|
188
|
-
|
189
|
-
|
190
|
-
checksum = save_bucket_file("whatever")
|
191
|
+
it "should return nil if the hash to diff from isn't found" do
|
192
|
+
checksum = save_bucket_file("whatever")
|
191
193
|
|
192
|
-
|
194
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{not_bucketed_checksum}", :diff_with => checksum).should == nil
|
195
|
+
end
|
193
196
|
end
|
194
197
|
end
|
195
198
|
end
|
196
199
|
|
197
200
|
[true, false].each do |override_bucket_path|
|
198
|
-
describe "when bucket path #{
|
201
|
+
describe "when bucket path #{override_bucket_path ? 'is' : 'is not'} overridden" do
|
199
202
|
[true, false].each do |supply_path|
|
200
203
|
describe "when #{supply_path ? 'supplying' : 'not supplying'} a path" do
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
204
|
+
with_digest_algorithms do
|
205
|
+
before :each do
|
206
|
+
Puppet.settings.stubs(:use)
|
207
|
+
@store = Puppet::FileBucketFile::File.new
|
205
208
|
|
206
|
-
|
207
|
-
@digest.should == Digest::MD5.hexdigest(@contents)
|
209
|
+
@bucket_top_dir = tmpdir("bucket")
|
208
210
|
|
209
|
-
|
211
|
+
if override_bucket_path
|
212
|
+
Puppet[:bucketdir] = "/bogus/path" # should not be used
|
213
|
+
else
|
214
|
+
Puppet[:bucketdir] = @bucket_top_dir
|
215
|
+
end
|
210
216
|
|
211
|
-
|
212
|
-
|
213
|
-
else
|
214
|
-
Puppet[:bucketdir] = @bucket_dir
|
217
|
+
@dir = "#{@bucket_top_dir}/#{bucket_dir}"
|
218
|
+
@contents_path = "#{@dir}/contents"
|
215
219
|
end
|
216
220
|
|
217
|
-
|
218
|
-
|
219
|
-
end
|
221
|
+
describe "when retrieving files" do
|
222
|
+
before :each do
|
220
223
|
|
221
|
-
|
222
|
-
|
224
|
+
request_options = {}
|
225
|
+
if override_bucket_path
|
226
|
+
request_options[:bucket_path] = @bucket_top_dir
|
227
|
+
end
|
223
228
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
229
|
+
key = "#{digest_algorithm}/#{checksum}"
|
230
|
+
if supply_path
|
231
|
+
key += "/path/to/file"
|
232
|
+
end
|
228
233
|
|
229
|
-
|
230
|
-
if supply_path
|
231
|
-
key += "/path/to/file"
|
234
|
+
@request = Puppet::Indirector::Request.new(:indirection_name, :find, key, nil, request_options)
|
232
235
|
end
|
233
236
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
FileUtils.mkdir_p(@dir)
|
239
|
-
File.open(@contents_path, 'w') { |f| f.write @contents }
|
240
|
-
end
|
241
|
-
|
242
|
-
it "should return an instance of Puppet::FileBucket::File created with the content if the file exists" do
|
243
|
-
make_bucketed_file
|
237
|
+
def make_bucketed_file
|
238
|
+
FileUtils.mkdir_p(@dir)
|
239
|
+
File.open(@contents_path, 'wb') { |f| f.write plaintext }
|
240
|
+
end
|
244
241
|
|
245
|
-
if
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
242
|
+
it "should return an instance of Puppet::FileBucket::File created with the content if the file exists" do
|
243
|
+
make_bucketed_file
|
244
|
+
|
245
|
+
if supply_path
|
246
|
+
@store.find(@request).should == nil
|
247
|
+
@store.head(@request).should == false # because path didn't match
|
248
|
+
else
|
249
|
+
bucketfile = @store.find(@request)
|
250
|
+
bucketfile.should be_a(Puppet::FileBucket::File)
|
251
|
+
bucketfile.contents.should == plaintext
|
252
|
+
@store.head(@request).should == true
|
253
|
+
end
|
253
254
|
end
|
254
|
-
end
|
255
255
|
|
256
|
-
|
257
|
-
|
258
|
-
|
256
|
+
it "should return nil if no file is found" do
|
257
|
+
@store.find(@request).should be_nil
|
258
|
+
@store.head(@request).should == false
|
259
|
+
end
|
259
260
|
end
|
260
|
-
end
|
261
261
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
262
|
+
describe "when saving files" do
|
263
|
+
it "should save the contents to the calculated path" do
|
264
|
+
options = {}
|
265
|
+
if override_bucket_path
|
266
|
+
options[:bucket_path] = @bucket_top_dir
|
267
|
+
end
|
268
268
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
269
|
+
key = "#{digest_algorithm}/#{checksum}"
|
270
|
+
if supply_path
|
271
|
+
key += "//path/to/file"
|
272
|
+
end
|
273
273
|
|
274
|
-
|
275
|
-
|
274
|
+
file_instance = Puppet::FileBucket::File.new(plaintext, options)
|
275
|
+
request = Puppet::Indirector::Request.new(:indirection_name, :save, key, file_instance)
|
276
276
|
|
277
|
-
|
278
|
-
|
277
|
+
@store.save(request)
|
278
|
+
Puppet::FileSystem.binread("#{@dir}/contents").should == plaintext
|
279
|
+
end
|
279
280
|
end
|
280
281
|
end
|
281
282
|
end
|
@@ -277,6 +277,14 @@ describe Puppet::Indirector::REST do
|
|
277
277
|
terminus.find(request).should == nil
|
278
278
|
end
|
279
279
|
|
280
|
+
it 'raises a warning for a 404' do
|
281
|
+
response = mock_response('404', 'this is the notfound you are looking for')
|
282
|
+
connection.expects(:get).returns(response)
|
283
|
+
expected_message = 'Find /production/test_model/foo? resulted in 404 with the message: this is the notfound you are looking for'
|
284
|
+
Puppet::Util::Warnings.expects(:maybe_log).with(expected_message, Puppet::TestModel::Rest)
|
285
|
+
terminus.find(request)
|
286
|
+
end
|
287
|
+
|
280
288
|
it "asks the model to deserialize the response body and sets the name on the resulting object to the find key" do
|
281
289
|
connection.expects(:get).returns response
|
282
290
|
|