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
@@ -58,85 +58,22 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
58
58
|
EOT
|
59
59
|
|
60
60
|
when_invoked do |options|
|
61
|
-
|
62
|
-
|
61
|
+
Puppet::ModuleTool.set_option_defaults(options)
|
62
|
+
environment = options[:environment_instance]
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
error_types = {
|
69
|
-
:non_semantic_version => {
|
70
|
-
:title => "Non semantic version dependency"
|
71
|
-
},
|
72
|
-
:missing => {
|
73
|
-
:title => "Missing dependency"
|
74
|
-
},
|
75
|
-
:version_mismatch => {
|
76
|
-
:title => "Module '%s' (v%s) fails to meet some dependencies:"
|
77
|
-
}
|
64
|
+
{
|
65
|
+
:environment => environment,
|
66
|
+
:modules_by_path => environment.modules_by_path,
|
78
67
|
}
|
68
|
+
end
|
79
69
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
hash[key] = { :errors => [], :parent => nil }
|
84
|
-
end
|
85
|
-
end
|
70
|
+
when_rendering :console do |result, options|
|
71
|
+
environment = result[:environment]
|
72
|
+
modules_by_path = result[:modules_by_path]
|
86
73
|
|
87
|
-
|
88
|
-
environment.modules.sort_by {|mod| mod.name}.each do |mod|
|
89
|
-
unmet_grouped = Hash.new { |h,k| h[k] = [] }
|
90
|
-
unmet_grouped = mod.unmet_dependencies.inject(unmet_grouped) do |acc, dep|
|
91
|
-
acc[dep[:reason]] << dep
|
92
|
-
acc
|
93
|
-
end
|
94
|
-
unmet_grouped.each do |type, deps|
|
95
|
-
unless deps.empty?
|
96
|
-
unmet_grouped[type].sort_by { |dep| dep[:name] }.each do |dep|
|
97
|
-
dep_name = dep[:name].gsub('/', '-')
|
98
|
-
installed_version = dep[:mod_details][:installed_version]
|
99
|
-
version_constraint = dep[:version_constraint]
|
100
|
-
parent_name = dep[:parent][:name].gsub('/', '-')
|
101
|
-
parent_version = dep[:parent][:version]
|
102
|
-
|
103
|
-
msg = "'#{parent_name}' (#{parent_version})"
|
104
|
-
msg << " requires '#{dep_name}' (#{version_constraint})"
|
105
|
-
@unmet_deps[type][dep[:name]][:errors] << msg
|
106
|
-
@unmet_deps[type][dep[:name]][:parent] = {
|
107
|
-
:name => dep[:parent][:name],
|
108
|
-
:version => parent_version
|
109
|
-
}
|
110
|
-
@unmet_deps[type][dep[:name]][:version] = installed_version
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
74
|
+
output = ''
|
115
75
|
|
116
|
-
|
117
|
-
error_display_order = [:non_semantic_version, :version_mismatch, :missing]
|
118
|
-
error_display_order.each do |type|
|
119
|
-
unless @unmet_deps[type].empty?
|
120
|
-
@unmet_deps[type].keys.sort_by {|dep| dep }.each do |dep|
|
121
|
-
name = dep.gsub('/', '-')
|
122
|
-
title = error_types[type][:title]
|
123
|
-
errors = @unmet_deps[type][dep][:errors]
|
124
|
-
version = @unmet_deps[type][dep][:version]
|
125
|
-
|
126
|
-
msg = case type
|
127
|
-
when :version_mismatch
|
128
|
-
title % [name, version] + "\n"
|
129
|
-
when :non_semantic_version
|
130
|
-
title + " '#{name}' (v#{version}):\n"
|
131
|
-
else
|
132
|
-
title + " '#{name}':\n"
|
133
|
-
end
|
134
|
-
|
135
|
-
errors.each { |error_string| msg << " #{error_string}\n" }
|
136
|
-
Puppet.warning msg.chomp
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
76
|
+
warn_unmet_dependencies(environment)
|
140
77
|
|
141
78
|
environment.modulepath.each do |path|
|
142
79
|
modules = modules_by_path[path]
|
@@ -166,14 +103,78 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
166
103
|
end
|
167
104
|
end
|
168
105
|
|
169
|
-
def
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
106
|
+
def warn_unmet_dependencies(environment)
|
107
|
+
error_types = {
|
108
|
+
:non_semantic_version => {
|
109
|
+
:title => "Non semantic version dependency"
|
110
|
+
},
|
111
|
+
:missing => {
|
112
|
+
:title => "Missing dependency"
|
113
|
+
},
|
114
|
+
:version_mismatch => {
|
115
|
+
:title => "Module '%s' (v%s) fails to meet some dependencies:"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
@unmet_deps = {}
|
120
|
+
error_types.each_key do |type|
|
121
|
+
@unmet_deps[type] = Hash.new do |hash, key|
|
122
|
+
hash[key] = { :errors => [], :parent => nil }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Prepare the unmet dependencies for display on the console.
|
127
|
+
environment.modules.sort_by {|mod| mod.name}.each do |mod|
|
128
|
+
unmet_grouped = Hash.new { |h,k| h[k] = [] }
|
129
|
+
unmet_grouped = mod.unmet_dependencies.inject(unmet_grouped) do |acc, dep|
|
130
|
+
acc[dep[:reason]] << dep
|
131
|
+
acc
|
132
|
+
end
|
133
|
+
unmet_grouped.each do |type, deps|
|
134
|
+
unless deps.empty?
|
135
|
+
unmet_grouped[type].sort_by { |dep| dep[:name] }.each do |dep|
|
136
|
+
dep_name = dep[:name].gsub('/', '-')
|
137
|
+
installed_version = dep[:mod_details][:installed_version]
|
138
|
+
version_constraint = dep[:version_constraint]
|
139
|
+
parent_name = dep[:parent][:name].gsub('/', '-')
|
140
|
+
parent_version = dep[:parent][:version]
|
141
|
+
|
142
|
+
msg = "'#{parent_name}' (#{parent_version})"
|
143
|
+
msg << " requires '#{dep_name}' (#{version_constraint})"
|
144
|
+
@unmet_deps[type][dep[:name]][:errors] << msg
|
145
|
+
@unmet_deps[type][dep[:name]][:parent] = {
|
146
|
+
:name => dep[:parent][:name],
|
147
|
+
:version => parent_version
|
148
|
+
}
|
149
|
+
@unmet_deps[type][dep[:name]][:version] = installed_version
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Display unmet dependencies by category.
|
156
|
+
error_display_order = [:non_semantic_version, :version_mismatch, :missing]
|
157
|
+
error_display_order.each do |type|
|
158
|
+
unless @unmet_deps[type].empty?
|
159
|
+
@unmet_deps[type].keys.sort_by {|dep| dep }.each do |dep|
|
160
|
+
name = dep.gsub('/', '-')
|
161
|
+
title = error_types[type][:title]
|
162
|
+
errors = @unmet_deps[type][dep][:errors]
|
163
|
+
version = @unmet_deps[type][dep][:version]
|
164
|
+
|
165
|
+
msg = case type
|
166
|
+
when :version_mismatch
|
167
|
+
title % [name, version] + "\n"
|
168
|
+
when :non_semantic_version
|
169
|
+
title + " '#{name}' (v#{version}):\n"
|
170
|
+
else
|
171
|
+
title + " '#{name}':\n"
|
172
|
+
end
|
173
|
+
|
174
|
+
errors.each { |error_string| msg << " #{error_string}\n" }
|
175
|
+
Puppet.warning msg.chomp
|
176
|
+
end
|
177
|
+
end
|
177
178
|
end
|
178
179
|
end
|
179
180
|
|
@@ -23,7 +23,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
23
23
|
|
24
24
|
when_invoked do |term, options|
|
25
25
|
Puppet::ModuleTool.set_option_defaults options
|
26
|
-
Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new
|
26
|
+
Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new, options).run
|
27
27
|
end
|
28
28
|
|
29
29
|
when_rendering :console do |results, term, options|
|
@@ -40,9 +40,9 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
option "--ignore-dependencies" do
|
43
|
-
summary "Do not attempt to install dependencies
|
43
|
+
summary "Do not attempt to install dependencies"
|
44
44
|
description <<-EOT
|
45
|
-
Do not attempt to install dependencies
|
45
|
+
Do not attempt to install dependencies. (Implied by --force.)
|
46
46
|
EOT
|
47
47
|
end
|
48
48
|
|
@@ -57,19 +57,20 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
57
57
|
name = name.gsub('/', '-')
|
58
58
|
Puppet.notice "Preparing to upgrade '#{name}' ..."
|
59
59
|
Puppet::ModuleTool.set_option_defaults options
|
60
|
-
Puppet::ModuleTool::Applications::Upgrader.new(name,
|
60
|
+
Puppet::ModuleTool::Applications::Upgrader.new(name, options).run
|
61
61
|
end
|
62
62
|
|
63
63
|
when_rendering :console do |return_value|
|
64
|
-
if return_value[:result] == :
|
64
|
+
if return_value[:result] == :noop
|
65
|
+
Puppet.notice return_value[:error][:multiline]
|
66
|
+
exit 0
|
67
|
+
elsif return_value[:result] == :failure
|
65
68
|
Puppet.err(return_value[:error][:multiline])
|
66
69
|
exit 1
|
67
|
-
elsif return_value[:result] == :noop
|
68
|
-
Puppet.err(return_value[:error][:multiline])
|
69
|
-
exit 0
|
70
70
|
else
|
71
|
-
tree = Puppet::ModuleTool.build_tree(return_value[:
|
72
|
-
|
71
|
+
tree = Puppet::ModuleTool.build_tree(return_value[:graph], return_value[:base_dir])
|
72
|
+
|
73
|
+
"#{return_value[:base_dir]}\n" +
|
73
74
|
Puppet::ModuleTool.format_tree(tree)
|
74
75
|
end
|
75
76
|
end
|
data/lib/puppet/face/parser.rb
CHANGED
@@ -37,8 +37,9 @@ Puppet::Face.define(:parser, '0.0.1') do
|
|
37
37
|
Puppet[:code] = STDIN.read
|
38
38
|
validate_manifest
|
39
39
|
else
|
40
|
-
|
41
|
-
|
40
|
+
manifest = Puppet.lookup(:current_environment).manifest
|
41
|
+
files << manifest
|
42
|
+
Puppet.notice "No manifest specified. Validating the default manifest #{manifest}"
|
42
43
|
end
|
43
44
|
end
|
44
45
|
missing_files = []
|
data/lib/puppet/face/plugin.rb
CHANGED
@@ -38,16 +38,20 @@ Puppet::Face.define(:plugin, '0.0.1') do
|
|
38
38
|
|
39
39
|
when_invoked do |options|
|
40
40
|
require 'puppet/configurer/downloader'
|
41
|
-
Puppet::
|
41
|
+
remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment])
|
42
|
+
result = Puppet::Configurer::Downloader.new("plugin",
|
42
43
|
Puppet[:plugindest],
|
43
44
|
Puppet[:pluginsource],
|
44
|
-
Puppet[:pluginsignore]
|
45
|
+
Puppet[:pluginsignore],
|
46
|
+
remote_environment_for_plugins).evaluate
|
45
47
|
if Puppet.features.external_facts?
|
46
|
-
Puppet::Configurer::Downloader.new("pluginfacts",
|
48
|
+
result += Puppet::Configurer::Downloader.new("pluginfacts",
|
47
49
|
Puppet[:pluginfactdest],
|
48
50
|
Puppet[:pluginfactsource],
|
49
|
-
Puppet[:pluginsignore]
|
51
|
+
Puppet[:pluginsignore],
|
52
|
+
remote_environment_for_plugins).evaluate
|
50
53
|
end
|
54
|
+
result
|
51
55
|
end
|
52
56
|
|
53
57
|
when_rendering :console do |value|
|
@@ -4,6 +4,7 @@ require 'puppet/file_bucket/file'
|
|
4
4
|
require 'puppet/indirector/request'
|
5
5
|
|
6
6
|
class Puppet::FileBucket::Dipper
|
7
|
+
include Puppet::Util::Checksums
|
7
8
|
# This is a transitional implementation that uses REST
|
8
9
|
# to access remote filebucket files.
|
9
10
|
|
@@ -23,6 +24,8 @@ class Puppet::FileBucket::Dipper
|
|
23
24
|
@local_path = nil
|
24
25
|
@rest_path = "https://#{server}:#{port}/#{environment}/file_bucket_file/"
|
25
26
|
end
|
27
|
+
@checksum_type = Puppet[:digest_algorithm].to_sym
|
28
|
+
@digest = method(@checksum_type)
|
26
29
|
end
|
27
30
|
|
28
31
|
def local?
|
@@ -56,7 +59,7 @@ class Puppet::FileBucket::Dipper
|
|
56
59
|
|
57
60
|
# Retrieve a file by sum.
|
58
61
|
def getfile(sum)
|
59
|
-
source_path = "#{@rest_path}
|
62
|
+
source_path = "#{@rest_path}#{@checksum_type}/#{sum}"
|
60
63
|
file_bucket_file = Puppet::FileBucket::File.indirection.find(source_path, :bucket_path => @local_path)
|
61
64
|
|
62
65
|
raise Puppet::Error, "File not found" unless file_bucket_file
|
@@ -68,7 +71,7 @@ class Puppet::FileBucket::Dipper
|
|
68
71
|
restore = true
|
69
72
|
file_handle = Puppet::FileSystem.pathname(file)
|
70
73
|
if Puppet::FileSystem.exist?(file_handle)
|
71
|
-
cursum =
|
74
|
+
cursum = @digest.call(Puppet::FileSystem.binread(file_handle))
|
72
75
|
|
73
76
|
# if the checksum has changed...
|
74
77
|
# this might be extra effort
|
@@ -79,7 +82,7 @@ class Puppet::FileBucket::Dipper
|
|
79
82
|
|
80
83
|
if restore
|
81
84
|
if newcontents = getfile(sum)
|
82
|
-
newsum =
|
85
|
+
newsum = @digest.call(newcontents)
|
83
86
|
changed = nil
|
84
87
|
if Puppet::FileSystem.exist?(file_handle) and ! Puppet::FileSystem.writable?(file_handle)
|
85
88
|
changed = Puppet::FileSystem.stat(file_handle).mode
|
@@ -32,6 +32,7 @@ class Puppet::FileBucket::File
|
|
32
32
|
@contents = contents
|
33
33
|
|
34
34
|
@bucket_path = options.delete(:bucket_path)
|
35
|
+
@checksum_type = Puppet[:digest_algorithm].to_sym
|
35
36
|
raise ArgumentError.new("Unknown option(s): #{options.keys.join(', ')}") unless options.empty?
|
36
37
|
end
|
37
38
|
|
@@ -46,7 +47,7 @@ class Puppet::FileBucket::File
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def checksum_type
|
49
|
-
|
50
|
+
@checksum_type.to_s
|
50
51
|
end
|
51
52
|
|
52
53
|
def checksum
|
@@ -54,7 +55,8 @@ class Puppet::FileBucket::File
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def checksum_data
|
57
|
-
|
58
|
+
algorithm = Puppet::Util::Checksums.method(@checksum_type)
|
59
|
+
@checksum_data ||= algorithm.call(contents)
|
58
60
|
end
|
59
61
|
|
60
62
|
def to_s
|
@@ -149,7 +149,7 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base
|
|
149
149
|
@checksum_type = checksum['type']
|
150
150
|
@checksum = checksum['value']
|
151
151
|
end
|
152
|
-
@checksum_type ||=
|
152
|
+
@checksum_type ||= Puppet[:digest_algorithm]
|
153
153
|
@ftype = data.delete('type')
|
154
154
|
@destination = data.delete('destination')
|
155
155
|
super(path,data)
|
@@ -36,10 +36,36 @@ class Puppet::FileSystem::MemoryFile
|
|
36
36
|
def executable?; @properties[:executable?]; end
|
37
37
|
|
38
38
|
def each_line(&block)
|
39
|
-
|
39
|
+
handle.each_line(&block)
|
40
|
+
end
|
41
|
+
|
42
|
+
def handle
|
43
|
+
raise Errno::ENOENT unless exist?
|
44
|
+
StringIO.new(@properties[:content] || '')
|
40
45
|
end
|
41
46
|
|
42
47
|
def duplicate_as(other_path)
|
43
48
|
self.class.new(other_path, @properties)
|
44
49
|
end
|
50
|
+
|
51
|
+
def absolute?
|
52
|
+
Pathname.new(path).absolute?
|
53
|
+
end
|
54
|
+
|
55
|
+
def to_path
|
56
|
+
path
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_s
|
60
|
+
to_path
|
61
|
+
end
|
62
|
+
|
63
|
+
# Used by Ruby 1.8.7 file system abstractions when operating on Pathname like things.
|
64
|
+
def to_str
|
65
|
+
to_path
|
66
|
+
end
|
67
|
+
|
68
|
+
def inspect
|
69
|
+
"<Puppet::FileSystem::MemoryFile:#{to_s}>"
|
70
|
+
end
|
45
71
|
end
|
@@ -28,7 +28,7 @@ class Puppet::FileSystem::MemoryImpl
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def pathname(path)
|
31
|
-
find(path)
|
31
|
+
find(path) || Puppet::FileSystem::MemoryFile.a_missing_file(path)
|
32
32
|
end
|
33
33
|
|
34
34
|
def basename(path)
|
@@ -39,6 +39,20 @@ class Puppet::FileSystem::MemoryImpl
|
|
39
39
|
object.path
|
40
40
|
end
|
41
41
|
|
42
|
+
def read(path)
|
43
|
+
handle = assert_path(path).handle
|
44
|
+
handle.read
|
45
|
+
end
|
46
|
+
|
47
|
+
def open(path, *args, &block)
|
48
|
+
handle = assert_path(path).handle
|
49
|
+
if block_given?
|
50
|
+
yield handle
|
51
|
+
else
|
52
|
+
return handle
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
def assert_path(path)
|
43
57
|
if path.is_a?(Puppet::FileSystem::MemoryFile)
|
44
58
|
path
|
data/lib/puppet/forge.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
+
require 'puppet/vendor'
|
2
|
+
Puppet::Vendor.load_vendored
|
3
|
+
|
1
4
|
require 'net/http'
|
2
|
-
require '
|
3
|
-
require 'pathname'
|
5
|
+
require 'tempfile'
|
4
6
|
require 'uri'
|
7
|
+
require 'pathname'
|
8
|
+
require 'json'
|
9
|
+
require 'semantic'
|
5
10
|
|
6
|
-
class Puppet::Forge
|
7
|
-
require 'puppet/forge/errors'
|
11
|
+
class Puppet::Forge < Semantic::Dependency::Source
|
8
12
|
require 'puppet/forge/cache'
|
9
13
|
require 'puppet/forge/repository'
|
14
|
+
require 'puppet/forge/errors'
|
10
15
|
|
11
16
|
include Puppet::Forge::Errors
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@
|
18
|
+
USER_AGENT = "PMT/1.1.1 (v3; Net::HTTP)".freeze
|
19
|
+
|
20
|
+
attr_reader :host, :repository
|
21
|
+
|
22
|
+
def initialize(host = Puppet[:module_repository])
|
23
|
+
@host = host
|
24
|
+
@repository = Puppet::Forge::Repository.new(host, USER_AGENT)
|
19
25
|
end
|
20
26
|
|
21
27
|
# Return a list of module metadata hashes that match the search query.
|
@@ -46,61 +52,151 @@ class Puppet::Forge
|
|
46
52
|
# @raise [Puppet::Forge::Errors::ResponseError] if the repository returns a
|
47
53
|
# bad HTTP response
|
48
54
|
def search(term)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
matches = []
|
56
|
+
uri = "/v3/modules?query=#{URI.escape(term)}"
|
57
|
+
|
58
|
+
while uri
|
59
|
+
response = make_http_request(uri)
|
60
|
+
|
61
|
+
if response.code == '200'
|
62
|
+
result = JSON.parse(response.body)
|
63
|
+
uri = result['pagination']['next']
|
64
|
+
matches.concat result['results']
|
65
|
+
else
|
66
|
+
raise ResponseError.new(:uri => URI.parse(@host).merge(uri) , :input => term, :response => response)
|
67
|
+
end
|
58
68
|
end
|
59
69
|
|
60
|
-
matches
|
70
|
+
matches.each do |mod|
|
71
|
+
mod['author'] = mod['owner']['username']
|
72
|
+
mod['tag_list'] = mod['current_release']['tags']
|
73
|
+
mod['full_name'] = "#{mod['author']}/#{mod['name']}"
|
74
|
+
mod['version'] = mod['current_release']['version']
|
75
|
+
mod['project_url'] = mod['homepage_url']
|
76
|
+
mod['desc'] = mod['current_release']['metadata']['summary'] || ''
|
77
|
+
end
|
61
78
|
end
|
62
79
|
|
63
|
-
#
|
64
|
-
# of its dependencies.
|
80
|
+
# Fetches {ModuleRelease} entries for each release of the named module.
|
65
81
|
#
|
66
|
-
# @param
|
67
|
-
# @
|
68
|
-
#
|
69
|
-
# @
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
case response.code
|
81
|
-
when "200"
|
82
|
-
return json
|
83
|
-
else
|
84
|
-
error = json['error']
|
85
|
-
if error && error =~ /^Module #{author}\/#{mod_name} has no release/
|
86
|
-
return []
|
82
|
+
# @param input [String] the module name to look up
|
83
|
+
# @return [Array<Semantic::Dependency::ModuleRelease>] a list of releases for
|
84
|
+
# the given name
|
85
|
+
# @see Semantic::Dependency::Source#fetch
|
86
|
+
def fetch(input)
|
87
|
+
name = input.tr('/', '-')
|
88
|
+
uri = "/v3/releases?module=#{name}"
|
89
|
+
releases = []
|
90
|
+
|
91
|
+
while uri
|
92
|
+
response = make_http_request(uri)
|
93
|
+
|
94
|
+
if response.code == '200'
|
95
|
+
response = JSON.parse(response.body)
|
87
96
|
else
|
88
|
-
raise ResponseError.new(:uri => uri
|
97
|
+
raise ResponseError.new(:uri => URI.parse(@host).merge(uri), :input => input, :response => response)
|
89
98
|
end
|
99
|
+
|
100
|
+
releases.concat(process(response['results']))
|
101
|
+
uri = response['pagination']['next']
|
90
102
|
end
|
103
|
+
|
104
|
+
return releases
|
91
105
|
end
|
92
106
|
|
93
|
-
def
|
94
|
-
repository.
|
107
|
+
def make_http_request(*args)
|
108
|
+
@repository.make_http_request(*args)
|
95
109
|
end
|
96
110
|
|
97
|
-
|
98
|
-
|
111
|
+
class ModuleRelease < Semantic::Dependency::ModuleRelease
|
112
|
+
attr_reader :install_dir, :metadata
|
113
|
+
|
114
|
+
def initialize(source, data)
|
115
|
+
@data = data
|
116
|
+
@metadata = meta = data['metadata']
|
117
|
+
|
118
|
+
name = meta['name'].tr('/', '-')
|
119
|
+
version = Semantic::Version.parse(meta['version'])
|
120
|
+
|
121
|
+
dependencies = (meta['dependencies'] || [])
|
122
|
+
dependencies.map! do |dep|
|
123
|
+
range = dep['version_requirement'] || dep['versionRequirement'] || '>=0'
|
124
|
+
[
|
125
|
+
dep['name'].tr('/', '-'),
|
126
|
+
(Semantic::VersionRange.parse(range) rescue Semantic::VersionRange::EMPTY_RANGE),
|
127
|
+
]
|
128
|
+
end
|
129
|
+
|
130
|
+
super(source, name, version, Hash[dependencies])
|
131
|
+
end
|
132
|
+
|
133
|
+
def install(dir)
|
134
|
+
staging_dir = self.prepare
|
135
|
+
|
136
|
+
module_dir = dir + name[/-(.*)/, 1]
|
137
|
+
module_dir.rmtree if module_dir.exist?
|
138
|
+
|
139
|
+
# Make sure unpacked module has the same ownership as the folder we are moving it into.
|
140
|
+
Puppet::ModuleTool::Applications::Unpacker.harmonize_ownership(dir, staging_dir)
|
141
|
+
|
142
|
+
FileUtils.mv(staging_dir, module_dir)
|
143
|
+
@install_dir = dir
|
144
|
+
|
145
|
+
# Return the Pathname object representing the directory where the
|
146
|
+
# module release archive was unpacked the to.
|
147
|
+
return module_dir
|
148
|
+
ensure
|
149
|
+
staging_dir.rmtree if staging_dir.exist?
|
150
|
+
end
|
151
|
+
|
152
|
+
def prepare
|
153
|
+
return @unpacked_into if @unpacked_into
|
154
|
+
|
155
|
+
download(@data['file_uri'], tmpfile)
|
156
|
+
validate_checksum(tmpfile, @data['file_md5'])
|
157
|
+
unpack(tmpfile, tmpdir)
|
158
|
+
|
159
|
+
@unpacked_into = Pathname.new(tmpdir)
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
# Obtain a suitable temporary path for unpacking tarballs
|
165
|
+
#
|
166
|
+
# @return [Pathname] path to temporary unpacking location
|
167
|
+
def tmpdir
|
168
|
+
@dir ||= Dir.mktmpdir(name, Puppet::Forge::Cache.base_path)
|
169
|
+
end
|
170
|
+
|
171
|
+
def tmpfile
|
172
|
+
@file ||= Tempfile.new(name, Puppet::Forge::Cache.base_path).tap do |f|
|
173
|
+
f.binmode
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def download(uri, destination)
|
178
|
+
@source.make_http_request(uri, destination)
|
179
|
+
destination.flush and destination.close
|
180
|
+
end
|
181
|
+
|
182
|
+
def validate_checksum(file, checksum)
|
183
|
+
if Digest::MD5.file(file.path).hexdigest != checksum
|
184
|
+
raise RuntimeError, "Downloaded release for #{name} did not match expected checksum"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def unpack(file, destination)
|
189
|
+
begin
|
190
|
+
Puppet::ModuleTool::Applications::Unpacker.unpack(file.path, destination)
|
191
|
+
rescue Puppet::ExecutionFailure => e
|
192
|
+
raise RuntimeError, "Could not extract contents of module archive: #{e.message}"
|
193
|
+
end
|
194
|
+
end
|
99
195
|
end
|
100
196
|
|
101
|
-
|
102
|
-
|
103
|
-
|
197
|
+
private
|
198
|
+
|
199
|
+
def process(list)
|
200
|
+
list.map { |release| ModuleRelease.new(self, release) }
|
104
201
|
end
|
105
|
-
private :repository
|
106
202
|
end
|