puppet 6.4.5-x64-mingw32 → 6.5.0-x64-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.
- checksums.yaml +4 -4
- data/CODEOWNERS +10 -10
- data/Gemfile +6 -6
- data/Gemfile.lock +46 -52
- data/ext/build_defaults.yaml +0 -1
- data/ext/project_data.yaml +3 -3
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/solaris/smf/puppet.xml +0 -2
- data/ext/windows/eventlog/Rakefile +32 -0
- data/ext/windows/eventlog/puppetres.dll +0 -0
- data/ext/windows/eventlog/puppetres.mc +18 -0
- data/ext/windows/service/daemon.rb +8 -38
- data/install.rb +24 -6
- data/lib/puppet.rb +3 -1
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +11 -34
- data/lib/puppet/application/apply.rb +6 -6
- data/lib/puppet/application/describe.rb +9 -3
- data/lib/puppet/application/device.rb +4 -14
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +2 -2
- data/lib/puppet/application/resource.rb +4 -4
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/application/ssl.rb +10 -9
- data/lib/puppet/configurer.rb +30 -86
- data/lib/puppet/configurer/downloader.rb +6 -2
- data/lib/puppet/defaults.rb +50 -44
- data/lib/puppet/error.rb +14 -9
- data/lib/puppet/face/catalog.rb +20 -1
- data/lib/puppet/face/config.rb +48 -10
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/help.rb +1 -1
- data/lib/puppet/face/module/list.rb +5 -5
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +1 -1
- data/lib/puppet/face/parser.rb +48 -9
- data/lib/puppet/face/plugin.rb +2 -9
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +12 -2
- data/lib/puppet/file_system/file_impl.rb +6 -3
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +2 -3
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions.rb +2 -1
- data/lib/puppet/functions/camelcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/find_file.rb +9 -9
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/regsubst.rb +6 -8
- data/lib/puppet/gettext/module_translations.rb +1 -1
- data/lib/puppet/graph/rb_tree_map.rb +2 -2
- data/lib/puppet/graph/simple_graph.rb +3 -4
- data/lib/puppet/indirector/catalog/compiler.rb +5 -11
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +0 -2
- data/lib/puppet/indirector/resource/ral.rb +3 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +1 -2
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module/task.rb +4 -20
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
- data/lib/puppet/module_tool/tar/mini.rb +2 -12
- data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
- data/lib/puppet/network/http/connection.rb +12 -10
- data/lib/puppet/network/http/factory.rb +11 -1
- data/lib/puppet/network/http/pool.rb +0 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +2 -4
- data/lib/puppet/pal/pal_impl.rb +2 -2
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/fail.rb +8 -1
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/scope.rb +7 -8
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -3
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/loader/null_loader.rb +60 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
- data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +18 -22
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/pn_parser.rb +16 -17
- data/lib/puppet/pops/puppet_stack.rb +49 -51
- data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
- data/lib/puppet/pops/types/string_converter.rb +10 -10
- data/lib/puppet/pops/types/types.rb +6 -5
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/exec.rb +2 -6
- data/lib/puppet/provider/file/posix.rb +0 -5
- data/lib/puppet/provider/nameservice.rb +3 -10
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package.rb +0 -2
- data/lib/puppet/provider/package/apt.rb +1 -5
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +18 -34
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +13 -37
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +18 -56
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +5 -9
- data/lib/puppet/provider/package_targetable.rb +4 -7
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +5 -20
- data/lib/puppet/provider/service/openbsd.rb +1 -1
- data/lib/puppet/provider/service/rcng.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +8 -2
- data/lib/puppet/provider/service/systemd.rb +19 -14
- data/lib/puppet/provider/service/windows.rb +0 -8
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +3 -12
- data/lib/puppet/provider/user/user_role_add.rb +1 -5
- data/lib/puppet/provider/user/useradd.rb +20 -45
- data/lib/puppet/provider/user/windows_adsi.rb +5 -4
- data/lib/puppet/reference/configuration.rb +3 -3
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +3 -1
- data/lib/puppet/reference/providers.rb +3 -1
- data/lib/puppet/reference/type.rb +9 -3
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +1 -18
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/rest/routes.rb +30 -17
- data/lib/puppet/settings.rb +3 -43
- data/lib/puppet/settings/environment_conf.rb +0 -1
- data/lib/puppet/ssl/certificate_request.rb +12 -2
- data/lib/puppet/ssl/host.rb +2 -2
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/ssl/ssl_provider.rb +11 -5
- data/lib/puppet/ssl/state_machine.rb +102 -98
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +11 -33
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/type.rb +4 -2
- data/lib/puppet/type/exec.rb +17 -23
- data/lib/puppet/type/file.rb +39 -11
- data/lib/puppet/type/file/data_sync.rb +1 -5
- data/lib/puppet/type/group.rb +2 -4
- data/lib/puppet/type/notify.rb +3 -4
- data/lib/puppet/type/package.rb +3 -20
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/service.rb +3 -8
- data/lib/puppet/type/user.rb +2 -4
- data/lib/puppet/util.rb +29 -39
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +3 -4
- data/lib/puppet/util/http_proxy.rb +19 -27
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +2 -2
- data/lib/puppet/util/logging.rb +20 -32
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +33 -0
- data/lib/puppet/util/pidlock.rb +2 -3
- data/lib/puppet/util/provider_features.rb +4 -2
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +2 -8
- data/lib/puppet/util/skip_tags.rb +4 -0
- data/lib/puppet/util/windows/adsi.rb +18 -48
- data/lib/puppet/util/windows/process.rb +8 -8
- data/lib/puppet/util/windows/registry.rb +5 -7
- data/lib/puppet/util/windows/security.rb +0 -2
- data/lib/puppet/util/windows/service.rb +4 -149
- data/lib/puppet/util/windows/sid.rb +0 -1
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +81 -24
- data/locales/puppet.pot +462 -482
- data/man/man5/puppet.conf.5 +43 -44
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +3 -3
- data/man/man8/puppet-catalog.8 +31 -3
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +3 -3
- data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
- data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
- data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
- data/spec/fixtures/ssl/ca.pem +30 -30
- data/spec/fixtures/ssl/crl.pem +15 -15
- data/spec/fixtures/ssl/ec-key.pem +18 -0
- data/spec/fixtures/ssl/ec.pem +40 -0
- data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
- data/spec/fixtures/ssl/encrypted-key.pem +57 -57
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
- data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
- data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
- data/spec/fixtures/ssl/intermediate.pem +31 -31
- data/spec/fixtures/ssl/pluto-key.pem +56 -56
- data/spec/fixtures/ssl/pluto.pem +28 -28
- data/spec/fixtures/ssl/request-key.pem +56 -56
- data/spec/fixtures/ssl/request.pem +24 -24
- data/spec/fixtures/ssl/revoked-key.pem +56 -56
- data/spec/fixtures/ssl/revoked.pem +25 -25
- data/spec/fixtures/ssl/signed-key.pem +56 -56
- data/spec/fixtures/ssl/signed.pem +25 -25
- data/spec/fixtures/ssl/tampered-cert.pem +27 -27
- data/spec/fixtures/ssl/tampered-csr.pem +24 -24
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/configurer_spec.rb +0 -52
- data/spec/integration/provider/service/init_spec.rb +1 -0
- data/spec/integration/provider/service/systemd_spec.rb +5 -8
- data/spec/integration/type/file_spec.rb +38 -28
- data/spec/integration/util/execution_spec.rb +0 -27
- data/spec/lib/puppet/certificate_factory.rb +2 -2
- data/spec/lib/puppet/test_ca.rb +17 -4
- data/spec/lib/puppet_spec/fixtures.rb +4 -0
- data/spec/spec_helper.rb +0 -28
- data/spec/unit/application/agent_spec.rb +34 -67
- data/spec/unit/application/device_spec.rb +1 -27
- data/spec/unit/application/ssl_spec.rb +60 -35
- data/spec/unit/configurer_spec.rb +399 -395
- data/spec/unit/defaults_spec.rb +4 -4
- data/spec/unit/face/facts_spec.rb +0 -9
- data/spec/unit/face/parser_spec.rb +69 -22
- data/spec/unit/face/plugin_spec.rb +0 -8
- data/spec/unit/file_system_spec.rb +30 -1
- data/spec/unit/forge/forge_spec.rb +3 -1
- data/spec/unit/forge/repository_spec.rb +3 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/network/http/api/indirected_routes_spec.rb +10 -25
- data/spec/unit/network/http/connection_spec.rb +145 -119
- data/spec/unit/network/http/factory_spec.rb +5 -27
- data/spec/unit/parser/scope_spec.rb +0 -10
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
- data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
- data/spec/unit/pops/types/types_spec.rb +27 -0
- data/spec/unit/provider/exec_spec.rb +0 -209
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/dnf_spec.rb +0 -7
- data/spec/unit/provider/package/dpkg_spec.rb +80 -240
- data/spec/unit/provider/package/pip_spec.rb +8 -61
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/rpm_spec.rb +16 -150
- data/spec/unit/provider/package/yum_spec.rb +0 -7
- data/spec/unit/provider/service/daemontools_spec.rb +0 -24
- data/spec/unit/provider/service/launchd_spec.rb +0 -28
- data/spec/unit/provider/service/runit_spec.rb +0 -24
- data/spec/unit/provider/service/systemd_spec.rb +25 -39
- data/spec/unit/provider/service/windows_spec.rb +0 -20
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/pw_spec.rb +0 -37
- data/spec/unit/provider/user/useradd_spec.rb +0 -88
- data/spec/unit/resource_spec.rb +1 -26
- data/spec/unit/ssl/host_spec.rb +5 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
- data/spec/unit/ssl/state_machine_spec.rb +233 -158
- data/spec/unit/transaction_spec.rb +0 -64
- data/spec/unit/type/exec_spec.rb +12 -15
- data/spec/unit/type/file/content_spec.rb +3 -9
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/file_spec.rb +15 -11
- data/spec/unit/type/package_spec.rb +0 -5
- data/spec/unit/type/schedule_spec.rb +1 -3
- data/spec/unit/type/service_spec.rb +0 -16
- data/spec/unit/util/execution_spec.rb +0 -16
- data/spec/unit/util/http_proxy_spec.rb +21 -151
- data/spec/unit/util/ldap/manager_spec.rb +0 -15
- data/spec/unit/util/log/destinations_spec.rb +3 -7
- data/spec/unit/util/log_spec.rb +138 -0
- data/spec/unit/util/logging_spec.rb +0 -200
- data/spec/unit/util/pidlock_spec.rb +0 -26
- data/spec/unit/util/skip_tags_spec.rb +14 -0
- data/spec/unit/util/windows/adsi_spec.rb +0 -51
- data/spec/unit/util/windows/service_spec.rb +0 -9
- data/spec/unit/util_spec.rb +10 -0
- data/spec/unit/x509/cert_provider_spec.rb +82 -43
- data/tasks/generate_cert_fixtures.rake +13 -1
- data/tasks/manpages.rake +0 -1
- metadata +28 -22
- data/ext/cert_inspector +0 -140
- data/ext/envpuppet +0 -139
- data/ext/envpuppet.bat +0 -14
- data/ext/puppet-test +0 -476
- data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
- data/ext/upload_facts.rb +0 -119
- data/lib/puppet/provider/package/dnfmodule.rb +0 -87
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
- data/spec/integration/type/notify_spec.rb +0 -46
- data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
- data/spec/unit/provider/package_targetable_spec.rb +0 -60
data/ext/cert_inspector
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'openssl'
|
3
|
-
|
4
|
-
class X509Collector
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@collected_data = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def interpret_contents(contents)
|
12
|
-
cls = case contents.split("\n")[0]
|
13
|
-
when /BEGIN X509 CRL/ then OpenSSL::X509::CRL
|
14
|
-
when /BEGIN CERTIFICATE REQUEST/ then OpenSSL::X509::Request
|
15
|
-
when /BEGIN CERTIFICATE/ then OpenSSL::X509::Certificate
|
16
|
-
when /BEGIN RSA (PRIVATE|PUBLIC) KEY/ then OpenSSL::PKey::RSA
|
17
|
-
else return nil
|
18
|
-
end
|
19
|
-
cls.new(contents)
|
20
|
-
rescue
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def expected_non_x509_files
|
25
|
-
['inventory.txt', 'ca.pass', 'serial']
|
26
|
-
end
|
27
|
-
|
28
|
-
def investigate_path(path)
|
29
|
-
if File.directory?(path)
|
30
|
-
Dir.foreach(path) do |x|
|
31
|
-
next if ['.', '..'].include? x
|
32
|
-
investigate_path File.join(path, x)
|
33
|
-
end
|
34
|
-
else
|
35
|
-
contents = File.read path
|
36
|
-
meaning = interpret_contents contents
|
37
|
-
unless meaning || expected_non_x509_files.include?(File.basename(path))
|
38
|
-
puts "WARNING: file #{path.inspect} could not be interpreted"
|
39
|
-
end
|
40
|
-
@collected_data[path] = meaning if meaning
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def each(&block)
|
45
|
-
@collected_data.each(&block)
|
46
|
-
end
|
47
|
-
|
48
|
-
def extract_public_key_info(path, meaning)
|
49
|
-
case meaning
|
50
|
-
when OpenSSL::PKey::RSA
|
51
|
-
if meaning.private?
|
52
|
-
[meaning.public_key, 2, path]
|
53
|
-
else
|
54
|
-
[meaning, 3, path]
|
55
|
-
end
|
56
|
-
when OpenSSL::X509::Certificate
|
57
|
-
[meaning.public_key, 0, meaning.subject.to_s]
|
58
|
-
when OpenSSL::X509::Request
|
59
|
-
[meaning.public_key, 1, meaning.subject.to_s]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def who_signed(meaning, key_names, keys)
|
64
|
-
signing_key = keys.find { |key| meaning.verify(key) }
|
65
|
-
if signing_key then "#{key_names[signing_key.to_s]}" else "???" end
|
66
|
-
end
|
67
|
-
|
68
|
-
def explain(meaning, key_names, keys)
|
69
|
-
case meaning
|
70
|
-
when OpenSSL::PKey::RSA
|
71
|
-
if meaning.private?
|
72
|
-
"Private key for #{key_names[meaning.public_key.to_s]}"
|
73
|
-
else
|
74
|
-
"Public key for #{key_names[meaning.public_key.to_s]}"
|
75
|
-
end
|
76
|
-
when OpenSSL::X509::Certificate
|
77
|
-
signature_desc = who_signed(meaning, key_names, keys)
|
78
|
-
"Certificate assigning name #{meaning.subject} to #{key_names[meaning.public_key.to_s]}\n serial number #{meaning.serial}\n issued by #{meaning.issuer}\n signed by #{signature_desc}"
|
79
|
-
when OpenSSL::X509::Request
|
80
|
-
signature_desc = who_signed(meaning, key_names, keys)
|
81
|
-
"Certificate request for #{meaning.subject} having key #{key_names[meaning.public_key.to_s]}\n signed by #{signature_desc}"
|
82
|
-
when OpenSSL::X509::CRL
|
83
|
-
signature_desc = who_signed(meaning, key_names, keys)
|
84
|
-
revoked_serial_numbers = meaning.revoked.map { |r| r.serial }
|
85
|
-
revoked_desc = if revoked_serial_numbers.count > 0 then "serial numbers #{revoked_serial_numbers.inspect}" else "nothing" end
|
86
|
-
"Certificate revocation list revoking #{revoked_desc}\n issued by #{meaning.issuer}\n signed by #{signature_desc}"
|
87
|
-
else
|
88
|
-
"Unknown"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Yield unique public keys, with a canonical name for each.
|
93
|
-
def collect_public_keys
|
94
|
-
key_data = {} # pem => (priority, name, public_key)
|
95
|
-
@collected_data.collect do |path, meaning|
|
96
|
-
begin
|
97
|
-
next unless public_key_info = extract_public_key_info(path, meaning)
|
98
|
-
public_key, priority, name = public_key_info
|
99
|
-
pem = public_key.to_s
|
100
|
-
existing_priority, _, _ = key_data[pem]
|
101
|
-
next if existing_priority and existing_priority < priority
|
102
|
-
key_data[pem] = priority, name, public_key
|
103
|
-
rescue
|
104
|
-
puts "exception!"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
name_to_key_hash = {}
|
108
|
-
key_data.each do |pem, data|
|
109
|
-
_, name, public_key = data
|
110
|
-
if name_to_key_hash[name]
|
111
|
-
suffix_num = 2
|
112
|
-
while name_to_key_hash[name + " (#{suffix_num})"]
|
113
|
-
suffix_num += 1
|
114
|
-
end
|
115
|
-
name = name + " (#{suffix_num})"
|
116
|
-
end
|
117
|
-
name_to_key_hash[name] = public_key
|
118
|
-
end
|
119
|
-
key_names = {}
|
120
|
-
keys = []
|
121
|
-
name_to_key_hash.each do |name, public_key|
|
122
|
-
key_names[public_key.to_s] = "key<#{name}>"
|
123
|
-
keys << public_key
|
124
|
-
end
|
125
|
-
[key_names, keys]
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
collector = X509Collector.new
|
130
|
-
ARGV.each do |path|
|
131
|
-
collector.investigate_path(path)
|
132
|
-
end
|
133
|
-
key_names, keys = collector.collect_public_keys
|
134
|
-
collector.map do |path, meaning|
|
135
|
-
[collector.explain(meaning, key_names, keys), path]
|
136
|
-
end.sort.each do |description, path|
|
137
|
-
puts "#{path}:"
|
138
|
-
puts " #{description}"
|
139
|
-
puts
|
140
|
-
end
|
data/ext/envpuppet
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
#! /bin/sh
|
2
|
-
#
|
3
|
-
# Jeff McCune <jeff@puppetlabs.com>
|
4
|
-
# 2010-10-20
|
5
|
-
#
|
6
|
-
# Copyright (c) 2010, Puppet Labs
|
7
|
-
# License: BSD 3-clause license
|
8
|
-
#
|
9
|
-
# This script provides a simple way to execute puppet and related tools
|
10
|
-
# directly from a git clone of the upstream repositories. This allows you to
|
11
|
-
# quickly switch branches and test different versions of code without much
|
12
|
-
# friction.
|
13
|
-
#
|
14
|
-
# NOTE: There may be issues if puppet, facter, etc... are already installed
|
15
|
-
# into RUBY's site_ruby directory. If you run into strange problems, make sure
|
16
|
-
# the correct ruby libraries are being loaded...
|
17
|
-
#
|
18
|
-
# Sample Usage:
|
19
|
-
# =============
|
20
|
-
# cd ~/src
|
21
|
-
# git clone git://github.com/puppetlabs/puppet.git
|
22
|
-
# git clone git://github.com/puppetlabs/facter.git
|
23
|
-
# pushd puppet
|
24
|
-
# git checkout tags/2.6.1
|
25
|
-
# popd
|
26
|
-
# pushd facter
|
27
|
-
# git checkout tags/1.5.8
|
28
|
-
# export ENVPUPPET_BASEDIR=/home/jeff/src
|
29
|
-
# envpuppet puppet --version
|
30
|
-
# 2.6.1
|
31
|
-
# envpuppet facter --version
|
32
|
-
# 1.5.8
|
33
|
-
|
34
|
-
set -e
|
35
|
-
set -u
|
36
|
-
|
37
|
-
if [ "${1:-}" = "--help" ]; then
|
38
|
-
cat <<EO_HELP
|
39
|
-
This command reconfigures the environment once for development.
|
40
|
-
It is designed to wrap around any other command, specifically puppet
|
41
|
-
|
42
|
-
Jeff McCune <jeff@puppetlabs.com>
|
43
|
-
2011-02-09
|
44
|
-
|
45
|
-
Puppet should not be installed in site_ruby because all of \$LOAD_PATH
|
46
|
-
is searched by puppet when loading libraries and the installed version
|
47
|
-
will taint the development version
|
48
|
-
|
49
|
-
The following enviornment variables configure the behavior of envpuppet
|
50
|
-
|
51
|
-
ENVPUPPET_BASEDIR="${HOME}/src"
|
52
|
-
the base directory where puppet, facter, etc... live.
|
53
|
-
|
54
|
-
ENVPUPPET_BLEEDING=true Enables bleeding edge prototypes like
|
55
|
-
puppet-interfaces
|
56
|
-
|
57
|
-
The PATH and RUBYLIB are the primary environment variables modified by
|
58
|
-
the envpuppet script.
|
59
|
-
|
60
|
-
If no arguments are given, the environment variables are printed to STDOUT
|
61
|
-
allowing the output to be sourced. For example:
|
62
|
-
|
63
|
-
eval \$(envpuppet)
|
64
|
-
|
65
|
-
EO_HELP
|
66
|
-
exit 0
|
67
|
-
fi
|
68
|
-
|
69
|
-
if test -d puppet -o -d facter; then
|
70
|
-
(
|
71
|
-
echo " WARNING!"
|
72
|
-
echo " Strange things happen if puppet or facter are in the"
|
73
|
-
echo " current working directory"
|
74
|
-
echo " (import errors from ruby are a prime example)"
|
75
|
-
echo " WARNING!"
|
76
|
-
echo ""
|
77
|
-
echo "I suggest changing to ~ or /tmp or something..."
|
78
|
-
echo ""
|
79
|
-
echo "Sleeping 2 seconds."
|
80
|
-
echo ""
|
81
|
-
) 1>&2
|
82
|
-
sleep 2
|
83
|
-
fi
|
84
|
-
|
85
|
-
# Set this to where you check out puppet and facter
|
86
|
-
: ${ENVPUPPET_BASEDIR:="${HOME}/src"}
|
87
|
-
# Are we bleeding edge?
|
88
|
-
: ${ENVPUPPET_BLEEDING:='false'}
|
89
|
-
|
90
|
-
# git://github.com/puppetlabs/puppet.git
|
91
|
-
mypath="${ENVPUPPET_BASEDIR}/puppet/sbin:${ENVPUPPET_BASEDIR}/puppet/bin"
|
92
|
-
myrubylib="${ENVPUPPET_BASEDIR}/puppet/lib"
|
93
|
-
|
94
|
-
# git://github.com/puppetlabs/facter.git
|
95
|
-
mypath="${mypath}:${ENVPUPPET_BASEDIR}/facter/bin"
|
96
|
-
myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/facter/lib"
|
97
|
-
|
98
|
-
# git://github.com/puppetlabs/hiera.git
|
99
|
-
mypath="${mypath}:${ENVPUPPET_BASEDIR}/hiera/bin"
|
100
|
-
myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/hiera/lib"
|
101
|
-
|
102
|
-
if [ "${ENVPUPPET_BLEEDING:-}" = "true" ]; then
|
103
|
-
# git://github.com/puppetlabs/facter.git
|
104
|
-
mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-interfaces/bin"
|
105
|
-
myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-interfaces/lib"
|
106
|
-
fi
|
107
|
-
|
108
|
-
# https://github.com/jamtur01/puppet-scaffold.git
|
109
|
-
mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-scaffold/bin"
|
110
|
-
myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-scaffold/lib"
|
111
|
-
|
112
|
-
# https://github.com/puppetlabs/puppet-module-tool.git
|
113
|
-
# Also known as "pmt" Will become "puppet module"
|
114
|
-
mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-module-tool/bin"
|
115
|
-
myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-module-tool/lib"
|
116
|
-
|
117
|
-
# Use the existing environment, if present.
|
118
|
-
# Default to no value to prevent unbound variable issues
|
119
|
-
mypath="${mypath}:${PATH:-}"
|
120
|
-
myrubylib="${myrubylib}:${RUBYLIB:-}"
|
121
|
-
|
122
|
-
export ENVPUPPET_OLD_PATH="${PATH:-}"
|
123
|
-
export ENVPUPPET_OLD_RUBYLIB="${RUBYLIB:-}"
|
124
|
-
|
125
|
-
# Trim any trailing colons from the path list.
|
126
|
-
export PATH="${mypath%%:}"
|
127
|
-
export RUBYLIB="${myrubylib%%:}"
|
128
|
-
|
129
|
-
if [ $# -eq 0 ]; then
|
130
|
-
echo "export ENVPUPPET_OLD_PATH='${ENVPUPPET_OLD_PATH}'"
|
131
|
-
echo "export ENVPUPPET_OLD_RUBYLIB='${ENVPUPPET_OLD_RUBYLIB}'"
|
132
|
-
echo "export ENVPUPPET_BASEDIR='${ENVPUPPET_BASEDIR}'"
|
133
|
-
echo "export ENVPUPPET_BLEEDING='${ENVPUPPET_BLEEDING}'"
|
134
|
-
echo "export PATH='${PATH}'"
|
135
|
-
echo "export RUBYLIB='${RUBYLIB}'"
|
136
|
-
else
|
137
|
-
exec "$@"
|
138
|
-
fi
|
139
|
-
|
data/ext/envpuppet.bat
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
@echo off
|
2
|
-
SETLOCAL
|
3
|
-
|
4
|
-
REM net use Z: "\\vmware-host\Shared Folders" /persistent:yes
|
5
|
-
|
6
|
-
SET PUPPET_DIR=%~dp0..
|
7
|
-
SET FACTER_DIR=%PUPPET_DIR%\..\facter
|
8
|
-
SET HIERA_DIR=%PUPPET_DIR%\..\hiera
|
9
|
-
|
10
|
-
SET PATH=%PUPPET_DIR%\bin;%FACTER_DIR%\bin;%HIERA_DIR%\bin;%PATH%
|
11
|
-
SET RUBYLIB=%PUPPET_DIR%\lib;%FACTER_DIR%\lib;%HIERA_DIR%\lib;%RUBYLIB%
|
12
|
-
SET RUBYLIB=%RUBYLIB:\=/%
|
13
|
-
|
14
|
-
ruby -S %*
|
data/ext/puppet-test
DELETED
@@ -1,476 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# == Synopsis
|
3
|
-
#
|
4
|
-
# Test individual client performance. Can compile configurations, describe
|
5
|
-
# files, or retrieve files.
|
6
|
-
#
|
7
|
-
# = Usage
|
8
|
-
#
|
9
|
-
# puppet-test [-c|--compile] [-D|--describe <file>] [-d|--debug]
|
10
|
-
# [--fork <num>] [-h|--help] [-H|--hostname <host name>] [-l|--list] [-r|--repeat <number=1>]
|
11
|
-
# [-R|--retrieve <file>] [-t|--test <test>] [-V|--version] [-v|--verbose]
|
12
|
-
#
|
13
|
-
# = Description
|
14
|
-
#
|
15
|
-
# This is a simple script meant for doing performance tests with Puppet. By
|
16
|
-
# default it pulls down a compiled configuration, but it supports multiple
|
17
|
-
# other tests.
|
18
|
-
#
|
19
|
-
# = Options
|
20
|
-
#
|
21
|
-
# Note that any setting that's valid in the configuration file
|
22
|
-
# is also a valid long argument. For example, 'server' is a valid configuration
|
23
|
-
# parameter, so you can specify '--server <servername>' as an argument.
|
24
|
-
#
|
25
|
-
# See the configuration file documentation at
|
26
|
-
# https://puppet.com/docs/puppet/latest/config_about_settings.html
|
27
|
-
# for the full list of acceptable parameters. A commented list of all
|
28
|
-
# configuration $options can also be generated by running puppetd with
|
29
|
-
# '--genconfig'.
|
30
|
-
#
|
31
|
-
# compile::
|
32
|
-
# Compile the client's configuration. The default.
|
33
|
-
#
|
34
|
-
# debug::
|
35
|
-
# Enable full debugging.
|
36
|
-
#
|
37
|
-
# describe::
|
38
|
-
# Describe the file being tested. This is a query to get information about
|
39
|
-
# the file from the server, to determine if it should be copied, and is the
|
40
|
-
# first half of every file transfer.
|
41
|
-
#
|
42
|
-
# fork::
|
43
|
-
# Fork the specified number of times, thus acting as multiple clients.
|
44
|
-
#
|
45
|
-
# fqdn::
|
46
|
-
# Set the fully-qualified domain name of the client. This is only used for
|
47
|
-
# certificate purposes, but can be used to override the discovered hostname.
|
48
|
-
# If you need to use this flag, it is generally an indication of a setup problem.
|
49
|
-
#
|
50
|
-
# help::
|
51
|
-
# Print this help message
|
52
|
-
#
|
53
|
-
# list::
|
54
|
-
# List all available tests.
|
55
|
-
#
|
56
|
-
# node::
|
57
|
-
# Specify the node to use. This is useful for looking up cached yaml data
|
58
|
-
# in your :clientyaml directory, and forcing a specific host's configuration to
|
59
|
-
# get compiled.
|
60
|
-
#
|
61
|
-
# pause::
|
62
|
-
# Pause before starting test (useful for testing with dtrace).
|
63
|
-
#
|
64
|
-
# repeat::
|
65
|
-
# How many times to perform the test.
|
66
|
-
#
|
67
|
-
# retrieve::
|
68
|
-
# Test file retrieval performance. Retrieves the specified file from the
|
69
|
-
# remote system. Note that the server should be specified via --server,
|
70
|
-
# so the argument to this option is just the remote module name and path,
|
71
|
-
# e.g., "/dist/apps/myapp/myfile", where "dist" is the module and
|
72
|
-
# "apps/myapp/myfile" is the path to the file relative to the module.
|
73
|
-
#
|
74
|
-
# test::
|
75
|
-
# Specify the test to run. You can see the list of tests by running this command with --list.
|
76
|
-
#
|
77
|
-
# verbose::
|
78
|
-
# Turn on verbose reporting.
|
79
|
-
#
|
80
|
-
# version::
|
81
|
-
# Print the puppet version number and exit.
|
82
|
-
#
|
83
|
-
# = Example
|
84
|
-
#
|
85
|
-
# puppet-test --retrieve /module/path/to/file
|
86
|
-
#
|
87
|
-
# = License
|
88
|
-
# Copyright 2011 Luke Kanies
|
89
|
-
#
|
90
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
91
|
-
# you may not use this file except in compliance with the License.
|
92
|
-
# You may obtain a copy of the License at
|
93
|
-
#
|
94
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
95
|
-
#
|
96
|
-
# Unless required by applicable law or agreed to in writing, software
|
97
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
98
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
99
|
-
# See the License for the specific language governing permissions and
|
100
|
-
# limitations under the License.
|
101
|
-
|
102
|
-
# Do an initial trap, so that cancels don't get a stack trace.
|
103
|
-
trap(:INT) do
|
104
|
-
$stderr.puts "Cancelling startup"
|
105
|
-
exit(1)
|
106
|
-
end
|
107
|
-
|
108
|
-
require 'puppet'
|
109
|
-
require 'puppet/network/client'
|
110
|
-
require 'getoptlong'
|
111
|
-
|
112
|
-
class Suite
|
113
|
-
attr_reader :name, :doc
|
114
|
-
|
115
|
-
@@suites = {}
|
116
|
-
@@tests = {}
|
117
|
-
|
118
|
-
def self.[](name)
|
119
|
-
@@suites[name]
|
120
|
-
end
|
121
|
-
|
122
|
-
# Run a test by first finding the suite then running the appropriate test.
|
123
|
-
def self.run(test)
|
124
|
-
unless suite_name = @@tests[test]
|
125
|
-
raise "Unknown test %s" % test
|
126
|
-
|
127
|
-
end
|
128
|
-
unless suite = @@suites[suite_name]
|
129
|
-
raise "Unknown test suite %s from test %s" % [suite_name, test]
|
130
|
-
end
|
131
|
-
|
132
|
-
suite.run(test)
|
133
|
-
end
|
134
|
-
|
135
|
-
# What suites are available?
|
136
|
-
def self.suites
|
137
|
-
@@suites.keys
|
138
|
-
end
|
139
|
-
|
140
|
-
def forked?
|
141
|
-
defined? @forking
|
142
|
-
end
|
143
|
-
|
144
|
-
# Create a new test suite.
|
145
|
-
def initialize(name, doc, &block)
|
146
|
-
@name = name
|
147
|
-
@doc = doc
|
148
|
-
|
149
|
-
@tests = {}
|
150
|
-
|
151
|
-
@@suites[name] = self
|
152
|
-
|
153
|
-
raise "You must pass a block to the Test" unless block_given?
|
154
|
-
instance_eval(&block)
|
155
|
-
end
|
156
|
-
|
157
|
-
# Define a new type of test on this suite.
|
158
|
-
def newtest(name, doc, &block)
|
159
|
-
@tests[name] = doc
|
160
|
-
|
161
|
-
if @@tests[name]
|
162
|
-
raise "Test names must be unique; cannot redefine %s" % name
|
163
|
-
end
|
164
|
-
|
165
|
-
@@tests[name] = @name
|
166
|
-
|
167
|
-
meta_def(name, &block)
|
168
|
-
end
|
169
|
-
|
170
|
-
# Run the actual test.
|
171
|
-
def run(test)
|
172
|
-
unless doc = @tests[test]
|
173
|
-
raise "Suite %s only supports tests %s; not %s" % [@name, @tests.keys.collect { |k| k.to_s }.join(","), test]
|
174
|
-
end
|
175
|
-
puts "Running %s %s test" % [@name, test]
|
176
|
-
|
177
|
-
prepare() if respond_to?(:prepare)
|
178
|
-
|
179
|
-
if $options[:pause]
|
180
|
-
puts "Hit any key to continue"
|
181
|
-
$stdin.readline
|
182
|
-
puts "Continuing with test"
|
183
|
-
end
|
184
|
-
|
185
|
-
if $options[:fork] > 0
|
186
|
-
@forking = true
|
187
|
-
$options[:fork].times {
|
188
|
-
if pid = fork
|
189
|
-
$pids << pid
|
190
|
-
else
|
191
|
-
break
|
192
|
-
end
|
193
|
-
}
|
194
|
-
end
|
195
|
-
|
196
|
-
$options[:repeat].times do |i|
|
197
|
-
@count = i
|
198
|
-
escaped_doc = doc.gsub(/%/, '%%')
|
199
|
-
if forked?
|
200
|
-
msg = escaped_doc + " in PID %{process_id} in %%{seconds} seconds" % { process_id: Process.pid }
|
201
|
-
else
|
202
|
-
msg = escaped_doc + " in %{seconds} seconds"
|
203
|
-
end
|
204
|
-
Puppet::Util.benchmark(:notice, msg) do
|
205
|
-
begin
|
206
|
-
send(test)
|
207
|
-
rescue => detail
|
208
|
-
puts detail.backtrace if Puppet[:trace]
|
209
|
-
Puppet.err "%s failed: %s" % [@name, detail.to_s]
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
# What tests are available on this suite?
|
216
|
-
def tests
|
217
|
-
@tests.keys
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
Suite.new :parser, "Manifest parsing" do
|
222
|
-
newtest :parse, "Parsed files" do
|
223
|
-
@parser = Puppet::Parser::Parser.new(:environment => Puppet[:environment])
|
224
|
-
@parser.file = Puppet[:manifest]
|
225
|
-
@parser.parse
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
Suite.new :local_catalog, "Local catalog handling" do
|
230
|
-
def prepare
|
231
|
-
@node = Puppet::Node.find($options[:nodes][0])
|
232
|
-
end
|
233
|
-
|
234
|
-
newtest :compile, "Compiled catalog" do
|
235
|
-
Puppet::Resource::Catalog.find(@node)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
Suite.new :remote_catalog, "Remote catalog handling" do
|
240
|
-
def prepare
|
241
|
-
$args[:cache] = false
|
242
|
-
# Create a config client and pull the config down
|
243
|
-
@client = Puppet::Network::Client.master.new($args)
|
244
|
-
unless @client.read_cert
|
245
|
-
fail "Could not read client certificate"
|
246
|
-
end
|
247
|
-
|
248
|
-
if tmp = Puppet::Node::Facts.find($options[:nodes][0])
|
249
|
-
@facts = tmp.values
|
250
|
-
else
|
251
|
-
raise "Could not find facts for %s" % $optins[:nodes][0]
|
252
|
-
end
|
253
|
-
|
254
|
-
if host = $options[:fqdn]
|
255
|
-
@facts["fqdn"] = host
|
256
|
-
@facts["hostname"] = host.sub(/\..+/, '')
|
257
|
-
@facts["domain"] = host.sub(/^[^.]+\./, '')
|
258
|
-
end
|
259
|
-
|
260
|
-
@facts = YAML.dump(@facts)
|
261
|
-
end
|
262
|
-
|
263
|
-
newtest :getconfig, "Compiled catalog" do
|
264
|
-
@client.driver.getconfig(@facts, "yaml")
|
265
|
-
end
|
266
|
-
|
267
|
-
# This test will always force a false answer.
|
268
|
-
newtest :fresh, "Checked freshness" do
|
269
|
-
@client.driver.freshness
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
Suite.new :file, "File interactions" do
|
274
|
-
def prepare
|
275
|
-
unless $options[:file]
|
276
|
-
fail "You must specify a file (using --file <file>) to interact with on the server"
|
277
|
-
end
|
278
|
-
@client = Puppet::Network::Client.file.new($args)
|
279
|
-
unless @client.read_cert
|
280
|
-
fail "Could not read client certificate"
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
|
-
newtest :describe, "Described file" do
|
285
|
-
@client.describe($options[:file], :ignore)
|
286
|
-
end
|
287
|
-
|
288
|
-
newtest :retrieve, "Retrieved file" do
|
289
|
-
@client.retrieve($options[:file], :ignore)
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
Suite.new :filebucket, "Filebucket interactions" do
|
294
|
-
def prepare
|
295
|
-
require 'tempfile'
|
296
|
-
@client = Puppet::FileBucket::Dipper.new($args)
|
297
|
-
end
|
298
|
-
|
299
|
-
newtest :backup, "Backed up file" do
|
300
|
-
Tempfile.open("bucket_testing") do |f|
|
301
|
-
f.print rand(1024)
|
302
|
-
f.close
|
303
|
-
@client.backup(f.path)
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
Suite.new :report, "Reports interactions" do
|
309
|
-
def prepare
|
310
|
-
Puppet::Transaction::Report.terminus_class = :rest
|
311
|
-
end
|
312
|
-
|
313
|
-
newtest :empty, "send empty report" do
|
314
|
-
report = Puppet::Transaction::Report.new
|
315
|
-
report.time = Time.now
|
316
|
-
report.save
|
317
|
-
end
|
318
|
-
|
319
|
-
newtest :fake, "send fake report" do
|
320
|
-
report = Puppet::Transaction::Report.new
|
321
|
-
|
322
|
-
resourcemetrics = {
|
323
|
-
:total => 12,
|
324
|
-
:out_of_sync => 20,
|
325
|
-
:applied => 45,
|
326
|
-
:skipped => 1,
|
327
|
-
:restarted => 23,
|
328
|
-
:failed_restarts => 1,
|
329
|
-
:scheduled => 10
|
330
|
-
}
|
331
|
-
report.newmetric(:resources, resourcemetrics)
|
332
|
-
|
333
|
-
timemetrics = {
|
334
|
-
:resource1 => 10,
|
335
|
-
:resource2 => 50,
|
336
|
-
:resource3 => 40,
|
337
|
-
:resource4 => 20,
|
338
|
-
}
|
339
|
-
report.newmetric(:times, timemetrics)
|
340
|
-
|
341
|
-
report.newmetric(:changes,
|
342
|
-
:total => 20
|
343
|
-
)
|
344
|
-
|
345
|
-
report.time = Time.now
|
346
|
-
report.save
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
|
351
|
-
$cmdargs = [
|
352
|
-
[ "--compile", "-c", GetoptLong::NO_ARGUMENT ],
|
353
|
-
[ "--describe", GetoptLong::REQUIRED_ARGUMENT ],
|
354
|
-
[ "--retrieve", "-R", GetoptLong::REQUIRED_ARGUMENT ],
|
355
|
-
[ "--fork", GetoptLong::REQUIRED_ARGUMENT ],
|
356
|
-
[ "--fqdn", "-F", GetoptLong::REQUIRED_ARGUMENT ],
|
357
|
-
[ "--suite", "-s", GetoptLong::REQUIRED_ARGUMENT ],
|
358
|
-
[ "--test", "-t", GetoptLong::REQUIRED_ARGUMENT ],
|
359
|
-
[ "--pause", "-p", GetoptLong::NO_ARGUMENT ],
|
360
|
-
[ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ],
|
361
|
-
[ "--node", "-n", GetoptLong::REQUIRED_ARGUMENT ],
|
362
|
-
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
363
|
-
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
364
|
-
[ "--list", "-l", GetoptLong::NO_ARGUMENT ],
|
365
|
-
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
366
|
-
[ "--version", "-V", GetoptLong::NO_ARGUMENT ],
|
367
|
-
]
|
368
|
-
|
369
|
-
# Add all of the config parameters as valid $options.
|
370
|
-
Puppet.settings.addargs($cmdargs)
|
371
|
-
Puppet::Util::Log.newdestination(:console)
|
372
|
-
|
373
|
-
Puppet::Node.terminus_class = :plain
|
374
|
-
Puppet::Node.cache_class = :yaml
|
375
|
-
Puppet::Node::Facts.terminus_class = :facter
|
376
|
-
Puppet::Node::Facts.cache_class = :yaml
|
377
|
-
|
378
|
-
result = GetoptLong.new(*$cmdargs)
|
379
|
-
|
380
|
-
$args = {}
|
381
|
-
|
382
|
-
$options = {:repeat => 1, :fork => 0, :pause => false, :nodes => []}
|
383
|
-
|
384
|
-
begin
|
385
|
-
result.each { |opt,arg|
|
386
|
-
case opt
|
387
|
-
# First check to see if the argument is a valid setting;
|
388
|
-
# if so, set it.
|
389
|
-
when "--compile"
|
390
|
-
$options[:suite] = :configuration
|
391
|
-
$options[:test] = :compile
|
392
|
-
when "--retrieve"
|
393
|
-
$options[:suite] = :file
|
394
|
-
$options[:test] = :retrieve
|
395
|
-
$options[:file] = arg
|
396
|
-
when "--fork"
|
397
|
-
begin
|
398
|
-
$options[:fork] = Integer(arg)
|
399
|
-
rescue
|
400
|
-
$stderr.puts "The argument to 'fork' must be an integer"
|
401
|
-
exit(14)
|
402
|
-
end
|
403
|
-
when "--describe"
|
404
|
-
$options[:suite] = :file
|
405
|
-
$options[:test] = :describe
|
406
|
-
$options[:file] = arg
|
407
|
-
when "--fqdn"
|
408
|
-
$options[:fqdn] = arg
|
409
|
-
when "--repeat"
|
410
|
-
$options[:repeat] = Integer(arg)
|
411
|
-
when "--help"
|
412
|
-
if Puppet.features.usage?
|
413
|
-
RDoc::usage && exit
|
414
|
-
else
|
415
|
-
puts "No help available unless you have RDoc::usage installed"
|
416
|
-
exit
|
417
|
-
end
|
418
|
-
when "--version"
|
419
|
-
puts "%s" % Puppet.version
|
420
|
-
exit
|
421
|
-
when "--verbose"
|
422
|
-
Puppet::Util::Log.level = :info
|
423
|
-
Puppet::Util::Log.newdestination(:console)
|
424
|
-
when "--debug"
|
425
|
-
Puppet::Util::Log.level = :debug
|
426
|
-
Puppet::Util::Log.newdestination(:console)
|
427
|
-
when "--suite"
|
428
|
-
$options[:suite] = arg.intern
|
429
|
-
when "--test"
|
430
|
-
$options[:test] = arg.intern
|
431
|
-
when "--file"
|
432
|
-
$options[:file] = arg
|
433
|
-
when "--pause"
|
434
|
-
$options[:pause] = true
|
435
|
-
when "--node"
|
436
|
-
$options[:nodes] << arg
|
437
|
-
when "--list"
|
438
|
-
Suite.suites.sort_by(&:to_s).each do |suite_name|
|
439
|
-
suite = Suite[suite_name]
|
440
|
-
tests = suite.tests.sort_by(&:to_s).join(", ")
|
441
|
-
puts "%20s: %s" % [suite_name, tests]
|
442
|
-
end
|
443
|
-
exit(0)
|
444
|
-
else
|
445
|
-
Puppet.settings.handlearg(opt, arg)
|
446
|
-
end
|
447
|
-
}
|
448
|
-
rescue GetoptLong::InvalidOption => detail
|
449
|
-
$stderr.puts detail
|
450
|
-
$stderr.puts "Try '#{$0} --help'"
|
451
|
-
exit(1)
|
452
|
-
end
|
453
|
-
|
454
|
-
# Now parse the config
|
455
|
-
Puppet.initialize_settings
|
456
|
-
|
457
|
-
$options[:nodes] << Puppet.settings[:certname] if $options[:nodes].empty?
|
458
|
-
|
459
|
-
$args[:Server] = Puppet[:server]
|
460
|
-
|
461
|
-
unless $options[:test]
|
462
|
-
$options[:suite] = :remote_catalog
|
463
|
-
$options[:test] = :getconfig
|
464
|
-
end
|
465
|
-
|
466
|
-
unless $options[:test]
|
467
|
-
raise "A suite was specified without a test"
|
468
|
-
end
|
469
|
-
|
470
|
-
$pids = []
|
471
|
-
|
472
|
-
Suite.run($options[:test])
|
473
|
-
|
474
|
-
if $options[:fork] > 0
|
475
|
-
Process.waitall
|
476
|
-
end
|