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
@@ -176,7 +176,7 @@ describe "puppet module search" do
|
|
176
176
|
searcher = mock("Searcher")
|
177
177
|
options[:module_repository] = "http://forge.example.com"
|
178
178
|
|
179
|
-
Puppet::Forge.expects(:new).with(
|
179
|
+
Puppet::Forge.expects(:new).with().returns(forge)
|
180
180
|
Puppet::ModuleTool::Applications::Searcher.expects(:new).with("puppetlabs-apache", forge, has_entries(options)).returns(searcher)
|
181
181
|
searcher.expects(:run)
|
182
182
|
|
@@ -3,62 +3,41 @@ require 'puppet/face'
|
|
3
3
|
require 'puppet/module_tool'
|
4
4
|
|
5
5
|
describe "puppet module uninstall" do
|
6
|
-
|
6
|
+
include PuppetSpec::Files
|
7
7
|
|
8
|
-
|
9
|
-
{}
|
10
|
-
|
11
|
-
let(:modulepath) { File.expand_path('/module/path') }
|
12
|
-
let(:environment) do
|
13
|
-
Puppet::Node::Environment.create(:env, [modulepath])
|
14
|
-
end
|
15
|
-
let(:expected_options) do
|
16
|
-
{
|
17
|
-
:target_dir => modulepath,
|
18
|
-
:environment_instance => environment,
|
19
|
-
}
|
20
|
-
end
|
8
|
+
describe "action" do
|
9
|
+
let(:name) { 'module-name' }
|
10
|
+
let(:options) { Hash.new }
|
21
11
|
|
22
|
-
|
23
|
-
|
24
|
-
Puppet.override(:current_environment => environment) do
|
25
|
-
example.run
|
26
|
-
end
|
27
|
-
end
|
12
|
+
it 'should invoke the Uninstaller app' do
|
13
|
+
args = [ name, options ]
|
28
14
|
|
29
|
-
|
30
|
-
|
31
|
-
pattern = /wrong number of arguments/
|
32
|
-
expect { subject.uninstall }.to raise_error ArgumentError, pattern
|
33
|
-
end
|
15
|
+
Puppet::ModuleTool.expects(:set_option_defaults).with(options)
|
16
|
+
Puppet::ModuleTool::Applications::Uninstaller.expects(:run).with(*args)
|
34
17
|
|
35
|
-
|
36
|
-
Puppet::ModuleTool::Applications::Uninstaller.expects(:run).once
|
37
|
-
subject.uninstall("puppetlabs-apache")
|
38
|
-
end
|
18
|
+
Puppet::Face[:module, :current].uninstall(name, options)
|
39
19
|
end
|
40
20
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
21
|
+
context 'slash-separated module name' do
|
22
|
+
let(:name) { 'module/name' }
|
23
|
+
|
24
|
+
it 'should invoke the Uninstaller app' do
|
25
|
+
args = [ 'module-name', options ]
|
47
26
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
27
|
+
Puppet::ModuleTool.expects(:set_option_defaults).with(options)
|
28
|
+
Puppet::ModuleTool::Applications::Uninstaller.expects(:run).with(*args)
|
29
|
+
|
30
|
+
Puppet::Face[:module, :current].uninstall(name, options)
|
31
|
+
end
|
53
32
|
end
|
54
33
|
end
|
55
34
|
|
56
35
|
describe "inline documentation" do
|
57
|
-
subject { Puppet::Face
|
36
|
+
subject { Puppet::Face.find_action(:module, :uninstall) }
|
58
37
|
|
59
38
|
its(:summary) { should =~ /uninstall.*module/im }
|
60
39
|
its(:description) { should =~ /uninstall.*module/im }
|
61
|
-
its(:returns) { should =~ /
|
40
|
+
its(:returns) { should =~ /uninstalled modules/i }
|
62
41
|
its(:examples) { should_not be_empty }
|
63
42
|
|
64
43
|
%w{ license copyright summary description returns examples }.each do |doc|
|
@@ -14,9 +14,12 @@ describe Puppet::Face[:parser, :current] do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "validates the configured site manifest when no files are given" do
|
17
|
-
|
17
|
+
manifest = file_containing('site.pp', "{ invalid =>")
|
18
18
|
|
19
|
-
|
19
|
+
configured_environment = Puppet::Node::Environment.create(:default, [], manifest)
|
20
|
+
Puppet.override(:current_environment => configured_environment) do
|
21
|
+
expect { parser.validate() }.to exit_with(1)
|
22
|
+
end
|
20
23
|
end
|
21
24
|
|
22
25
|
it "validates the given file" do
|
@@ -5,8 +5,46 @@ require 'pathname'
|
|
5
5
|
|
6
6
|
require 'puppet/file_bucket/dipper'
|
7
7
|
require 'puppet/indirector/file_bucket_file/rest'
|
8
|
+
require 'puppet/indirector/file_bucket_file/file'
|
9
|
+
require 'puppet/util/checksums'
|
8
10
|
|
9
|
-
|
11
|
+
shared_examples_for "a restorable file" do
|
12
|
+
let(:dest) { tmpfile('file_bucket_dest') }
|
13
|
+
|
14
|
+
describe "restoring the file" do
|
15
|
+
with_digest_algorithms do
|
16
|
+
it "should restore the file" do
|
17
|
+
request = nil
|
18
|
+
|
19
|
+
klass.any_instance.expects(:find).with { |r| request = r }.returns(Puppet::FileBucket::File.new(plaintext))
|
20
|
+
|
21
|
+
dipper.restore(dest, checksum).should == checksum
|
22
|
+
digest(Puppet::FileSystem.binread(dest)).should == checksum
|
23
|
+
|
24
|
+
request.key.should == "#{digest_algorithm}/#{checksum}"
|
25
|
+
request.server.should == server
|
26
|
+
request.port.should == port
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should skip restoring if existing file has the same checksum" do
|
30
|
+
File.open(dest, 'wb') {|f| f.print(plaintext) }
|
31
|
+
|
32
|
+
dipper.expects(:getfile).never
|
33
|
+
dipper.restore(dest, checksum).should be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should overwrite existing file if it has different checksum" do
|
37
|
+
klass.any_instance.expects(:find).returns(Puppet::FileBucket::File.new(plaintext))
|
38
|
+
|
39
|
+
File.open(dest, 'wb') {|f| f.print('other contents') }
|
40
|
+
|
41
|
+
dipper.restore(dest, checksum).should == checksum
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Puppet::FileBucket::Dipper, :uses_checksums => true do
|
10
48
|
include PuppetSpec::Files
|
11
49
|
|
12
50
|
def make_tmp_file(contents)
|
@@ -34,118 +72,85 @@ describe Puppet::FileBucket::Dipper do
|
|
34
72
|
lambda { @dipper.backup(file) }.should raise_error(Puppet::Error)
|
35
73
|
end
|
36
74
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
75
|
+
describe "backing up and retrieving local files" do
|
76
|
+
with_digest_algorithms do
|
77
|
+
it "should backup files to a local bucket" do
|
78
|
+
Puppet[:bucketdir] = "/non/existent/directory"
|
79
|
+
file_bucket = tmpdir("bucket")
|
42
80
|
|
43
|
-
|
44
|
-
checksum = "f0d7d4e480ad698ed56aeec8b6bd6dea"
|
45
|
-
Digest::MD5.hexdigest("my\r\ncontents").should == checksum
|
46
|
-
|
47
|
-
@dipper.backup(file).should == checksum
|
48
|
-
Puppet::FileSystem.exist?("#{file_bucket}/f/0/d/7/d/4/e/4/f0d7d4e480ad698ed56aeec8b6bd6dea/contents").should == true
|
49
|
-
end
|
81
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => file_bucket)
|
50
82
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
file = make_tmp_file("my\r\ncontents")
|
55
|
-
checksum = Digest::MD5.hexdigest("my\r\ncontents")
|
56
|
-
|
57
|
-
Puppet::FileBucket::File.indirection.expects(:head).returns true
|
58
|
-
Puppet::FileBucket::File.indirection.expects(:save).never
|
59
|
-
@dipper.backup(file).should == checksum
|
60
|
-
end
|
83
|
+
file = make_tmp_file(plaintext)
|
84
|
+
digest(plaintext).should == checksum
|
61
85
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
checksum = Digest::MD5.hexdigest('my contents')
|
66
|
-
|
67
|
-
request = nil
|
68
|
-
|
69
|
-
Puppet::FileBucketFile::File.any_instance.expects(:find).with{ |r| request = r }.once.returns(Puppet::FileBucket::File.new('my contents'))
|
86
|
+
@dipper.backup(file).should == checksum
|
87
|
+
Puppet::FileSystem.exist?("#{file_bucket}/#{bucket_dir}/contents").should == true
|
88
|
+
end
|
70
89
|
|
71
|
-
|
90
|
+
it "should not backup a file that is already in the bucket" do
|
91
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket")
|
72
92
|
|
73
|
-
|
74
|
-
end
|
93
|
+
file = make_tmp_file(plaintext)
|
75
94
|
|
76
|
-
|
77
|
-
|
95
|
+
Puppet::FileBucket::File.indirection.expects(:head).returns true
|
96
|
+
Puppet::FileBucket::File.indirection.expects(:save).never
|
97
|
+
@dipper.backup(file).should == checksum
|
98
|
+
end
|
78
99
|
|
79
|
-
|
80
|
-
|
100
|
+
it "should retrieve files from a local bucket" do
|
101
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket")
|
81
102
|
|
82
|
-
|
103
|
+
request = nil
|
83
104
|
|
84
|
-
|
85
|
-
request2 = nil
|
105
|
+
Puppet::FileBucketFile::File.any_instance.expects(:find).with{ |r| request = r }.once.returns(Puppet::FileBucket::File.new(plaintext))
|
86
106
|
|
87
|
-
|
88
|
-
Puppet::FileBucketFile::Rest.any_instance.expects(:save).with { |r| request2 = r }.once
|
107
|
+
@dipper.getfile(checksum).should == plaintext
|
89
108
|
|
90
|
-
|
91
|
-
|
92
|
-
r.server.should == 'puppetmaster'
|
93
|
-
r.port.should == 31337
|
94
|
-
r.key.should == "md5/#{checksum}/#{real_path}"
|
109
|
+
request.key.should == "#{digest_algorithm}/#{checksum}"
|
110
|
+
end
|
95
111
|
end
|
96
112
|
end
|
97
113
|
|
98
|
-
|
99
|
-
|
114
|
+
describe "backing up and retrieving remote files" do
|
115
|
+
with_digest_algorithms do
|
116
|
+
it "should backup files to a remote server" do
|
117
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port => "31337")
|
100
118
|
|
101
|
-
|
119
|
+
file = make_tmp_file(plaintext)
|
102
120
|
|
103
|
-
|
121
|
+
real_path = Pathname.new(file).realpath
|
104
122
|
|
105
|
-
|
123
|
+
request1 = nil
|
124
|
+
request2 = nil
|
106
125
|
|
107
|
-
|
108
|
-
|
109
|
-
request.server.should == 'puppetmaster'
|
110
|
-
request.port.should == 31337
|
111
|
-
request.key.should == "md5/#{checksum}"
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#restore" do
|
115
|
-
shared_examples_for "a restorable file" do
|
116
|
-
let(:contents) { "my\ncontents" }
|
117
|
-
let(:md5) { Digest::MD5.hexdigest(contents) }
|
118
|
-
let(:dest) { tmpfile('file_bucket_dest') }
|
119
|
-
|
120
|
-
it "should restore the file" do
|
121
|
-
request = nil
|
126
|
+
Puppet::FileBucketFile::Rest.any_instance.expects(:head).with { |r| request1 = r }.once.returns(nil)
|
127
|
+
Puppet::FileBucketFile::Rest.any_instance.expects(:save).with { |r| request2 = r }.once
|
122
128
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
request.server.should == server
|
130
|
-
request.port.should == port
|
129
|
+
@dipper.backup(file).should == checksum
|
130
|
+
[request1, request2].each do |r|
|
131
|
+
r.server.should == 'puppetmaster'
|
132
|
+
r.port.should == 31337
|
133
|
+
r.key.should == "#{digest_algorithm}/#{checksum}/#{real_path}"
|
134
|
+
end
|
131
135
|
end
|
132
136
|
|
133
|
-
it "should
|
134
|
-
|
135
|
-
File.open(dest, 'wb') {|f| f.print(crnl) }
|
137
|
+
it "should retrieve files from a remote server" do
|
138
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port => "31337")
|
136
139
|
|
137
|
-
|
138
|
-
dipper.restore(dest, Digest::MD5.hexdigest(crnl)).should be_nil
|
139
|
-
end
|
140
|
+
request = nil
|
140
141
|
|
141
|
-
|
142
|
-
klass.any_instance.expects(:find).returns(Puppet::FileBucket::File.new(contents))
|
142
|
+
Puppet::FileBucketFile::Rest.any_instance.expects(:find).with { |r| request = r }.returns(Puppet::FileBucket::File.new(plaintext))
|
143
143
|
|
144
|
-
|
144
|
+
@dipper.getfile(checksum).should == plaintext
|
145
145
|
|
146
|
-
|
146
|
+
request.server.should == 'puppetmaster'
|
147
|
+
request.port.should == 31337
|
148
|
+
request.key.should == "#{digest_algorithm}/#{checksum}"
|
147
149
|
end
|
148
150
|
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "#restore" do
|
149
154
|
|
150
155
|
describe "when restoring from a remote server" do
|
151
156
|
let(:klass) { Puppet::FileBucketFile::Rest }
|
@@ -168,3 +173,4 @@ describe Puppet::FileBucket::Dipper do
|
|
168
173
|
end
|
169
174
|
end
|
170
175
|
end
|
176
|
+
|
@@ -1,19 +1,13 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
|
-
|
4
3
|
require 'puppet/file_bucket/file'
|
5
|
-
require 'digest/md5'
|
6
|
-
require 'digest/sha1'
|
7
4
|
|
8
|
-
|
5
|
+
|
6
|
+
describe Puppet::FileBucket::File, :uses_checksums => true do
|
9
7
|
include PuppetSpec::Files
|
10
8
|
|
11
|
-
let(:contents) { "file\r\n contents" }
|
12
|
-
let(:digest) { "8b3702ad1aed1ace7e32bde76ffffb2d" }
|
13
|
-
let(:checksum) { "{md5}#{digest}" }
|
14
9
|
# this is the default from spec_helper, but it keeps getting reset at odd times
|
15
10
|
let(:bucketdir) { Puppet[:bucketdir] = tmpdir('bucket') }
|
16
|
-
let(:destdir) { File.join(bucketdir, "8/b/3/7/0/2/a/d/#{digest}") }
|
17
11
|
|
18
12
|
it "defaults to serializing to `:s`" do
|
19
13
|
expect(Puppet::FileBucket::File.default_format).to eq(:s)
|
@@ -23,25 +17,20 @@ describe Puppet::FileBucket::File do
|
|
23
17
|
expect(Puppet::FileBucket::File.supported_formats).to include(:s, :pson)
|
24
18
|
end
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
it "can make a round trip through `pson`" do
|
35
|
-
file = Puppet::FileBucket::File.new(contents)
|
36
|
-
|
37
|
-
tripped = Puppet::FileBucket::File.convert_from(:pson, file.render(:pson))
|
38
|
-
|
39
|
-
expect(tripped.contents).to eq(contents)
|
40
|
-
end
|
20
|
+
describe "making round trips through network formats" do
|
21
|
+
with_digest_algorithms do
|
22
|
+
it "can make a round trip through `s`" do
|
23
|
+
file = Puppet::FileBucket::File.new(plaintext)
|
24
|
+
tripped = Puppet::FileBucket::File.convert_from(:s, file.render)
|
25
|
+
expect(tripped.contents).to eq(plaintext)
|
26
|
+
end
|
41
27
|
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
it "can make a round trip through `pson`" do
|
29
|
+
file = Puppet::FileBucket::File.new(plaintext)
|
30
|
+
tripped = Puppet::FileBucket::File.convert_from(:pson, file.render(:pson))
|
31
|
+
expect(tripped.contents).to eq(plaintext)
|
32
|
+
end
|
33
|
+
end
|
45
34
|
end
|
46
35
|
|
47
36
|
it "should require contents to be a string" do
|
@@ -54,16 +43,15 @@ describe Puppet::FileBucket::File do
|
|
54
43
|
}.to raise_error(ArgumentError, /Unknown option\(s\): crazy_option/)
|
55
44
|
end
|
56
45
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
it "should default to 'md5' as the checksum algorithm if the algorithm is not in the name" do
|
62
|
-
Puppet::FileBucket::File.new(contents).checksum_type.should == "md5"
|
63
|
-
end
|
46
|
+
with_digest_algorithms do
|
47
|
+
it "it uses #{metadata[:digest_algorithm]} as the configured digest algorithm" do
|
48
|
+
file = Puppet::FileBucket::File.new(plaintext)
|
64
49
|
|
65
|
-
|
66
|
-
|
50
|
+
file.contents.should == plaintext
|
51
|
+
file.checksum_type.should == digest_algorithm
|
52
|
+
file.checksum.should == "{#{digest_algorithm}}#{checksum}"
|
53
|
+
file.name.should == "#{digest_algorithm}/#{checksum}"
|
54
|
+
end
|
67
55
|
end
|
68
56
|
|
69
57
|
describe "when using back-ends" do
|
@@ -76,15 +64,6 @@ describe Puppet::FileBucket::File do
|
|
76
64
|
end
|
77
65
|
end
|
78
66
|
|
79
|
-
it "should return a url-ish name" do
|
80
|
-
Puppet::FileBucket::File.new(contents).name.should == "md5/#{digest}"
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should reject a url-ish name with an invalid checksum" do
|
84
|
-
bucket = Puppet::FileBucket::File.new(contents)
|
85
|
-
expect { bucket.name = "sha1/ae548c0cd614fb7885aaa0b6cb191c34/new/path" }.to raise_error(NoMethodError, /undefined method .name=/)
|
86
|
-
end
|
87
|
-
|
88
67
|
it "should convert the contents to PSON" do
|
89
68
|
Puppet.expects(:deprecation_warning).with('Serializing Puppet::FileBucket::File objects to pson is deprecated.')
|
90
69
|
Puppet::FileBucket::File.new("file contents").to_pson.should == '{"contents":"file contents"}'
|
@@ -94,35 +73,4 @@ describe Puppet::FileBucket::File do
|
|
94
73
|
Puppet.expects(:deprecation_warning).with('Deserializing Puppet::FileBucket::File objects from pson is deprecated. Upgrade to a newer version.')
|
95
74
|
Puppet::FileBucket::File.from_pson({"contents"=>"file contents"}).contents.should == "file contents"
|
96
75
|
end
|
97
|
-
|
98
|
-
def make_bucketed_file
|
99
|
-
FileUtils.mkdir_p(destdir)
|
100
|
-
File.open("#{destdir}/contents", 'wb') { |f| f.write contents }
|
101
|
-
end
|
102
|
-
|
103
|
-
describe "using the indirector's find method" do
|
104
|
-
it "should return nil if a file doesn't exist" do
|
105
|
-
bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{digest}")
|
106
|
-
bucketfile.should == nil
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should find a filebucket if the file exists" do
|
110
|
-
make_bucketed_file
|
111
|
-
bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{digest}")
|
112
|
-
bucketfile.checksum.should == checksum
|
113
|
-
end
|
114
|
-
|
115
|
-
describe "using RESTish digest notation" do
|
116
|
-
it "should return nil if a file doesn't exist" do
|
117
|
-
bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{digest}")
|
118
|
-
bucketfile.should == nil
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should find a filebucket if the file exists" do
|
122
|
-
make_bucketed_file
|
123
|
-
bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{digest}")
|
124
|
-
bucketfile.checksum.should == checksum
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
76
|
end
|