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
@@ -5,32 +5,44 @@ require 'tmpdir'
|
|
5
5
|
require 'puppet/interface'
|
6
6
|
|
7
7
|
describe Puppet::Interface::FaceCollection do
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
subject.instance_variable_get(:@
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
|
9
|
+
# To prevent conflicts with other specs that use faces, we must save and restore global state.
|
10
|
+
# Because there are specs that do 'describe Puppet::Face[...]', we must restore the same objects otherwise
|
11
|
+
# the 'subject' of the specs will differ.
|
12
|
+
before :all do
|
13
|
+
# Save FaceCollection's global state
|
14
|
+
faces = subject.instance_variable_get(:@faces)
|
15
|
+
@faces = faces.dup
|
16
|
+
faces.each do |k, v|
|
17
|
+
@faces[k] = v.dup
|
18
|
+
end
|
19
|
+
@faces_loaded = subject.instance_variable_get(:@loaded)
|
20
|
+
|
21
|
+
# Save the already required face files
|
22
|
+
@required = []
|
23
|
+
$".each do |path|
|
24
|
+
@required << path if path =~ /face\/.*\.rb$/
|
25
|
+
end
|
26
|
+
|
27
|
+
# Save Autoload's global state
|
28
|
+
@loaded = Puppet::Util::Autoload.instance_variable_get(:@loaded).dup
|
23
29
|
end
|
24
30
|
|
25
|
-
after :
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
after :all do
|
32
|
+
# Restore global state
|
33
|
+
subject.instance_variable_set :@faces, @faces
|
34
|
+
subject.instance_variable_set :@loaded, @faces_loaded
|
35
|
+
$".delete_if { |path| path =~ /face\/.*\.rb$/ }
|
36
|
+
@required.each { |path| $".push path unless $".include? path }
|
37
|
+
Puppet::Util::Autoload.instance_variable_set(:@loaded, @loaded)
|
38
|
+
end
|
32
39
|
|
33
|
-
|
40
|
+
before :each do
|
41
|
+
# Before each test, clear the faces
|
42
|
+
subject.instance_variable_get(:@faces).clear
|
43
|
+
subject.instance_variable_set(:@loaded, false)
|
44
|
+
Puppet::Util::Autoload.instance_variable_get(:@loaded).clear
|
45
|
+
$".delete_if { |path| path =~ /face\/.*\.rb$/ }
|
34
46
|
end
|
35
47
|
|
36
48
|
describe "::[]" do
|
data/spec/unit/module_spec.rb
CHANGED
@@ -19,19 +19,19 @@ describe Puppet::Module do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should have a class method that returns a named module from a given environment" do
|
22
|
-
env =
|
22
|
+
env = Puppet::Node::Environment.create(:myenv, [])
|
23
23
|
env.expects(:module).with(name).returns "yep"
|
24
|
-
Puppet::
|
25
|
-
|
26
|
-
|
24
|
+
Puppet.override(:environments => Puppet::Environments::Static.new(env)) do
|
25
|
+
Puppet::Module.find(name, "myenv").should == "yep"
|
26
|
+
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should return nil if asked for a named module that doesn't exist" do
|
30
|
-
env =
|
30
|
+
env = Puppet::Node::Environment.create(:myenv, [])
|
31
31
|
env.expects(:module).with(name).returns nil
|
32
|
-
Puppet::
|
33
|
-
|
34
|
-
|
32
|
+
Puppet.override(:environments => Puppet::Environments::Static.new(env)) do
|
33
|
+
Puppet::Module.find(name, "myenv").should be_nil
|
34
|
+
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "attributes" do
|
@@ -97,6 +97,7 @@ describe Puppet::Module do
|
|
97
97
|
|
98
98
|
it "should list modules that are missing" do
|
99
99
|
metadata_file = "#{@modpath}/needy/metadata.json"
|
100
|
+
Puppet::FileSystem.expects(:exist?).with(metadata_file).returns true
|
100
101
|
mod = PuppetSpec::Modules.create(
|
101
102
|
'needy',
|
102
103
|
@modpath,
|
@@ -118,6 +119,7 @@ describe Puppet::Module do
|
|
118
119
|
|
119
120
|
it "should list modules that are missing and have invalid names" do
|
120
121
|
metadata_file = "#{@modpath}/needy/metadata.json"
|
122
|
+
Puppet::FileSystem.expects(:exist?).with(metadata_file).returns true
|
121
123
|
mod = PuppetSpec::Modules.create(
|
122
124
|
'needy',
|
123
125
|
@modpath,
|
@@ -140,6 +142,10 @@ describe Puppet::Module do
|
|
140
142
|
it "should list modules with unmet version requirement" do
|
141
143
|
env = Puppet::Node::Environment.create(:testing, [@modpath])
|
142
144
|
|
145
|
+
['test_gte_req', 'test_specific_req', 'foobar'].each do |mod_name|
|
146
|
+
metadata_file = "#{@modpath}/#{mod_name}/metadata.json"
|
147
|
+
Puppet::FileSystem.stubs(:exist?).with(metadata_file).returns true
|
148
|
+
end
|
143
149
|
mod = PuppetSpec::Modules.create(
|
144
150
|
'test_gte_req',
|
145
151
|
@modpath,
|
@@ -217,6 +223,8 @@ describe Puppet::Module do
|
|
217
223
|
it "should consider a dependency without a semantic version to be unmet" do
|
218
224
|
env = Puppet::Node::Environment.create(:testing, [@modpath])
|
219
225
|
|
226
|
+
metadata_file = "#{@modpath}/foobar/metadata.json"
|
227
|
+
Puppet::FileSystem.expects(:exist?).with(metadata_file).times(3).returns true
|
220
228
|
mod = PuppetSpec::Modules.create(
|
221
229
|
'foobar',
|
222
230
|
@modpath,
|
@@ -261,6 +269,10 @@ describe Puppet::Module do
|
|
261
269
|
it "should only list unmet dependencies" do
|
262
270
|
env = Puppet::Node::Environment.create(:testing, [@modpath])
|
263
271
|
|
272
|
+
[name, 'satisfied'].each do |mod_name|
|
273
|
+
metadata_file = "#{@modpath}/#{mod_name}/metadata.json"
|
274
|
+
Puppet::FileSystem.expects(:exist?).with(metadata_file).twice.returns true
|
275
|
+
end
|
264
276
|
mod = PuppetSpec::Modules.create(
|
265
277
|
name,
|
266
278
|
@modpath,
|
@@ -6,15 +6,42 @@ describe Puppet::ModuleTool::Applications::Builder do
|
|
6
6
|
include PuppetSpec::Files
|
7
7
|
|
8
8
|
let(:path) { tmpdir("working_dir") }
|
9
|
-
let(:module_name) { '
|
9
|
+
let(:module_name) { 'mymodule-mytarball' }
|
10
10
|
let(:version) { '0.0.1' }
|
11
11
|
let(:release_name) { "#{module_name}-#{version}" }
|
12
12
|
let(:tarball) { File.join(path, 'pkg', release_name) + ".tar.gz" }
|
13
13
|
let(:builder) { Puppet::ModuleTool::Applications::Builder.new(path) }
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
context 'with metadata.json' do
|
16
|
+
before :each do
|
17
|
+
File.open(File.join(path, 'metadata.json'), 'w') do |f|
|
18
|
+
f.puts({
|
19
|
+
"name" => "#{module_name}",
|
20
|
+
"version" => "#{version}",
|
21
|
+
"source" => "http://github.com/testing/#{module_name}",
|
22
|
+
"author" => "testing",
|
23
|
+
"license" => "Apache License Version 2.0",
|
24
|
+
"summary" => "Puppet testing module",
|
25
|
+
"description" => "This module can be used for basic testing",
|
26
|
+
"project_page" => "http://github.com/testing/#{module_name}"
|
27
|
+
}.to_json)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "packages the module in a tarball named after the module" do
|
32
|
+
tarrer = mock('tarrer')
|
33
|
+
Puppet::ModuleTool::Tar.expects(:instance).returns(tarrer)
|
34
|
+
Dir.expects(:chdir).with(File.join(path, 'pkg')).yields
|
35
|
+
tarrer.expects(:pack).with(release_name, tarball)
|
36
|
+
|
37
|
+
builder.run
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with Modulefile' do
|
42
|
+
before :each do
|
43
|
+
File.open(File.join(path, 'Modulefile'), 'w') do |f|
|
44
|
+
f.write <<-MODULEFILE
|
18
45
|
name '#{module_name}'
|
19
46
|
version '#{version}'
|
20
47
|
source 'http://github.com/testing/#{module_name}'
|
@@ -23,16 +50,17 @@ license 'Apache License Version 2.0'
|
|
23
50
|
summary 'Puppet testing module'
|
24
51
|
description 'This module can be used for basic testing'
|
25
52
|
project_page 'http://github.com/testing/#{module_name}'
|
26
|
-
|
53
|
+
MODULEFILE
|
54
|
+
end
|
27
55
|
end
|
28
|
-
end
|
29
56
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
57
|
+
it "packages the module in a tarball named after the module" do
|
58
|
+
tarrer = mock('tarrer')
|
59
|
+
Puppet::ModuleTool::Tar.expects(:instance).returns(tarrer)
|
60
|
+
Dir.expects(:chdir).with(File.join(path, 'pkg')).yields
|
61
|
+
tarrer.expects(:pack).with(release_name, tarball)
|
35
62
|
|
36
|
-
|
63
|
+
builder.run
|
64
|
+
end
|
37
65
|
end
|
38
66
|
end
|
@@ -1,134 +1,115 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'puppet/module_tool/applications'
|
3
|
+
require 'puppet_spec/files'
|
4
|
+
require 'pathname'
|
3
5
|
|
4
6
|
describe Puppet::ModuleTool::Applications::Checksummer do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
let(:
|
10
|
-
let(:module_metadata_file) { 'metadata.json' }
|
11
|
-
|
12
|
-
let(:module_install_pathname) {
|
13
|
-
module_install_pathname = mock()
|
14
|
-
Pathname.expects(:new).with(module_install_path).\
|
15
|
-
returns(module_install_pathname)
|
16
|
-
module_install_pathname
|
17
|
-
}
|
18
|
-
|
19
|
-
def stub_module_file_pathname(relative_path, present)
|
20
|
-
module_file_pathname = mock() do
|
21
|
-
expects(:exist?).with().returns(present)
|
22
|
-
end
|
7
|
+
let(:tmpdir) do
|
8
|
+
Pathname.new(PuppetSpec::Files.tmpdir('checksummer'))
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:checksums) { Puppet::ModuleTool::Checksums.new(tmpdir).data }
|
23
12
|
|
24
|
-
|
25
|
-
|
13
|
+
subject do
|
14
|
+
described_class.run(tmpdir)
|
15
|
+
end
|
26
16
|
|
27
|
-
|
17
|
+
before do
|
18
|
+
File.open(tmpdir + 'README', 'w') { |f| f.puts "This is a README!" }
|
19
|
+
File.open(tmpdir + 'CHANGES', 'w') { |f| f.puts "This is a changelog!" }
|
20
|
+
File.open(tmpdir + 'DELETEME', 'w') { |f| f.puts "I've got a really good feeling about this!" }
|
21
|
+
Dir.mkdir(tmpdir + 'pkg')
|
22
|
+
File.open(tmpdir + 'pkg' + 'build-artifact', 'w') { |f| f.puts "I'm unimportant!" }
|
23
|
+
File.open(tmpdir + 'metadata.json', 'w') { |f| f.puts '{"name": "package-name", "version": "1.0.0"}' }
|
24
|
+
File.open(tmpdir + 'checksums.json', 'w') { |f| f.puts '{}' }
|
28
25
|
end
|
29
26
|
|
30
|
-
context
|
31
|
-
before
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
context 'with checksums.json' do
|
28
|
+
before do
|
29
|
+
File.open(tmpdir + 'checksums.json', 'w') { |f| f.puts checksums.to_json }
|
30
|
+
File.open(tmpdir + 'CHANGES', 'w') { |f| f.puts "This is a changed log!" }
|
31
|
+
File.open(tmpdir + 'pkg' + 'build-artifact', 'w') { |f| f.puts "I'm still unimportant!" }
|
32
|
+
(tmpdir + 'DELETEME').unlink
|
35
33
|
end
|
36
34
|
|
37
|
-
it '
|
38
|
-
|
39
|
-
subject.run
|
40
|
-
}.should raise_error(ArgumentError, 'No metadata.json found.')
|
35
|
+
it 'reports changed files' do
|
36
|
+
expect(subject).to include 'CHANGES'
|
41
37
|
end
|
42
|
-
end
|
43
38
|
|
44
|
-
|
45
|
-
|
46
|
-
'README' => '1',
|
47
|
-
'CHANGELOG' => '2',
|
48
|
-
'Modulefile' => '3',
|
49
|
-
}
|
50
|
-
let(:module_files) { module_files }
|
51
|
-
let(:checksum_computer) {
|
52
|
-
checksum_computer = mock()
|
53
|
-
Puppet::ModuleTool::Checksums.\
|
54
|
-
expects(:new).with(module_install_pathname).\
|
55
|
-
returns(checksum_computer)
|
56
|
-
checksum_computer
|
57
|
-
}
|
58
|
-
# all possible combinations (of all lengths) of the module files
|
59
|
-
module_files_combination =
|
60
|
-
1.upto(module_files.size()).inject([]) { |module_files_combination, n|
|
61
|
-
module_files.keys.combination(n) { |combination|
|
62
|
-
module_files_combination << combination
|
63
|
-
}
|
64
|
-
module_files_combination
|
65
|
-
}
|
66
|
-
|
67
|
-
def stub_module_file_pathname_with_checksum(relative_path, checksum)
|
68
|
-
module_file_pathname =
|
69
|
-
stub_module_file_pathname(relative_path, present = !checksum.nil?)
|
70
|
-
# mock the call of Puppet::ModuleTool::Checksums#checksum
|
71
|
-
expectation = checksum_computer.\
|
72
|
-
expects(:checksum).with(module_file_pathname)
|
73
|
-
if present
|
74
|
-
# return the cheksum directly
|
75
|
-
expectation.returns(checksum)
|
76
|
-
else
|
77
|
-
# if the file is not present, then the method should not be called
|
78
|
-
expectation.times(0)
|
79
|
-
end
|
80
|
-
module_file_pathname
|
39
|
+
it 'reports removed files' do
|
40
|
+
expect(subject).to include 'DELETEME'
|
81
41
|
end
|
82
42
|
|
83
|
-
|
84
|
-
|
85
|
-
!module_files.include?(key)
|
86
|
-
}
|
87
|
-
module_files.merge(overrides).each { |relative_path, checksum|
|
88
|
-
stub_module_file_pathname_with_checksum(relative_path, checksum)
|
89
|
-
}
|
43
|
+
it 'does not report unchanged files' do
|
44
|
+
expect(subject).to_not include 'README'
|
90
45
|
end
|
91
46
|
|
92
|
-
|
93
|
-
|
94
|
-
subject.expects(:metadata_file).with().\
|
95
|
-
returns(module_install_pathname + module_metadata_file)
|
96
|
-
subject.expects(:metadata).with().\
|
97
|
-
returns({ 'checksums' => module_files })
|
47
|
+
it 'does not report build artifacts' do
|
48
|
+
expect(subject).to_not include 'pkg/build-artifact'
|
98
49
|
end
|
99
50
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
51
|
+
it 'does not report checksums.json' do
|
52
|
+
expect(subject).to_not include 'checksums.json'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'without checksums.json' do
|
57
|
+
context 'but with metadata.json containing checksums' do
|
58
|
+
before do
|
59
|
+
(tmpdir + 'checksums.json').unlink
|
60
|
+
File.open(tmpdir + 'metadata.json', 'w') { |f| f.puts "{\"checksums\":#{checksums.to_json}}" }
|
61
|
+
File.open(tmpdir + 'CHANGES', 'w') { |f| f.puts "This is a changed log!" }
|
62
|
+
File.open(tmpdir + 'pkg' + 'build-artifact', 'w') { |f| f.puts "I'm still unimportant!" }
|
63
|
+
(tmpdir + 'DELETEME').unlink
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'reports changed files' do
|
67
|
+
expect(subject).to include 'CHANGES'
|
68
|
+
end
|
108
69
|
|
109
|
-
|
70
|
+
it 'reports removed files' do
|
71
|
+
expect(subject).to include 'DELETEME'
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'does not report unchanged files' do
|
75
|
+
expect(subject).to_not include 'README'
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'does not report build artifacts' do
|
79
|
+
expect(subject).to_not include 'pkg/build-artifact'
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'does not report checksums.json' do
|
83
|
+
expect(subject).to_not include 'checksums.json'
|
110
84
|
end
|
111
85
|
end
|
112
86
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
)
|
123
|
-
|
124
|
-
subject.run.should == modified_files
|
87
|
+
context 'and with metadata.json that does not contain checksums' do
|
88
|
+
before do
|
89
|
+
(tmpdir + 'checksums.json').unlink
|
90
|
+
File.open(tmpdir + 'CHANGES', 'w') { |f| f.puts "This is a changed log!" }
|
91
|
+
File.open(tmpdir + 'pkg' + 'build-artifact', 'w') { |f| f.puts "I'm still unimportant!" }
|
92
|
+
(tmpdir + 'DELETEME').unlink
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'fails' do
|
96
|
+
expect { subject }.to raise_error(ArgumentError, 'No file containing checksums found.')
|
125
97
|
end
|
126
98
|
end
|
127
99
|
|
128
|
-
|
129
|
-
|
100
|
+
context 'and without metadata.json' do
|
101
|
+
before do
|
102
|
+
(tmpdir + 'checksums.json').unlink
|
103
|
+
(tmpdir + 'metadata.json').unlink
|
130
104
|
|
131
|
-
|
105
|
+
File.open(tmpdir + 'CHANGES', 'w') { |f| f.puts "This is a changed log!" }
|
106
|
+
File.open(tmpdir + 'pkg' + 'build-artifact', 'w') { |f| f.puts "I'm still unimportant!" }
|
107
|
+
(tmpdir + 'DELETEME').unlink
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'fails' do
|
111
|
+
expect { subject }.to raise_error(ArgumentError, 'No file containing checksums found.')
|
112
|
+
end
|
132
113
|
end
|
133
114
|
end
|
134
115
|
end
|
@@ -1,331 +1,363 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'puppet/module_tool/applications'
|
3
|
-
require 'puppet_spec/
|
3
|
+
require 'puppet_spec/module_tool/shared_functions'
|
4
|
+
require 'puppet_spec/module_tool/stub_source'
|
4
5
|
require 'semver'
|
5
6
|
|
6
7
|
describe Puppet::ModuleTool::Applications::Installer do
|
8
|
+
include PuppetSpec::ModuleTool::SharedFunctions
|
7
9
|
include PuppetSpec::Files
|
10
|
+
include PuppetSpec::Fixtures
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
path = File.join(tmpdir("installer"), "modpath1")
|
13
|
-
FileUtils.mkdir_p(path)
|
14
|
-
path
|
15
|
-
end
|
16
|
-
let(:stdlib_pkg) do
|
17
|
-
mod = File.join(modpath1, "pmtacceptance-stdlib-0.0.1.tar.gz")
|
18
|
-
FileUtils.touch(mod)
|
19
|
-
mod
|
20
|
-
end
|
21
|
-
let(:env) { Puppet::Node::Environment.create(:env, [modpath1]) }
|
22
|
-
let(:options) do
|
23
|
-
{
|
24
|
-
:target_dir => modpath1,
|
25
|
-
:environment_instance => env,
|
26
|
-
}
|
12
|
+
before do
|
13
|
+
FileUtils.mkdir_p(primary_dir)
|
14
|
+
FileUtils.mkdir_p(secondary_dir)
|
27
15
|
end
|
28
16
|
|
29
|
-
let(:
|
30
|
-
|
17
|
+
let(:vardir) { tmpdir('installer') }
|
18
|
+
let(:primary_dir) { File.join(vardir, "primary") }
|
19
|
+
let(:secondary_dir) { File.join(vardir, "secondary") }
|
20
|
+
let(:remote_source) { PuppetSpec::ModuleTool::StubSource.new }
|
31
21
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
forge.stubs(:retrieve).with(release['file']).returns("/fake_cache#{release['file']}")
|
37
|
-
end
|
22
|
+
let(:install_dir) do
|
23
|
+
mock("Puppet::ModuleTool::InstallDirectory").tap do |dir|
|
24
|
+
dir.stubs(:prepare)
|
25
|
+
dir.stubs(:target).returns(primary_dir)
|
38
26
|
end
|
27
|
+
end
|
39
28
|
|
40
|
-
|
29
|
+
before do
|
30
|
+
Semantic::Dependency.clear_sources
|
31
|
+
installer = Puppet::ModuleTool::Applications::Installer.any_instance
|
32
|
+
installer.stubs(:module_repository).returns(remote_source)
|
41
33
|
end
|
42
34
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
install_dir
|
35
|
+
def installer(modname, target_dir, options)
|
36
|
+
Puppet::ModuleTool.set_option_defaults(options)
|
37
|
+
Puppet::ModuleTool::Applications::Installer.new(modname, target_dir, options)
|
47
38
|
end
|
48
39
|
|
49
|
-
let(:
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"file" => "/pmtacceptance-apache-1.0.0-alpha.tar.gz" },
|
55
|
-
{ "dependencies" => [],
|
56
|
-
"version" => "1.0.0-beta",
|
57
|
-
"file" => "/pmtacceptance-apache-1.0.0-beta.tar.gz" },
|
58
|
-
{ "dependencies" => [],
|
59
|
-
"version" => "1.0.0-rc1",
|
60
|
-
"file" => "/pmtacceptance-apache-1.0.0-rc1.tar.gz" },
|
61
|
-
],
|
62
|
-
"pmtacceptance/stdlib" => [
|
63
|
-
{ "dependencies" => [],
|
64
|
-
"version" => "0.0.1",
|
65
|
-
"file" => "/pmtacceptance-stdlib-0.0.1.tar.gz" },
|
66
|
-
{ "dependencies" => [],
|
67
|
-
"version" => "0.0.2",
|
68
|
-
"file" => "/pmtacceptance-stdlib-0.0.2.tar.gz" },
|
69
|
-
{ "dependencies" => [],
|
70
|
-
"version" => "1.0.0-pre",
|
71
|
-
"file" => "/pmtacceptance-stdlib-1.0.0-pre.tar.gz" },
|
72
|
-
{ "dependencies" => [],
|
73
|
-
"version" => "1.0.0",
|
74
|
-
"file" => "/pmtacceptance-stdlib-1.0.0.tar.gz" },
|
75
|
-
{ "dependencies" => [],
|
76
|
-
"version" => "1.5.0-pre",
|
77
|
-
"file" => "/pmtacceptance-stdlib-1.5.0-pre.tar.gz" },
|
78
|
-
],
|
79
|
-
"pmtacceptance/java" => [
|
80
|
-
{ "dependencies" => [["pmtacceptance/stdlib", ">= 0.0.1"]],
|
81
|
-
"version" => "1.7.0",
|
82
|
-
"file" => "/pmtacceptance-java-1.7.0.tar.gz" },
|
83
|
-
{ "dependencies" => [["pmtacceptance/stdlib", "1.0.0"]],
|
84
|
-
"version" => "1.7.1",
|
85
|
-
"file" => "/pmtacceptance-java-1.7.1.tar.gz" }
|
86
|
-
],
|
87
|
-
"pmtacceptance/apollo" => [
|
88
|
-
{ "dependencies" => [
|
89
|
-
["pmtacceptance/java", "1.7.1"],
|
90
|
-
["pmtacceptance/stdlib", "0.0.1"]
|
91
|
-
],
|
92
|
-
"version" => "0.0.1",
|
93
|
-
"file" => "/pmtacceptance-apollo-0.0.1.tar.gz" },
|
94
|
-
{ "dependencies" => [
|
95
|
-
["pmtacceptance/java", ">= 1.7.0"],
|
96
|
-
["pmtacceptance/stdlib", ">= 1.0.0"]
|
97
|
-
],
|
98
|
-
"version" => "0.0.2",
|
99
|
-
"file" => "/pmtacceptance-apollo-0.0.2.tar.gz" }
|
100
|
-
]
|
101
|
-
}
|
40
|
+
let(:environment) do
|
41
|
+
Puppet.lookup(:current_environment).override_with(
|
42
|
+
:vardir => vardir,
|
43
|
+
:modulepath => [ primary_dir, secondary_dir ]
|
44
|
+
)
|
102
45
|
end
|
103
46
|
|
104
|
-
|
105
|
-
|
106
|
-
installer = installer_class.new("foo", forge, install_dir, options)
|
107
|
-
installer.send(:is_module_package?, stdlib_pkg).should be_true
|
108
|
-
end
|
47
|
+
context '#run' do
|
48
|
+
let(:module) { 'pmtacceptance-stdlib' }
|
109
49
|
|
110
|
-
|
111
|
-
|
112
|
-
installer.send(:is_module_package?, "pmtacceptance-apollo-0.0.2.tar").
|
113
|
-
should be_false
|
50
|
+
def options
|
51
|
+
{ :environment => environment }
|
114
52
|
end
|
115
|
-
end
|
116
53
|
|
117
|
-
|
118
|
-
|
119
|
-
lambda { installer_class.run('puppet', install_dir, params) }.should
|
120
|
-
raise_error(ArgumentError, "Could not install module with invalid name: puppet")
|
121
|
-
end
|
54
|
+
let(:application) { installer(self.module, install_dir, options) }
|
55
|
+
subject { application.run }
|
122
56
|
|
123
|
-
it
|
124
|
-
|
125
|
-
|
126
|
-
returns(unpacker)
|
127
|
-
results = installer_class.run('pmtacceptance-stdlib', forge, install_dir, options)
|
128
|
-
results[:installed_modules].length == 1
|
129
|
-
results[:installed_modules][0][:module].should == "pmtacceptance-stdlib"
|
130
|
-
results[:installed_modules][0][:version][:vstring].should == "1.0.0"
|
57
|
+
it 'installs the specified module' do
|
58
|
+
subject.should include :result => :success
|
59
|
+
graph_should_include 'pmtacceptance-stdlib', nil => v('4.1.0')
|
131
60
|
end
|
132
61
|
|
133
|
-
|
134
|
-
|
135
|
-
with('/fake_cache/pmtacceptance-apache-1.0.0-rc1.tar.gz', options).
|
136
|
-
returns(unpacker)
|
137
|
-
results = installer_class.run('pmtacceptance-apache', forge, install_dir, options)
|
138
|
-
results[:installed_modules].length == 1
|
139
|
-
results[:installed_modules][0][:module].should == "pmtacceptance-apache"
|
140
|
-
results[:installed_modules][0][:version][:vstring].should == "1.0.0-rc1"
|
141
|
-
end
|
62
|
+
context 'with a tarball file' do
|
63
|
+
let(:module) { fixtures('stdlib.tgz') }
|
142
64
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
results = installer_class.run('pmtacceptance-stdlib', forge, install_dir, options.merge(:version => '1.x'))
|
148
|
-
results[:installed_modules].length == 1
|
149
|
-
results[:installed_modules][0][:module].should == "pmtacceptance-stdlib"
|
150
|
-
results[:installed_modules][0][:version][:vstring].should == "1.0.0"
|
151
|
-
end
|
65
|
+
it 'installs the specified tarball' do
|
66
|
+
subject.should include :result => :success
|
67
|
+
graph_should_include 'puppetlabs-stdlib', nil => v('3.2.0')
|
68
|
+
end
|
152
69
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
results = installer_class.run('pmtacceptance-stdlib', forge, install_dir, options.merge(:version => '1.5.0-pre'))
|
158
|
-
results[:installed_modules].length == 1
|
159
|
-
results[:installed_modules][0][:module].should == "pmtacceptance-stdlib"
|
160
|
-
results[:installed_modules][0][:version][:vstring].should == "1.5.0-pre"
|
161
|
-
end
|
70
|
+
context 'with --ignore-dependencies' do
|
71
|
+
def options
|
72
|
+
super.merge(:ignore_dependencies => true)
|
73
|
+
end
|
162
74
|
|
163
|
-
|
164
|
-
|
165
|
-
|
75
|
+
it 'installs the specified tarball' do
|
76
|
+
remote_source.expects(:fetch).never
|
77
|
+
subject.should include :result => :success
|
78
|
+
graph_should_include 'puppetlabs-stdlib', nil => v('3.2.0')
|
79
|
+
end
|
166
80
|
end
|
167
81
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
82
|
+
context 'with dependencies' do
|
83
|
+
let(:module) { fixtures('java.tgz') }
|
84
|
+
|
85
|
+
it 'installs the specified tarball' do
|
86
|
+
subject.should include :result => :success
|
87
|
+
graph_should_include 'puppetlabs-java', nil => v('1.0.0')
|
88
|
+
graph_should_include 'puppetlabs-stdlib', nil => v('4.1.0')
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'with --ignore-dependencies' do
|
92
|
+
def options
|
93
|
+
super.merge(:ignore_dependencies => true)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'installs the specified tarball without dependencies' do
|
97
|
+
remote_source.expects(:fetch).never
|
98
|
+
subject.should include :result => :success
|
99
|
+
graph_should_include 'puppetlabs-java', nil => v('1.0.0')
|
100
|
+
graph_should_include 'puppetlabs-stdlib', nil
|
101
|
+
end
|
102
|
+
end
|
172
103
|
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'with dependencies' do
|
107
|
+
let(:module) { 'pmtacceptance-apache' }
|
173
108
|
|
174
|
-
|
175
|
-
|
109
|
+
it 'installs the specified module and its dependencies' do
|
110
|
+
subject.should include :result => :success
|
111
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.10.0')
|
112
|
+
graph_should_include 'pmtacceptance-stdlib', nil => v('4.1.0')
|
176
113
|
end
|
177
114
|
|
178
|
-
|
179
|
-
|
180
|
-
|
115
|
+
context 'and using --ignore_dependencies' do
|
116
|
+
def options
|
117
|
+
super.merge(:ignore_dependencies => true)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'installs only the specified module' do
|
121
|
+
subject.should include :result => :success
|
122
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.10.0')
|
123
|
+
graph_should_include 'pmtacceptance-stdlib', nil
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'that are already installed' do
|
128
|
+
context 'and satisfied' do
|
129
|
+
before { preinstall('pmtacceptance-stdlib', '4.1.0') }
|
130
|
+
|
131
|
+
it 'installs only the specified module' do
|
132
|
+
subject.should include :result => :success
|
133
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.10.0')
|
134
|
+
graph_should_include 'pmtacceptance-stdlib', :path => primary_dir
|
135
|
+
end
|
136
|
+
|
137
|
+
context '(outdated but suitable version)' do
|
138
|
+
before { preinstall('pmtacceptance-stdlib', '2.4.0') }
|
139
|
+
|
140
|
+
it 'installs only the specified module' do
|
141
|
+
subject.should include :result => :success
|
142
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.10.0')
|
143
|
+
graph_should_include 'pmtacceptance-stdlib', v('2.4.0') => v('2.4.0'), :path => primary_dir
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context '(outdated and unsuitable version)' do
|
148
|
+
before { preinstall('pmtacceptance-stdlib', '1.0.0') }
|
149
|
+
|
150
|
+
it 'installs a version that is compatible with the installed dependencies' do
|
151
|
+
subject.should include :result => :success
|
152
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.0.4')
|
153
|
+
graph_should_include 'pmtacceptance-stdlib', nil
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
181
157
|
|
182
|
-
|
158
|
+
context 'but not satisfied' do
|
159
|
+
let(:module) { 'pmtacceptance-keystone' }
|
183
160
|
|
184
|
-
|
185
|
-
|
186
|
-
|
161
|
+
def options
|
162
|
+
super.merge(:version => '2.0.0')
|
163
|
+
end
|
164
|
+
|
165
|
+
before { preinstall('pmtacceptance-mysql', '2.1.0') }
|
166
|
+
|
167
|
+
it 'installs only the specified module' do
|
168
|
+
subject.should include :result => :success
|
169
|
+
graph_should_include 'pmtacceptance-keystone', nil => v('2.0.0')
|
170
|
+
graph_should_include 'pmtacceptance-mysql', v('2.1.0') => v('2.1.0')
|
171
|
+
graph_should_include 'pmtacceptance-stdlib', nil
|
172
|
+
end
|
173
|
+
end
|
187
174
|
end
|
188
175
|
|
189
|
-
|
190
|
-
|
191
|
-
|
176
|
+
context 'that are already installed in other modulepath directories' do
|
177
|
+
before { preinstall('pmtacceptance-stdlib', '1.0.0', :into => secondary_dir) }
|
178
|
+
let(:module) { 'pmtacceptance-apache' }
|
179
|
+
|
180
|
+
context 'without dependency updates' do
|
181
|
+
it 'installs the module only' do
|
182
|
+
subject.should include :result => :success
|
183
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.0.4')
|
184
|
+
graph_should_include 'pmtacceptance-stdlib', nil
|
185
|
+
end
|
186
|
+
end
|
192
187
|
|
193
|
-
|
188
|
+
context 'with dependency updates' do
|
189
|
+
before { preinstall('pmtacceptance-stdlib', '2.0.0', :into => secondary_dir) }
|
194
190
|
|
195
|
-
|
196
|
-
|
191
|
+
it 'installs the module and upgrades dependencies in-place' do
|
192
|
+
subject.should include :result => :success
|
193
|
+
graph_should_include 'pmtacceptance-apache', nil => v('0.10.0')
|
194
|
+
graph_should_include 'pmtacceptance-stdlib', v('2.0.0') => v('2.6.0'), :path => secondary_dir
|
195
|
+
end
|
196
|
+
end
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
context
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
Puppet::ModuleTool::Applications::Unpacker.expects(:new).
|
206
|
-
with('/fake_cache/pmtacceptance-apollo-0.0.2.tar.gz', options).
|
207
|
-
returns(unpacker)
|
208
|
-
Puppet::ModuleTool::Applications::Unpacker.expects(:new).
|
209
|
-
with('/fake_cache/pmtacceptance-java-1.7.1.tar.gz', options).
|
210
|
-
returns(unpacker)
|
211
|
-
|
212
|
-
results = installer_class.run('pmtacceptance-apollo', forge, install_dir, options)
|
213
|
-
installed_dependencies = results[:installed_modules][0][:dependencies]
|
214
|
-
|
215
|
-
dependencies = installed_dependencies.inject({}) do |result, dep|
|
216
|
-
result[dep[:module]] = dep[:version][:vstring]
|
217
|
-
result
|
200
|
+
context 'with a specified' do
|
201
|
+
|
202
|
+
context 'version' do
|
203
|
+
def options
|
204
|
+
super.merge(:version => '3.0.0')
|
218
205
|
end
|
219
206
|
|
220
|
-
|
221
|
-
|
222
|
-
|
207
|
+
it 'installs the specified release (or a prerelease thereof)' do
|
208
|
+
subject.should include :result => :success
|
209
|
+
graph_should_include 'pmtacceptance-stdlib', nil => v('3.0.0')
|
210
|
+
end
|
223
211
|
end
|
224
212
|
|
225
|
-
|
226
|
-
options
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
213
|
+
context 'version range' do
|
214
|
+
def options
|
215
|
+
super.merge(:version => '3.x')
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'installs the greatest available version matching that range' do
|
219
|
+
subject.should include :result => :success
|
220
|
+
graph_should_include 'pmtacceptance-stdlib', nil => v('3.2.0')
|
221
|
+
end
|
232
222
|
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'when depended upon' do
|
226
|
+
before { preinstall('pmtacceptance-keystone', '2.1.0') }
|
227
|
+
let(:module) { 'pmtacceptance-mysql' }
|
233
228
|
|
234
|
-
it
|
235
|
-
|
236
|
-
|
237
|
-
with('/fake_cache/pmtacceptance-apollo-0.0.2.tar.gz', options).
|
238
|
-
returns(unpacker)
|
239
|
-
results = installer_class.run('pmtacceptance-apollo', forge, install_dir, options)
|
240
|
-
dependencies = results[:installed_modules][0][:dependencies]
|
241
|
-
dependencies.should == []
|
229
|
+
it 'installs the greatest available version meeting the dependency constraints' do
|
230
|
+
subject.should include :result => :success
|
231
|
+
graph_should_include 'pmtacceptance-mysql', nil => v('0.9.0')
|
242
232
|
end
|
243
233
|
|
244
|
-
|
245
|
-
options
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
234
|
+
context 'with a --version that can satisfy' do
|
235
|
+
def options
|
236
|
+
super.merge(:version => '0.8.0')
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'installs the greatest available version satisfying both constraints' do
|
240
|
+
subject.should include :result => :success
|
241
|
+
graph_should_include 'pmtacceptance-mysql', nil => v('0.8.0')
|
242
|
+
end
|
252
243
|
end
|
253
244
|
|
254
|
-
|
255
|
-
options
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
245
|
+
context 'with a --version that cannot satisfy' do
|
246
|
+
def options
|
247
|
+
super.merge(:version => '> 1.0.0')
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'fails to install, since there is no version that can satisfy both constraints' do
|
251
|
+
subject.should include :result => :failure
|
252
|
+
end
|
253
|
+
|
254
|
+
context 'with --ignore-dependencies' do
|
255
|
+
def options
|
256
|
+
super.merge(:ignore_dependencies => true)
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'fails to install, since ignore_dependencies should still respect dependencies from installed modules' do
|
260
|
+
subject.should include :result => :failure
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
context 'with --force' do
|
265
|
+
def options
|
266
|
+
super.merge(:force => true)
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'installs the greatest available version, ignoring dependencies' do
|
270
|
+
subject.should include :result => :success
|
271
|
+
graph_should_include 'pmtacceptance-mysql', nil => v('2.1.0')
|
272
|
+
end
|
273
|
+
end
|
270
274
|
end
|
275
|
+
end
|
271
276
|
|
272
|
-
|
273
|
-
|
277
|
+
context 'when already installed' do
|
278
|
+
before { preinstall('pmtacceptance-stdlib', '1.0.0') }
|
274
279
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
]
|
280
|
+
context 'but matching the requested version' do
|
281
|
+
it 'does nothing, since the installed version satisfies' do
|
282
|
+
subject.should include :result => :noop
|
283
|
+
end
|
280
284
|
|
281
|
-
|
285
|
+
context 'with --force' do
|
286
|
+
def options
|
287
|
+
super.merge(:force => true)
|
288
|
+
end
|
282
289
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
returns(unpacker)
|
289
|
-
Puppet::ModuleTool::Applications::Unpacker.expects(:new).
|
290
|
-
with('/fake_cache/pmtacceptance-stdlib-1.0.0.tar.gz', options).
|
291
|
-
returns(unpacker)
|
290
|
+
it 'does reinstall the module' do
|
291
|
+
subject.should include :result => :success
|
292
|
+
graph_should_include 'pmtacceptance-stdlib', v('1.0.0') => v('4.1.0')
|
293
|
+
end
|
294
|
+
end
|
292
295
|
|
293
|
-
|
296
|
+
context 'with local changes' do
|
297
|
+
before do
|
298
|
+
release = application.send(:installed_modules)['pmtacceptance-stdlib']
|
299
|
+
mark_changed(release.mod.path)
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'does nothing, since local changes do not affect that' do
|
303
|
+
subject.should include :result => :noop
|
304
|
+
end
|
305
|
+
|
306
|
+
context 'with --force' do
|
307
|
+
def options
|
308
|
+
super.merge(:force => true)
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'does reinstall the module, since --force ignores local changes' do
|
312
|
+
subject.should include :result => :success
|
313
|
+
graph_should_include 'pmtacceptance-stdlib', v('1.0.0') => v('4.1.0')
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
294
318
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
end
|
319
|
+
context 'but not matching the requested version' do
|
320
|
+
def options
|
321
|
+
super.merge(:version => '2.x')
|
322
|
+
end
|
299
323
|
|
300
|
-
|
324
|
+
it 'fails to install the module, since it is already installed' do
|
325
|
+
subject.should include :result => :failure
|
326
|
+
subject[:error].should include :oneline => "'pmtacceptance-stdlib' (v2.x) requested; 'pmtacceptance-stdlib' (v1.0.0) already installed"
|
327
|
+
end
|
328
|
+
|
329
|
+
context 'with --force' do
|
330
|
+
def options
|
331
|
+
super.merge(:force => true)
|
332
|
+
end
|
333
|
+
|
334
|
+
it 'installs the greatest version matching the new version range' do
|
335
|
+
subject.should include :result => :success
|
336
|
+
graph_should_include 'pmtacceptance-stdlib', v('1.0.0') => v('2.6.0')
|
337
|
+
end
|
338
|
+
end
|
301
339
|
end
|
302
340
|
end
|
303
341
|
|
304
|
-
context
|
305
|
-
|
306
|
-
|
307
|
-
it "should upgrade local version when necessary to satisfy constraints"
|
308
|
-
it "should error when a local version can't be upgraded to satisfy constraints"
|
309
|
-
end
|
342
|
+
context 'when a module with the same name is already installed' do
|
343
|
+
let(:module) { 'pmtacceptance-stdlib' }
|
344
|
+
before { preinstall('puppetlabs-stdlib', '4.1.0') }
|
310
345
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
end
|
346
|
+
it 'fails to install, since two modules with the same name cannot be installed simultaneously' do
|
347
|
+
subject.should include :result => :failure
|
348
|
+
end
|
315
349
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
end
|
350
|
+
context 'using --force' do
|
351
|
+
def options
|
352
|
+
super.merge(:force => true)
|
353
|
+
end
|
321
354
|
|
322
|
-
|
323
|
-
|
324
|
-
|
355
|
+
it 'overwrites the existing module with the greatest version of the requested module' do
|
356
|
+
subject.should include :result => :success
|
357
|
+
graph_should_include 'pmtacceptance-stdlib', nil => v('4.1.0')
|
358
|
+
end
|
359
|
+
end
|
325
360
|
end
|
326
361
|
|
327
|
-
it "should error if it can't parse the name"
|
328
|
-
|
329
|
-
it "should try to get_release_package_from_filesystem if it has a valid name"
|
330
362
|
end
|
331
363
|
end
|