puppet 2.7.13 → 2.7.14
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/CHANGELOG +144 -1
- data/conf/osx/preflight +1 -1
- data/conf/redhat/puppet.spec +9 -5
- data/conf/suse/puppet.spec +4 -1
- data/conf/windows/eventlog/Rakefile +32 -0
- data/conf/windows/eventlog/puppetres.dll +0 -0
- data/conf/windows/eventlog/puppetres.mc +18 -0
- data/ext/rack/files/apache2.conf +3 -0
- data/install.rb +23 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +1 -14
- data/lib/puppet/application/kick.rb +1 -1
- data/lib/puppet/application/module.rb +11 -0
- data/lib/puppet/daemon.rb +74 -3
- data/lib/puppet/defaults.rb +1 -1
- data/lib/puppet/face/certificate.rb +1 -1
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/module.rb +17 -0
- data/lib/puppet/face/module/build.rb +10 -4
- data/lib/puppet/face/module/changes.rb +5 -5
- data/lib/puppet/face/module/generate.rb +6 -4
- data/lib/puppet/face/module/install.rb +122 -32
- data/lib/puppet/face/module/list.rb +234 -33
- data/lib/puppet/face/module/search.rb +56 -23
- data/lib/puppet/face/module/uninstall.rb +33 -38
- data/lib/puppet/face/module/upgrade.rb +84 -0
- data/lib/puppet/feature/eventlog.rb +6 -0
- data/lib/puppet/forge.rb +67 -122
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/repository.rb +6 -25
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/interface/action.rb +1 -1
- data/lib/puppet/module.rb +79 -28
- data/lib/puppet/module_tool.rb +72 -34
- data/lib/puppet/module_tool/applications.rb +12 -14
- data/lib/puppet/module_tool/applications/application.rb +21 -19
- data/lib/puppet/module_tool/applications/builder.rb +4 -4
- data/lib/puppet/module_tool/applications/checksummer.rb +12 -3
- data/lib/puppet/module_tool/applications/generator.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +163 -34
- data/lib/puppet/module_tool/applications/searcher.rb +2 -3
- data/lib/puppet/module_tool/applications/uninstaller.rb +84 -36
- data/lib/puppet/module_tool/applications/unpacker.rb +4 -26
- data/lib/puppet/module_tool/applications/upgrader.rb +109 -0
- data/lib/puppet/module_tool/checksums.rb +2 -2
- data/lib/puppet/module_tool/contents_description.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +2 -2
- data/lib/puppet/module_tool/errors.rb +9 -0
- data/lib/puppet/module_tool/errors/base.rb +15 -0
- data/lib/puppet/module_tool/errors/installer.rb +90 -0
- data/lib/puppet/module_tool/errors/shared.rb +115 -0
- data/lib/puppet/module_tool/errors/uninstaller.rb +45 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +72 -0
- data/lib/puppet/module_tool/metadata.rb +2 -2
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +161 -0
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/node/environment.rb +4 -2
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/functions/create_resources.rb +3 -2
- data/lib/puppet/parser/scope.rb +44 -9
- data/lib/puppet/provider/augeas/augeas.rb +2 -2
- data/lib/puppet/provider/exec.rb +8 -3
- data/lib/puppet/provider/exec/shell.rb +1 -2
- data/lib/puppet/provider/nameservice/directoryservice.rb +10 -4
- data/lib/puppet/provider/package/gem.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +10 -21
- data/lib/puppet/provider/selmodule/semodule.rb +1 -2
- data/lib/puppet/provider/service/upstart.rb +33 -17
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/rails/inventory_node.rb +7 -7
- data/lib/puppet/reports/http.rb +4 -1
- data/lib/puppet/reports/tagmail.rb +8 -1
- data/lib/puppet/resource/type.rb +1 -1
- data/lib/puppet/test/test_helper.rb +138 -0
- data/lib/puppet/type.rb +9 -1
- data/lib/puppet/type/file.rb +18 -10
- data/lib/puppet/type/package.rb +13 -9
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/ssh_authorized_key.rb +3 -4
- data/lib/puppet/type/sshkey.rb +4 -4
- data/lib/puppet/type/user.rb +1 -0
- data/lib/puppet/type/vlan.rb +1 -1
- data/lib/puppet/util.rb +31 -14
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/command_line.rb +2 -6
- data/lib/puppet/util/instrumentation/indirection_probe.rb +1 -1
- data/lib/puppet/util/instrumentation/instrumentable.rb +1 -1
- data/lib/puppet/util/instrumentation/listeners/log.rb +1 -1
- data/lib/puppet/util/instrumentation/listeners/performance.rb +1 -1
- data/lib/puppet/util/log.rb +3 -1
- data/lib/puppet/util/log/destinations.rb +38 -0
- data/lib/puppet/util/monkey_patches.rb +45 -0
- data/lib/puppet/util/network_device/base.rb +1 -1
- data/lib/puppet/util/network_device/cisco.rb +1 -1
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/cisco/interface.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +1 -1
- data/lib/puppet/util/network_device/ipcalc.rb +1 -1
- data/lib/puppet/util/network_device/transport.rb +1 -1
- data/lib/puppet/util/network_device/transport/base.rb +1 -1
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/settings.rb +2 -11
- data/lib/puppet/util/settings/file_setting.rb +3 -5
- data/lib/puppet/util/terminal.rb +16 -0
- data/lib/puppet/util/zaml.rb +3 -1
- data/lib/semver.rb +15 -7
- data/spec/fixtures/releases/jamtur01-apache/metadata.json +1 -1
- data/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp +1 -1
- data/spec/fixtures/unit/provider/package/pkg/dummy +1 -0
- data/spec/fixtures/unit/provider/package/pkg/incomplete +1 -0
- data/spec/fixtures/unit/provider/package/pkg/publisher +2 -0
- data/spec/fixtures/unit/provider/package/pkg/simple +4 -0
- data/spec/fixtures/unit/reports/tagmail/tagmail_email.conf +2 -0
- data/spec/fixtures/yaml/report0.25.x.yaml +1 -1
- data/spec/fixtures/yaml/report2.6.x.yaml +1 -1
- data/spec/integration/faces/documentation_spec.rb +1 -1
- data/spec/integration/network/rest_authconfig_spec.rb +1 -1
- data/spec/lib/puppet_spec/compiler.rb +6 -0
- data/spec/lib/puppet_spec/database.rb +30 -0
- data/spec/lib/puppet_spec/files.rb +4 -2
- data/spec/shared_behaviours/path_parameters.rb +2 -29
- data/spec/shared_contexts/platform.rb +43 -0
- data/spec/spec_helper.rb +36 -65
- data/spec/unit/agent_spec.rb +0 -32
- data/spec/unit/application/kick_spec.rb +2 -2
- data/spec/unit/daemon_spec.rb +1 -17
- data/spec/unit/face/module/install_spec.rb +158 -0
- data/spec/unit/face/module/list_spec.rb +182 -0
- data/spec/unit/face/module/search_spec.rb +163 -0
- data/spec/unit/face/module/uninstall_spec.rb +77 -0
- data/spec/unit/face/module/upgrade_spec.rb +26 -0
- data/spec/unit/forge/repository_spec.rb +0 -30
- data/spec/unit/forge_spec.rb +28 -86
- data/spec/unit/indirector/catalog/active_record_spec.rb +45 -65
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +5 -18
- data/spec/unit/indirector/resource/active_record_spec.rb +2 -11
- data/spec/unit/indirector/resource/ral_spec.rb +7 -2
- data/spec/unit/module_spec.rb +240 -107
- data/spec/unit/module_tool/application_spec.rb +3 -5
- data/spec/unit/module_tool/applications/application_spec.rb +19 -0
- data/spec/unit/module_tool/applications/installer_spec.rb +205 -0
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +206 -0
- data/spec/unit/module_tool/applications/upgrader_spec.rb +37 -0
- data/spec/unit/module_tool/metadata_spec.rb +2 -2
- data/spec/unit/module_tool_spec.rb +109 -1
- data/spec/unit/node/environment_spec.rb +16 -1
- data/spec/unit/parser/ast/leaf_spec.rb +16 -1
- data/spec/unit/parser/collector_spec.rb +2 -12
- data/spec/unit/parser/functions/create_resources_spec.rb +135 -86
- data/spec/unit/parser/functions/generate_spec.rb +2 -10
- data/spec/unit/parser/scope_spec.rb +345 -16
- data/spec/unit/provider/augeas/augeas_spec.rb +19 -0
- data/spec/unit/provider/exec/shell_spec.rb +17 -14
- data/spec/unit/provider/exec/windows_spec.rb +1 -7
- data/spec/unit/provider/exec_spec.rb +35 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +10 -0
- data/spec/unit/provider/package/dpkg_spec.rb +2 -1
- data/spec/unit/provider/package/gem_spec.rb +15 -0
- data/spec/unit/provider/package/openbsd_spec.rb +5 -4
- data/spec/unit/provider/package/pacman_spec.rb +3 -2
- data/spec/unit/provider/package/pkg_spec.rb +56 -33
- data/spec/unit/provider/selmodule_spec.rb +11 -4
- data/spec/unit/provider/service/redhat_spec.rb +1 -3
- data/spec/unit/provider/service/smf_spec.rb +1 -3
- data/spec/unit/provider/service/upstart_spec.rb +38 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +28 -0
- data/spec/unit/rails/host_spec.rb +6 -12
- data/spec/unit/rails/param_value_spec.rb +3 -8
- data/spec/unit/rails/resource_spec.rb +2 -8
- data/spec/unit/reports/http_spec.rb +47 -31
- data/spec/unit/reports/tagmail_spec.rb +77 -0
- data/spec/unit/resource/type_spec.rb +2 -2
- data/spec/unit/resource_spec.rb +18 -20
- data/spec/unit/semver_spec.rb +31 -13
- data/spec/unit/type/exec_spec.rb +8 -15
- data/spec/unit/type/group_spec.rb +0 -9
- data/spec/unit/type/package_spec.rb +10 -0
- data/spec/unit/type/resources_spec.rb +4 -5
- data/spec/unit/type/ssh_authorized_key_spec.rb +4 -15
- data/spec/unit/type/sshkey_spec.rb +9 -11
- data/spec/unit/type/user_spec.rb +123 -127
- data/spec/unit/type_spec.rb +20 -0
- data/spec/unit/util/command_line_spec.rb +2 -2
- data/spec/unit/util/instrumentation/data_spec.rb +1 -1
- data/spec/unit/util/instrumentation/indirection_probe_spec.rb +1 -1
- data/spec/unit/util/instrumentation/instrumentable_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listener_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listeners/log_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listeners/performance_spec.rb +1 -1
- data/spec/unit/util/instrumentation_spec.rb +1 -1
- data/spec/unit/util/log/destinations_spec.rb +4 -8
- data/spec/unit/util/log_spec.rb +47 -0
- data/spec/unit/util/reference_spec.rb +1 -1
- data/spec/unit/util/settings/file_setting_spec.rb +9 -0
- data/spec/unit/util/settings_spec.rb +0 -53
- data/spec/unit/util/terminal_spec.rb +42 -0
- data/spec/unit/util/zaml_spec.rb +7 -0
- data/spec/unit/util_spec.rb +63 -20
- data/tasks/rake/manpages.rake +1 -1
- data/test/data/snippets/arithmetic_expression.pp +1 -1
- data/test/other/puppet.rb +0 -1
- data/test/util/log.rb +6 -6
- metadata +41 -16
- data/lib/puppet/external/event-loop.rb +0 -1
- data/lib/puppet/external/event-loop/better-definers.rb +0 -367
- data/lib/puppet/external/event-loop/event-loop.rb +0 -355
- data/lib/puppet/external/event-loop/signal-system.rb +0 -218
- data/lib/puppet/face/module/clean.rb +0 -30
- data/lib/puppet/module_tool/applications/cleaner.rb +0 -16
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json +0 -12
- data/lib/puppet/module_tool/utils.rb +0 -5
- data/lib/puppet/module_tool/utils/interrogation.rb +0 -25
- data/spec/integration/module_tool_spec.rb +0 -475
- data/spec/unit/module_tool/uninstaller_spec.rb +0 -124
data/lib/puppet/util/settings.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'puppet'
|
2
2
|
require 'sync'
|
3
3
|
require 'getoptlong'
|
4
|
-
require 'puppet/external/event-loop'
|
5
4
|
require 'puppet/util/loadedfile'
|
6
5
|
|
7
6
|
# The class for handling configuration files.
|
@@ -296,10 +295,6 @@ class Puppet::Util::Settings
|
|
296
295
|
@sync.synchronize do
|
297
296
|
unsafe_parse(self[:config])
|
298
297
|
end
|
299
|
-
|
300
|
-
# Create a timer so that this file will get checked automatically
|
301
|
-
# and reparsed if necessary.
|
302
|
-
set_filetimeout_timer
|
303
298
|
end
|
304
299
|
|
305
300
|
# Unsafely parse the file -- this isn't thread-safe and causes plenty of problems if used directly.
|
@@ -549,12 +544,6 @@ class Puppet::Util::Settings
|
|
549
544
|
call.each { |setting| setting.handle(self.value(setting.name)) }
|
550
545
|
end
|
551
546
|
|
552
|
-
# Create a timer to check whether the file should be reparsed.
|
553
|
-
def set_filetimeout_timer
|
554
|
-
return unless timeout = self[:filetimeout] and timeout = Integer(timeout) and timeout > 0
|
555
|
-
timer = EventLoop::Timer.new(:interval => timeout, :tolerance => 1, :start? => true) { self.reparse }
|
556
|
-
end
|
557
|
-
|
558
547
|
# Convert the settings we manage into a catalog full of resources that model those settings.
|
559
548
|
def to_catalog(*sections)
|
560
549
|
sections = nil if sections.empty?
|
@@ -932,4 +921,6 @@ if @config.include?(:run_mode)
|
|
932
921
|
end
|
933
922
|
end
|
934
923
|
end
|
924
|
+
|
925
|
+
|
935
926
|
end
|
@@ -50,12 +50,10 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
|
|
50
50
|
def munge(value)
|
51
51
|
# If it's not a fully qualified path...
|
52
52
|
if value.is_a?(String) and value !~ /^\$/ and value != 'false'
|
53
|
-
#
|
53
|
+
# Preserve trailing slash (stripped by expand_path)
|
54
|
+
isdir = value =~ /\/$/
|
54
55
|
value = File.expand_path(value)
|
55
|
-
|
56
|
-
if value.to_s =~ /\/$/
|
57
|
-
@type = :directory
|
58
|
-
return value.sub(/\/$/, '')
|
56
|
+
value += '/' if isdir
|
59
57
|
end
|
60
58
|
value
|
61
59
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Puppet::Util::Terminal
|
2
|
+
# Attempts to determine the width of the terminal. This is currently only
|
3
|
+
# supported on POSIX systems, and relies on the claims of `stty` (or `tput`).
|
4
|
+
#
|
5
|
+
# Inspired by code from Thor; thanks wycats!
|
6
|
+
# @return [Number] The column width of the terminal. Defaults to 80 columns.
|
7
|
+
def self.width
|
8
|
+
if Puppet.features.posix?
|
9
|
+
result = %x{stty size 2>/dev/null}.split[1] ||
|
10
|
+
%x{tput cols 2>/dev/null}.split[0]
|
11
|
+
end
|
12
|
+
return (result || '80').to_i
|
13
|
+
rescue
|
14
|
+
return 80
|
15
|
+
end
|
16
|
+
end
|
data/lib/puppet/util/zaml.rb
CHANGED
data/lib/semver.rb
CHANGED
@@ -17,17 +17,21 @@ class SemVer < Numeric
|
|
17
17
|
versions.select { |v| v.matched_by?("#{pattern}") }.sort.last
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.pre(vstring)
|
21
|
+
vstring =~ /-/ ? vstring : vstring + '-'
|
22
|
+
end
|
23
|
+
|
20
24
|
def self.[](range)
|
21
25
|
range.gsub(/([><=])\s+/, '\1').split(/\b\s+(?!-)/).map do |r|
|
22
26
|
case r
|
23
27
|
when SemVer::VERSION
|
24
|
-
SemVer.new(r
|
28
|
+
SemVer.new(pre(r)) .. SemVer.new(r)
|
25
29
|
when SemVer::SIMPLE_RANGE
|
26
30
|
r += ".0" unless SemVer.valid?(r.gsub(/x/i, '0'))
|
27
31
|
SemVer.new(r.gsub(/x/i, '0'))...SemVer.new(r.gsub(/(\d+)\.x/i) { "#{$1.to_i + 1}.0" } + '-')
|
28
32
|
when /\s+-\s+/
|
29
33
|
a, b = r.split(/\s+-\s+/)
|
30
|
-
SemVer.new(a
|
34
|
+
SemVer.new(pre(a)) .. SemVer.new(b)
|
31
35
|
when /^~/
|
32
36
|
ver = r.sub(/~/, '').split('.').map(&:to_i)
|
33
37
|
start = (ver + [0] * (3 - ver.length)).join('.')
|
@@ -36,20 +40,24 @@ class SemVer < Numeric
|
|
36
40
|
ver[-1] = ver.last + 1
|
37
41
|
|
38
42
|
finish = (ver + [0] * (3 - ver.length)).join('.')
|
39
|
-
SemVer.new(start
|
43
|
+
SemVer.new(pre(start)) ... SemVer.new(pre(finish))
|
40
44
|
when /^>=/
|
41
45
|
ver = r.sub(/^>=/, '')
|
42
|
-
SemVer.new(ver
|
46
|
+
SemVer.new(pre(ver)) .. SemVer::MAX
|
43
47
|
when /^<=/
|
44
48
|
ver = r.sub(/^<=/, '')
|
45
49
|
SemVer::MIN .. SemVer.new(ver)
|
46
50
|
when /^>/
|
47
|
-
|
48
|
-
|
51
|
+
if r =~ /-/
|
52
|
+
ver = [r[1..-1]]
|
53
|
+
else
|
54
|
+
ver = r.sub(/^>/, '').split('.').map(&:to_i)
|
55
|
+
ver[2] = ver.last + 1
|
56
|
+
end
|
49
57
|
SemVer.new(ver.join('.') + '-') .. SemVer::MAX
|
50
58
|
when /^</
|
51
59
|
ver = r.sub(/^</, '')
|
52
|
-
SemVer::MIN ... SemVer.new(ver
|
60
|
+
SemVer::MIN ... SemVer.new(pre(ver))
|
53
61
|
else
|
54
62
|
(1..1)
|
55
63
|
end
|
@@ -1 +1 @@
|
|
1
|
-
{"dependencies":[],"types":[{"providers":[{"name":"a2mod","doc":"Manage Apache 2 modules on Debian and Ubuntu Required binaries: ``a2enmod``, ``a2dismod``. Default for ``operatingsystem`` == ``debianubuntu``. "}],"parameters":[{"name":"name","doc":"The name of the module to be managed"}],"properties":[{"name":"ensure","doc":"The basic property that the resource should be in. Valid values are ``present``, ``absent``."}],"name":"a2mod","doc":"Manage Apache 2 modules on Debian and Ubuntu"}],"checksums":{"manifests/params.pp":"71734796921dbdbfd58f503622527616","tests/ssl.pp":"191912535199531fd631f911c6329e56","tests/vhost.pp":"1b91e03c8ef89a7ecb6793831ac18399","manifests/php.pp":"b78cc593f1c4cd800c906e0891c9b11f","files/httpd":"295f5e924afe6f752d29327e73fe6d0a","tests/php.pp":"ce7bb9eef69d32b42a32ce32d9653625","lib/puppet/provider/a2mod/a2mod.rb":"18c5bb180b75a2375e95e07f88a94257","files/test.vhost":"0602022c19a7b6b289f218c7b93c1aea","manifests/ssl.pp":"b4334a161a2ba5fa8a62cf7b38f352c8","manifests/dev.pp":"510813942246cc9a7786d8f2d8874a35","manifests/vhost.pp":"cbc4657b0cce5cd432057393d5f6b0c2","tests/init.pp":"4eac4a7ef68499854c54a78879e25535","lib/puppet/type/a2mod.rb":"0e1b4843431413a10320ac1f6a055d15","tests/apache.pp":"4eac4a7ef68499854c54a78879e25535","tests/dev.pp":"4cf15c1fecea3ca86009f182b402c7ab","templates/vhost-default.conf.erb":"9055aed946e1111c30ab81fedac2c8b0","manifests/init.pp":"dc503e26e8021351078813b541c4bd3d","Modulefile":"d43334b4072cd1744121b3b25cd9ed15"},"version":"0.0.1","name":"jamtur01-apache"}
|
1
|
+
{"dependencies":[],"types":[{"providers":[{"name":"a2mod","doc":"Manage Apache 2 modules on Debian and Ubuntu Required binaries: ``a2enmod``, ``a2dismod``. Default for ``operatingsystem`` == ``debianubuntu``. "}],"parameters":[{"name":"name","doc":"The name of the module to be managed"}],"properties":[{"name":"ensure","doc":"The basic property that the resource should be in. Valid values are ``present``, ``absent``."}],"name":"a2mod","doc":"Manage Apache 2 modules on Debian and Ubuntu"}],"checksums":{"manifests/params.pp":"71734796921dbdbfd58f503622527616","tests/ssl.pp":"191912535199531fd631f911c6329e56","tests/vhost.pp":"1b91e03c8ef89a7ecb6793831ac18399","manifests/php.pp":"b78cc593f1c4cd800c906e0891c9b11f","files/httpd":"295f5e924afe6f752d29327e73fe6d0a","tests/php.pp":"ce7bb9eef69d32b42a32ce32d9653625","lib/puppet/provider/a2mod/a2mod.rb":"18c5bb180b75a2375e95e07f88a94257","files/test.vhost":"0602022c19a7b6b289f218c7b93c1aea","manifests/ssl.pp":"b4334a161a2ba5fa8a62cf7b38f352c8","manifests/dev.pp":"510813942246cc9a7786d8f2d8874a35","manifests/vhost.pp":"cbc4657b0cce5cd432057393d5f6b0c2","tests/init.pp":"4eac4a7ef68499854c54a78879e25535","lib/puppet/type/a2mod.rb":"0e1b4843431413a10320ac1f6a055d15","tests/apache.pp":"4eac4a7ef68499854c54a78879e25535","tests/dev.pp":"4cf15c1fecea3ca86009f182b402c7ab","templates/vhost-default.conf.erb":"9055aed946e1111c30ab81fedac2c8b0","manifests/init.pp":"dc503e26e8021351078813b541c4bd3d","Modulefile":"d43334b4072cd1744121b3b25cd9ed15"},"version":"0.0.1","name":"jamtur01-apache"}
|
@@ -0,0 +1 @@
|
|
1
|
+
dummy 2.5.5-0.111 installed ----
|
@@ -0,0 +1 @@
|
|
1
|
+
dummy 2.5.5-0.111 installed ---- RANDOM_TRASH
|
@@ -49,7 +49,7 @@ describe "documentation of faces" do
|
|
49
49
|
# REVISIT: This is less that ideal, I think, but right now I am more
|
50
50
|
# comfortable watching us ship with some copyright than without any; we
|
51
51
|
# can redress that when it becomes appropriate. --daniel 2011-04-27
|
52
|
-
its :copyright do should =~ /
|
52
|
+
its :copyright do should =~ /20\d{2}/ end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# This just makes some nice things available at global scope, and for setup of
|
2
|
+
# tests to use a real fake database, rather than a fake stubs-that-don't-work
|
3
|
+
# version of the same. Fun times.
|
4
|
+
def sqlite?
|
5
|
+
if $sqlite.nil?
|
6
|
+
begin
|
7
|
+
require 'sqlite3'
|
8
|
+
$sqlite = true
|
9
|
+
rescue LoadError
|
10
|
+
$sqlite = false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
$sqlite
|
14
|
+
end
|
15
|
+
|
16
|
+
def can_use_scratch_database?
|
17
|
+
sqlite? and Puppet.features.rails?
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
# This is expected to be called in your `before :each` block, and will get you
|
22
|
+
# ready to roll with a serious database and all. Cleanup is handled
|
23
|
+
# automatically for you. Nothing to do there.
|
24
|
+
def setup_scratch_database
|
25
|
+
dir = PuppetSpec::Files.tmpdir('puppet-sqlite')
|
26
|
+
Puppet[:dbadapter] = 'sqlite3'
|
27
|
+
Puppet[:dblocation] = (dir + 'storeconfigs.sqlite').to_s
|
28
|
+
Puppet[:railslog] = '/dev/null'
|
29
|
+
Puppet::Rails.init
|
30
|
+
end
|
@@ -35,7 +35,8 @@ module PuppetSpec::Files
|
|
35
35
|
path
|
36
36
|
end
|
37
37
|
|
38
|
-
def tmpfile(name)
|
38
|
+
def tmpfile(name) PuppetSpec::Files.tmpfile(name) end
|
39
|
+
def self.tmpfile(name)
|
39
40
|
# Generate a temporary file, just for the name...
|
40
41
|
source = Tempfile.new(name)
|
41
42
|
path = source.path
|
@@ -49,7 +50,8 @@ module PuppetSpec::Files
|
|
49
50
|
path
|
50
51
|
end
|
51
52
|
|
52
|
-
def tmpdir(name)
|
53
|
+
def tmpdir(name) PuppetSpec::Files.tmpdir(name) end
|
54
|
+
def self.tmpdir(name)
|
53
55
|
path = tmpfile(name)
|
54
56
|
FileUtils.mkdir_p(path)
|
55
57
|
path
|
@@ -87,26 +87,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
87
87
|
@param = param
|
88
88
|
end
|
89
89
|
|
90
|
-
|
91
|
-
@file_separator = File::SEPARATOR
|
92
|
-
end
|
93
|
-
after :each do
|
94
|
-
with_verbose_disabled do
|
95
|
-
verbose, $VERBOSE = $VERBOSE, nil
|
96
|
-
File::SEPARATOR = @file_separator
|
97
|
-
$VERBOSE = verbose
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe "on a Unix-like platform it" do
|
102
|
-
before :each do
|
103
|
-
with_verbose_disabled do
|
104
|
-
File::SEPARATOR = '/'
|
105
|
-
end
|
106
|
-
Puppet.features.stubs(:microsoft_windows?).returns(false)
|
107
|
-
Puppet.features.stubs(:posix?).returns(true)
|
108
|
-
end
|
109
|
-
|
90
|
+
describe "on a Unix-like platform it", :as_platform => :posix do
|
110
91
|
if array then
|
111
92
|
it_should_behave_like "all pathname parameters with arrays", false
|
112
93
|
end
|
@@ -134,15 +115,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
134
115
|
end
|
135
116
|
end
|
136
117
|
|
137
|
-
describe "on a Windows-like platform it" do
|
138
|
-
before :each do
|
139
|
-
with_verbose_disabled do
|
140
|
-
File::SEPARATOR = '\\'
|
141
|
-
end
|
142
|
-
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
143
|
-
Puppet.features.stubs(:posix?).returns(false)
|
144
|
-
end
|
145
|
-
|
118
|
+
describe "on a Windows-like platform it", :as_platform => :windows do
|
146
119
|
if array then
|
147
120
|
it_should_behave_like "all pathname parameters with arrays", true
|
148
121
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Contexts for stubbing platforms
|
2
|
+
# In a describe or context block, adding :as_platform => :windows or
|
3
|
+
# :as_platform => :posix will stub the relevant Puppet features, as well as
|
4
|
+
# the behavior of Ruby's filesystem methods by changing File::ALT_SEPARATOR.
|
5
|
+
|
6
|
+
shared_context "windows", :as_platform => :windows do
|
7
|
+
before :each do
|
8
|
+
Facter.stubs(:value).with(:operatingsystem).returns 'Windows'
|
9
|
+
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
10
|
+
Puppet.features.stubs(:posix?).returns(false)
|
11
|
+
end
|
12
|
+
|
13
|
+
around do |example|
|
14
|
+
file_alt_separator = File::ALT_SEPARATOR
|
15
|
+
# prevent Ruby from warning about changing a constant
|
16
|
+
with_verbose_disabled do
|
17
|
+
File::ALT_SEPARATOR = '\\'
|
18
|
+
end
|
19
|
+
example.run
|
20
|
+
with_verbose_disabled do
|
21
|
+
File::ALT_SEPARATOR = file_alt_separator
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
shared_context "posix", :as_platform => :posix do
|
27
|
+
before :each do
|
28
|
+
Puppet.features.stubs(:microsoft_windows?).returns(false)
|
29
|
+
Puppet.features.stubs(:posix?).returns(true)
|
30
|
+
end
|
31
|
+
|
32
|
+
around do |example|
|
33
|
+
file_alt_separator = File::ALT_SEPARATOR
|
34
|
+
# prevent Ruby from warning about changing a constant
|
35
|
+
with_verbose_disabled do
|
36
|
+
File::ALT_SEPARATOR = nil
|
37
|
+
end
|
38
|
+
example.run
|
39
|
+
with_verbose_disabled do
|
40
|
+
File::ALT_SEPARATOR = file_alt_separator
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# NOTE: a lot of the stuff in this file is duplicated in the "puppet_spec_helper" in the project
|
2
|
+
# puppetlabs_spec_helper. We should probably eat our own dog food and get rid of most of this from here,
|
3
|
+
# and have the puppet core itself use puppetlabs_spec_helper
|
4
|
+
|
1
5
|
dir = File.expand_path(File.dirname(__FILE__))
|
2
6
|
$LOAD_PATH.unshift File.join(dir, 'lib')
|
3
7
|
|
@@ -21,8 +25,14 @@ require 'puppet_spec/verbose'
|
|
21
25
|
require 'puppet_spec/files'
|
22
26
|
require 'puppet_spec/fixtures'
|
23
27
|
require 'puppet_spec/matchers'
|
28
|
+
require 'puppet_spec/database'
|
24
29
|
require 'monkey_patches/alias_should_to_must'
|
25
30
|
require 'monkey_patches/publicize_methods'
|
31
|
+
require 'puppet/test/test_helper'
|
32
|
+
|
33
|
+
Pathname.glob("#{dir}/shared_contexts/*.rb") do |file|
|
34
|
+
require file.relative_path_from(Pathname.new(dir))
|
35
|
+
end
|
26
36
|
|
27
37
|
Pathname.glob("#{dir}/shared_behaviours/**/*.rb") do |behaviour|
|
28
38
|
require behaviour.relative_path_from(Pathname.new(dir))
|
@@ -33,97 +43,58 @@ RSpec.configure do |config|
|
|
33
43
|
|
34
44
|
config.mock_with :mocha
|
35
45
|
|
46
|
+
config.before :all do
|
47
|
+
Puppet::Test::TestHelper.before_all_tests()
|
48
|
+
end
|
49
|
+
|
50
|
+
config.after :all do
|
51
|
+
Puppet::Test::TestHelper.after_all_tests()
|
52
|
+
end
|
53
|
+
|
36
54
|
config.before :each do
|
37
55
|
# Disabling garbage collection inside each test, and only running it at
|
38
56
|
# the end of each block, gives us an ~ 15 percent speedup, and more on
|
39
57
|
# some platforms *cough* windows *cough* that are a little slower.
|
40
58
|
GC.disable
|
41
59
|
|
42
|
-
# We need to preserve the current state of all our indirection cache and
|
43
|
-
# terminus classes. This is pretty important, because changes to these
|
44
|
-
# are global and lead to order dependencies in our testing.
|
45
|
-
#
|
46
|
-
# We go direct to the implementation because there is no safe, sane public
|
47
|
-
# API to manage restoration of these to their default values. This
|
48
|
-
# should, once the value is proved, be moved to a standard API on the
|
49
|
-
# indirector.
|
50
|
-
#
|
51
|
-
# To make things worse, a number of the tests stub parts of the
|
52
|
-
# indirector. These stubs have very specific expectations that what
|
53
|
-
# little of the public API we could use is, well, likely to explode
|
54
|
-
# randomly in some tests. So, direct access. --daniel 2011-08-30
|
55
|
-
$saved_indirection_state = {}
|
56
|
-
indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
|
57
|
-
indirections.each do |indirector|
|
58
|
-
$saved_indirection_state[indirector.name] = {
|
59
|
-
:@terminus_class => indirector.instance_variable_get(:@terminus_class),
|
60
|
-
:@cache_class => indirector.instance_variable_get(:@cache_class)
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
# these globals are set by Application
|
65
|
-
$puppet_application_mode = nil
|
66
|
-
$puppet_application_name = nil
|
67
|
-
|
68
60
|
# REVISIT: I think this conceals other bad tests, but I don't have time to
|
69
61
|
# fully diagnose those right now. When you read this, please come tell me
|
70
62
|
# I suck for letting this float. --daniel 2011-04-21
|
71
63
|
Signal.stubs(:trap)
|
72
64
|
|
73
|
-
# Longer keys are secure, but they sure make for some slow testing - both
|
74
|
-
# in terms of generating keys, and in terms of anything the next step down
|
75
|
-
# the line doing validation or whatever. Most tests don't care how long
|
76
|
-
# or secure it is, just that it exists, so these are better and faster
|
77
|
-
# defaults, in testing only.
|
78
|
-
#
|
79
|
-
# I would make these even shorter, but OpenSSL doesn't support anything
|
80
|
-
# below 512 bits. Sad, really, because a 0 bit key would be just fine.
|
81
|
-
Puppet[:req_bits] = 512
|
82
|
-
Puppet[:keylength] = 512
|
83
|
-
|
84
|
-
# Set the confdir and vardir to gibberish so that tests
|
85
|
-
# have to be correctly mocked.
|
86
|
-
Puppet[:confdir] = "/dev/null"
|
87
|
-
Puppet[:vardir] = "/dev/null"
|
88
|
-
|
89
|
-
# Avoid opening ports to the outside world
|
90
|
-
Puppet.settings[:bindaddress] = "127.0.0.1"
|
91
65
|
|
66
|
+
# TODO: in a more sane world, we'd move this logging redirection into our TestHelper class.
|
67
|
+
# Without doing so, external projects will all have to roll their own solution for
|
68
|
+
# redirecting logging, and for validating expected log messages. However, because the
|
69
|
+
# current implementation of this involves creating an instance variable "@logs" on
|
70
|
+
# EVERY SINGLE TEST CLASS, and because there are over 1300 tests that are written to expect
|
71
|
+
# this instance variable to be available--we can't easily solve this problem right now.
|
72
|
+
#
|
73
|
+
# redirecting logging away from console, because otherwise the test output will be
|
74
|
+
# obscured by all of the log output
|
92
75
|
@logs = []
|
93
76
|
Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
|
94
77
|
|
95
78
|
@log_level = Puppet::Util::Log.level
|
79
|
+
|
80
|
+
Puppet::Test::TestHelper.before_each_test()
|
81
|
+
|
96
82
|
end
|
97
83
|
|
98
84
|
config.after :each do
|
99
|
-
Puppet.
|
100
|
-
Puppet::Node::Environment.clear
|
101
|
-
Puppet::Util::Storage.clear
|
102
|
-
Puppet::Util::ExecutionStub.reset
|
85
|
+
Puppet::Test::TestHelper.after_each_test()
|
103
86
|
|
87
|
+
# TODO: would like to move this into puppetlabs_spec_helper, but there are namespace issues at the moment.
|
104
88
|
PuppetSpec::Files.cleanup
|
105
89
|
|
90
|
+
# TODO: this should be abstracted in the future--see comments above the '@logs' block in the
|
91
|
+
# "before" code above.
|
92
|
+
#
|
93
|
+
# clean up after the logging changes that we made before each test.
|
106
94
|
@logs.clear
|
107
95
|
Puppet::Util::Log.close_all
|
108
96
|
Puppet::Util::Log.level = @log_level
|
109
97
|
|
110
|
-
# Restore the indirector configuration. See before hook.
|
111
|
-
indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
|
112
|
-
indirections.each do |indirector|
|
113
|
-
$saved_indirection_state.fetch(indirector.name, {}).each do |variable, value|
|
114
|
-
indirector.instance_variable_set(variable, value)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
$saved_indirection_state = nil
|
118
|
-
|
119
|
-
# Some tests can cause us to connect, in which case the lingering
|
120
|
-
# connection is a resource that can cause unexpected failure in later
|
121
|
-
# tests, as well as sharing state accidentally.
|
122
|
-
# We're testing if ActiveRecord::Base is defined because some test cases
|
123
|
-
# may stub Puppet.features.rails? which is how we should normally
|
124
|
-
# introspect for this functionality.
|
125
|
-
ActiveRecord::Base.remove_connection if defined?(ActiveRecord::Base)
|
126
|
-
|
127
98
|
# This will perform a GC between tests, but only if actually required. We
|
128
99
|
# experimented with forcing a GC run, and that was less efficient than
|
129
100
|
# just letting it run all the time.
|