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
@@ -28,6 +28,24 @@ OVERRIDE_OPTS = {
|
|
28
28
|
'logfile': '/dev/null'
|
29
29
|
}
|
30
30
|
|
31
|
+
enable = []
|
32
|
+
disable = []
|
33
|
+
args = list(sys.argv)
|
34
|
+
|
35
|
+
while len(args) > 0:
|
36
|
+
a = args.pop(0)
|
37
|
+
|
38
|
+
if a == "-d":
|
39
|
+
if len(args) < 1:
|
40
|
+
raise ValueError, a
|
41
|
+
next = args.pop(0)
|
42
|
+
disable.extend( next.split(",") )
|
43
|
+
if a == "-e":
|
44
|
+
if len(args) < 1:
|
45
|
+
raise ValueError, a
|
46
|
+
next = args.pop(0)
|
47
|
+
enable.extend( next.split(",") )
|
48
|
+
|
31
49
|
def pkg_lists(my):
|
32
50
|
my.doConfigSetup()
|
33
51
|
|
@@ -52,7 +70,12 @@ def pkg_lists(my):
|
|
52
70
|
|
53
71
|
def shell_out():
|
54
72
|
try:
|
55
|
-
|
73
|
+
repostring = ""
|
74
|
+
if disable:
|
75
|
+
repostring += " '--disablerepo=%s'" % ",".join(disable)
|
76
|
+
if enable:
|
77
|
+
repostring += " '--disablerepo=%s'" % ",".join(enable)
|
78
|
+
p = popen("/usr/bin/env yum%s check-update 2>&1" % repostring)
|
56
79
|
output = p.readlines()
|
57
80
|
rc = p.close()
|
58
81
|
|
@@ -112,6 +135,13 @@ if useyumlib:
|
|
112
135
|
try:
|
113
136
|
try:
|
114
137
|
my = yum.YumBase()
|
138
|
+
|
139
|
+
for repo in disable:
|
140
|
+
my.repos.disableRepo(repo)
|
141
|
+
|
142
|
+
for repo in enable:
|
143
|
+
my.repos.enableRepo(repo)
|
144
|
+
|
115
145
|
ypl = pkg_lists(my)
|
116
146
|
for pkg in ypl.updates:
|
117
147
|
print "_pkg %s %s %s %s %s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)
|
@@ -41,20 +41,21 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
|
|
41
41
|
self.debug "Detected zypper version #{major}.#{minor}.#{patch}"
|
42
42
|
|
43
43
|
#zypper version < 1.0 does not support --quiet flag
|
44
|
-
quiet = "--quiet"
|
45
44
|
if major < 1
|
46
|
-
quiet =
|
45
|
+
quiet = '--terse'
|
46
|
+
else
|
47
|
+
quiet = '--quiet'
|
47
48
|
end
|
48
49
|
|
49
|
-
|
50
|
-
noconfirm = "--no-confirm"
|
50
|
+
options = [quiet, :install]
|
51
51
|
|
52
52
|
#zypper 0.6.13 (OpenSuSE 10.2) does not support auto agree with licenses
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
options << '--auto-agree-with-licenses' unless major < 1 and minor <= 6 and patch <= 13
|
54
|
+
options << '--no-confirm'
|
55
|
+
options += install_options if resource[:install_options]
|
56
|
+
options << wanted
|
57
|
+
|
58
|
+
zypper *options
|
58
59
|
|
59
60
|
unless self.query
|
60
61
|
raise Puppet::ExecutionFailure.new(
|
@@ -81,23 +82,4 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
|
|
81
82
|
# zypper install can be used for update, too
|
82
83
|
self.install
|
83
84
|
end
|
84
|
-
|
85
|
-
def install_options
|
86
|
-
join_options(resource[:install_options])
|
87
|
-
end
|
88
|
-
|
89
|
-
def join_options(options)
|
90
|
-
return unless options
|
91
|
-
|
92
|
-
options.collect do |val|
|
93
|
-
case val
|
94
|
-
when Hash
|
95
|
-
val.keys.sort.collect do |k|
|
96
|
-
"#{k} '#{val[k]}'"
|
97
|
-
end.join(' ')
|
98
|
-
else
|
99
|
-
val
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
85
|
end
|
@@ -16,7 +16,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
16
16
|
# is resolved.
|
17
17
|
commands :invoke_rc => "/usr/sbin/invoke-rc.d"
|
18
18
|
|
19
|
-
defaultfor :operatingsystem =>
|
19
|
+
defaultfor :operatingsystem => :debian
|
20
20
|
|
21
21
|
# Remove the symlinks
|
22
22
|
def disable
|
@@ -47,6 +47,9 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
47
47
|
# by the fix for this (bug https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/982889)
|
48
48
|
# due to puppet's inability to deal with upstart services with instances.
|
49
49
|
excludes += %w{plymouth-ready}
|
50
|
+
# Prevent puppet failing to get status of these services, which need parameters
|
51
|
+
# passed in (see https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1276766).
|
52
|
+
excludes += %w{idmapd-mounting startpar-bridge}
|
50
53
|
end
|
51
54
|
|
52
55
|
# List all services of this type.
|
@@ -4,6 +4,10 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :init do
|
|
4
4
|
|
5
5
|
confine :operatingsystem => :openbsd
|
6
6
|
defaultfor :operatingsystem => :openbsd
|
7
|
+
has_feature :flaggable
|
8
|
+
|
9
|
+
def self.rcconf() '/etc/rc.conf' end
|
10
|
+
def self.rcconf_local() '/etc/rc.conf.local' end
|
7
11
|
|
8
12
|
def self.defpath
|
9
13
|
["/etc/rc.d"]
|
@@ -20,4 +24,318 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :init do
|
|
20
24
|
def statuscmd
|
21
25
|
[self.initscript, :check]
|
22
26
|
end
|
27
|
+
|
28
|
+
# Fetch the state of all service resources
|
29
|
+
def self.prefetch(resources)
|
30
|
+
services = instances
|
31
|
+
resources.keys.each do |name|
|
32
|
+
if provider = services.find { |svc| svc.name == name }
|
33
|
+
resources[name].provider = provider
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return the list of rc scripts
|
39
|
+
# @api private
|
40
|
+
def self.rclist
|
41
|
+
unless @rclist
|
42
|
+
Puppet.debug "Building list of rc scripts"
|
43
|
+
@rclist = []
|
44
|
+
defpath.each do |p|
|
45
|
+
Dir.glob(p + '/*').each do |item|
|
46
|
+
@rclist << item if File.executable?(item)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
@rclist
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return a hash where the keys are the rc script names as symbols with flags
|
54
|
+
# as values
|
55
|
+
# @api private
|
56
|
+
def self.rcflags
|
57
|
+
unless @flag_hash
|
58
|
+
Puppet.debug "Retrieving flags for all discovered services"
|
59
|
+
|
60
|
+
Puppet.debug "Reading the contents of the rc conf files"
|
61
|
+
|
62
|
+
if File.exists?(rcconf_local())
|
63
|
+
rcconf_local_contents = File.readlines(rcconf_local())
|
64
|
+
else
|
65
|
+
rcconf_local_contents = []
|
66
|
+
end
|
67
|
+
|
68
|
+
if File.exists?(rcconf())
|
69
|
+
rcconf_contents = File.readlines(rcconf())
|
70
|
+
else
|
71
|
+
rcconf_contents = []
|
72
|
+
end
|
73
|
+
|
74
|
+
@flag_hash = {}
|
75
|
+
rclist().each do |rcitem|
|
76
|
+
|
77
|
+
rcname = rcitem.split('/').last
|
78
|
+
|
79
|
+
if flagline = rcconf_local_contents.find {|l| l =~ /^#{rcname}_flags/ }
|
80
|
+
flag = parse_rc_line(flagline)
|
81
|
+
@flag_hash[rcname.to_sym] ||= flag
|
82
|
+
end
|
83
|
+
|
84
|
+
# For the defaults, if the flags are set to 'NO', we skip setting the
|
85
|
+
# flag here, since it will already be disabled, and this makes the
|
86
|
+
# output of `puppet resource service` a bit more correct.
|
87
|
+
if flagline = rcconf_contents.find {|l| l =~ /^#{rcname}_flags/ }
|
88
|
+
flag = parse_rc_line(flagline)
|
89
|
+
unless flag == "NO"
|
90
|
+
@flag_hash[rcname.to_sym] ||= flag
|
91
|
+
end
|
92
|
+
end
|
93
|
+
@flag_hash[rcname.to_sym] ||= nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
@flag_hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# @api private
|
100
|
+
def self.parse_rc_line(rc_line)
|
101
|
+
rc_line.sub!(/\s*#(.*)$/,'')
|
102
|
+
regex = /\w+_flags=(.*)/
|
103
|
+
rc_line.match(regex)[1].gsub(/^"/,'').gsub(/"$/,'')
|
104
|
+
end
|
105
|
+
|
106
|
+
# Read the rc.conf* files and determine the value of the flags
|
107
|
+
# @api private
|
108
|
+
def self.get_flags(rcname)
|
109
|
+
rcflags()
|
110
|
+
@flag_hash[rcname.to_sym]
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.instances
|
114
|
+
instances = []
|
115
|
+
defpath.each do |path|
|
116
|
+
unless File.directory?(path)
|
117
|
+
Puppet.debug "Service path #{path} does not exist"
|
118
|
+
next
|
119
|
+
end
|
120
|
+
|
121
|
+
rclist().each do |d|
|
122
|
+
instances << new(
|
123
|
+
:name => File.basename(d),
|
124
|
+
:path => path,
|
125
|
+
:flags => get_flags(File.basename(d)),
|
126
|
+
:hasstatus => true
|
127
|
+
)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
instances
|
131
|
+
end
|
132
|
+
|
133
|
+
# @api private
|
134
|
+
def rcvar_name
|
135
|
+
self.name + '_flags'
|
136
|
+
end
|
137
|
+
|
138
|
+
# @api private
|
139
|
+
def read_rcconf_local_text()
|
140
|
+
if File.exists?(self.class.rcconf_local())
|
141
|
+
File.read(self.class.rcconf_local())
|
142
|
+
else
|
143
|
+
[]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# @api private
|
148
|
+
def load_rcconf_local_array
|
149
|
+
if File.exists?(self.class.rcconf_local())
|
150
|
+
File.readlines(self.class.rcconf_local()).map {|l|
|
151
|
+
l.chomp!
|
152
|
+
}
|
153
|
+
else
|
154
|
+
[]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# @api private
|
159
|
+
def write_rc_contents(file, text)
|
160
|
+
Puppet::Util.replace_file(file, 0644) do |f|
|
161
|
+
f.write(text)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# @api private
|
166
|
+
def set_content_flags(content,flags)
|
167
|
+
unless content.is_a? Array
|
168
|
+
debug "content must be an array at flags"
|
169
|
+
return ""
|
170
|
+
else
|
171
|
+
content.reject! {|l| l.nil? }
|
172
|
+
end
|
173
|
+
|
174
|
+
if flags.nil?
|
175
|
+
append = resource[:name] + '_flags=""'
|
176
|
+
else
|
177
|
+
append = resource[:name] + '_flags="' + flags + '"'
|
178
|
+
end
|
179
|
+
|
180
|
+
if content.find {|l| l =~ /#{resource[:name]}_flags/ }.nil?
|
181
|
+
content << append
|
182
|
+
else
|
183
|
+
content.map {|l| l.gsub!(/^#{resource[:name]}_flags="(.*)?"(.*)?$/, append) }
|
184
|
+
end
|
185
|
+
content
|
186
|
+
end
|
187
|
+
|
188
|
+
# @api private
|
189
|
+
def remove_content_flags(content)
|
190
|
+
content.reject {|l| l =~ /#{resource[:name]}_flags/ }
|
191
|
+
end
|
192
|
+
|
193
|
+
# return an array of the currently enabled pkg_scripts
|
194
|
+
# @api private
|
195
|
+
def pkg_scripts
|
196
|
+
current = load_rcconf_local_array()
|
197
|
+
if scripts = current.find{|l| l =~ /^pkg_scripts/ }
|
198
|
+
if match = scripts.match(/^pkg_scripts="(.*)?"(.*)?$/)
|
199
|
+
match[1].split(' ')
|
200
|
+
else
|
201
|
+
[]
|
202
|
+
end
|
203
|
+
else
|
204
|
+
[]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# return the array with the current resource added
|
209
|
+
# @api private
|
210
|
+
def pkg_scripts_append
|
211
|
+
[pkg_scripts(), resource[:name]].flatten.sort.uniq
|
212
|
+
end
|
213
|
+
|
214
|
+
# return the array without the current resource
|
215
|
+
# @api private
|
216
|
+
def pkg_scripts_remove
|
217
|
+
pkg_scripts().reject {|s| s == resource[:name] }
|
218
|
+
end
|
219
|
+
|
220
|
+
# Modify the content array to contain the requsted pkg_scripts line and retun
|
221
|
+
# the resulting array
|
222
|
+
# @api private
|
223
|
+
def set_content_scripts(content,scripts)
|
224
|
+
unless content.is_a? Array
|
225
|
+
debug "content must be an array at scripts"
|
226
|
+
return ""
|
227
|
+
else
|
228
|
+
content.reject! {|l| l.nil? }
|
229
|
+
end
|
230
|
+
|
231
|
+
scripts_line = 'pkg_scripts="' + scripts.join(' ') + '"'
|
232
|
+
|
233
|
+
if content.find {|l| l =~ /^pkg_scripts/ }.nil?
|
234
|
+
content << scripts_line
|
235
|
+
else
|
236
|
+
# Replace the found pkg_scripts line with our own
|
237
|
+
content.each_with_index {|l,i|
|
238
|
+
if l =~ /^pkg_scripts/
|
239
|
+
content[i] = scripts_line
|
240
|
+
end
|
241
|
+
}
|
242
|
+
end
|
243
|
+
content
|
244
|
+
end
|
245
|
+
|
246
|
+
# Determine if the rc script is included in base, or if it exists as a result
|
247
|
+
# of a package installation.
|
248
|
+
# @api private
|
249
|
+
def in_base?
|
250
|
+
system("/usr/sbin/pkg_info -qE /etc/rc.d/#{self.name}> /dev/null")
|
251
|
+
$?.exitstatus == 1
|
252
|
+
end
|
253
|
+
|
254
|
+
# @api private
|
255
|
+
def default_disabled?
|
256
|
+
line = File.readlines(self.class.rcconf).find {|l| l =~ /#{rcvar_name}/ }
|
257
|
+
self.class.parse_rc_line(line) == 'NO'
|
258
|
+
end
|
259
|
+
|
260
|
+
def enabled?
|
261
|
+
if in_base?
|
262
|
+
if (@property_hash[:flags].nil? or @property_hash[:flags] == 'NO')
|
263
|
+
:false
|
264
|
+
else
|
265
|
+
:true
|
266
|
+
end
|
267
|
+
else
|
268
|
+
if (pkg_scripts().include?(@property_hash[:name]))
|
269
|
+
:true
|
270
|
+
else
|
271
|
+
:false
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def enable
|
277
|
+
self.debug("Enabling #{self.name}")
|
278
|
+
end
|
279
|
+
|
280
|
+
# We should also check for default state
|
281
|
+
def disable
|
282
|
+
self.debug("Disabling #{self.name}")
|
283
|
+
end
|
284
|
+
|
285
|
+
def flags
|
286
|
+
@property_hash[:flags]
|
287
|
+
end
|
288
|
+
|
289
|
+
def flags=(value)
|
290
|
+
@property_hash[:flags] = value
|
291
|
+
end
|
292
|
+
|
293
|
+
def flush
|
294
|
+
debug "Flusing resource for #{self.name}"
|
295
|
+
|
296
|
+
# Here we load the contents of the rc.conf.local file into the contents
|
297
|
+
# variable, modify it if needed, and then compare that to the original. If
|
298
|
+
# they are different, we write it out.
|
299
|
+
|
300
|
+
original = load_rcconf_local_array()
|
301
|
+
content = original
|
302
|
+
|
303
|
+
debug @property_hash.inspect
|
304
|
+
|
305
|
+
if resource[:enable] == :true
|
306
|
+
#set_flags(resource[:flags])
|
307
|
+
content = set_content_flags(content, resource[:flags])
|
308
|
+
|
309
|
+
# We need only add append the resource name to the pkg_scripts if the
|
310
|
+
# package is not found in the base system.
|
311
|
+
|
312
|
+
if not in_base?
|
313
|
+
content = set_content_scripts(content,pkg_scripts_append())
|
314
|
+
end
|
315
|
+
elsif resource[:enable] == :false
|
316
|
+
|
317
|
+
# By virtue of being excluded from the base system, all packages are
|
318
|
+
# disabled by default and need not be set in the rc.conf.local at all.
|
319
|
+
|
320
|
+
if not in_base?
|
321
|
+
content = remove_content_flags(content)
|
322
|
+
content = set_content_scripts(content,pkg_scripts_remove())
|
323
|
+
else
|
324
|
+
if default_disabled?
|
325
|
+
content = remove_content_flags(content)
|
326
|
+
else
|
327
|
+
content = set_content_flags(content, "NO")
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
# Make sure to append a newline to the end of the file
|
333
|
+
unless content[-1] == ""
|
334
|
+
content << ""
|
335
|
+
end
|
336
|
+
output = content.join("\n")
|
337
|
+
|
338
|
+
# Write the contents only if necessary, and only once
|
339
|
+
write_rc_contents(self.class.rcconf_local(), output)
|
340
|
+
end
|
23
341
|
end
|