puppet 3.6.0.rc1-x86-mingw32 → 3.6.0-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.
- checksums.yaml +7 -0
- data/ext/debian/control +1 -1
- data/ext/debian/puppetmaster-passenger.postinst +82 -36
- data/ext/debian/puppetmaster-passenger.postrm +45 -17
- data/lib/puppet/forge.rb +2 -5
- data/lib/puppet/module_tool.rb +23 -0
- data/lib/puppet/module_tool/applications/application.rb +11 -10
- data/lib/puppet/module_tool/applications/builder.rb +5 -5
- data/lib/puppet/module_tool/dependency.rb +1 -0
- data/lib/puppet/module_tool/installed_modules.rb +5 -4
- data/lib/puppet/module_tool/local_tarball.rb +2 -3
- data/lib/puppet/module_tool/tar/gnu.rb +7 -16
- data/lib/puppet/util/execution.rb +4 -6
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/spec/unit/environments_spec.rb +2 -2
- data/spec/unit/module_tool/tar/gnu_spec.rb +5 -7
- data/spec/unit/module_tool_spec.rb +30 -0
- data/spec/unit/util/execution_spec.rb +4 -4
- metadata +12 -48
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c8d0252f2fe6af8436825bebf3af5d20610759b3
|
4
|
+
data.tar.gz: e4ca4cbcdbb34d85bf8c8abfaeef08aa2bd457b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6bdf28eacdcd159583c21ac56b0ad14ed44786f55ae76e639092f100fb9422a1e94f92cc7cd16de56b48b6aa052dfab5a44aca18983a93d3cad3b3dcf094eab
|
7
|
+
data.tar.gz: 5dd20f802f1dd51f5090775fec1987802bf6a47e30c930e0665b90e095161e6edeb872a97ca87337291b25bb5f19816a325e196f03f9eb08b99d486765c7e94c
|
data/ext/debian/control
CHANGED
@@ -99,7 +99,7 @@ Description: Centralized configuration management - master startup and compatibi
|
|
99
99
|
|
100
100
|
Package: puppetmaster-passenger
|
101
101
|
Architecture: all
|
102
|
-
Depends: ${misc:Depends}, ruby | ruby-interpreter, puppetmaster-common (= ${source:Version}), facter (>= 1.7.0), lsb-base, libapache2-mod-passenger
|
102
|
+
Depends: ${misc:Depends}, ruby | ruby-interpreter, puppetmaster-common (= ${source:Version}), facter (>= 1.7.0), lsb-base, apache2, libapache2-mod-passenger
|
103
103
|
Conflicts: puppetmaster (<< 2.6.1~rc2-1)
|
104
104
|
Replaces: puppetmaster (<< 2.6.1~rc2-1)
|
105
105
|
Description: Centralised configuration management - master setup to run under mod passenger
|
@@ -2,63 +2,109 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
+
sitename="puppetmaster"
|
6
|
+
|
7
|
+
# The debian provided a2* utils in Apache 2.4 uses "site name" as
|
8
|
+
# argument, while the version in Apache 2.2 uses "file name".
|
9
|
+
#
|
10
|
+
# For added fun, the Apache 2.4 version requires files to have a
|
11
|
+
# ".conf" suffix, but this must be stripped when using it as argument
|
12
|
+
# for the a2* utilities.
|
13
|
+
#
|
14
|
+
# This will end in tears…
|
15
|
+
# Can be removed when we only support apache >= 2.4
|
16
|
+
apache2_puppetmaster_sitename() {
|
17
|
+
apache2_version="$(dpkg-query --showformat='${Version}\n' --show apache2)"
|
18
|
+
if dpkg --compare-versions "$apache2_version" gt "2.4~"; then
|
19
|
+
echo "${sitename}.conf"
|
20
|
+
else
|
21
|
+
echo "${sitename}"
|
22
|
+
fi
|
23
|
+
}
|
24
|
+
|
25
|
+
# Can be removed when we only support apache >= 2.4
|
26
|
+
restart_apache2() {
|
27
|
+
if [ -x "/etc/init.d/apache2" ]; then
|
28
|
+
# Seems that a restart is needed. reload breaks ssl apparently.
|
29
|
+
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
|
30
|
+
invoke-rc.d apache2 restart || exit $?
|
31
|
+
else
|
32
|
+
/etc/init.d/apache2 restart || exit $?
|
33
|
+
fi
|
34
|
+
fi
|
35
|
+
}
|
36
|
+
|
37
|
+
# We may need to update the passenger directives in the apache vhost because
|
38
|
+
# RailsAutoDetect and RackAutoDetect were removed in passenger 4.0.0
|
39
|
+
# see http://www.modrails.com/documentation/Users%20guide%20Apache.html#_railsautodetect_rackautodetect_and_wsgiautodetect
|
40
|
+
update_vhost_for_passenger4() {
|
41
|
+
# Get passenger version from dpkg.
|
42
|
+
# This will end in tears…
|
43
|
+
passenger_version="$(dpkg-query --showformat='${Version}\n' --show libapache2-mod-passenger)"
|
44
|
+
if dpkg --compare-versions "$passenger_version" gt "4.0~"; then
|
45
|
+
sed -r -i \
|
46
|
+
-e "/RailsAutoDetect/d" \
|
47
|
+
-e "/RackAutoDetect/d" \
|
48
|
+
$tempfile
|
49
|
+
fi
|
50
|
+
}
|
51
|
+
|
5
52
|
if [ "$1" = "configure" ]; then
|
6
|
-
|
53
|
+
|
7
54
|
# Change the owner of the rack config.ru to be the puppet user
|
8
55
|
# because passenger will suid to that user, see #577366
|
9
56
|
if ! dpkg-statoverride --list /usr/share/puppet/rack/puppetmasterd/config.ru >/dev/null 2>&1
|
10
57
|
then
|
11
|
-
|
58
|
+
dpkg-statoverride --update --add puppet puppet 0644 /usr/share/puppet/rack/puppetmasterd/config.ru
|
12
59
|
fi
|
13
60
|
# Setup passenger configuration
|
14
61
|
if [ "$2" = "" ]; then
|
15
|
-
|
62
|
+
|
63
|
+
# Check that puppet master --configprint works properly
|
64
|
+
# If it doesn't the following steps to update the vhost will produce a very unhelpful and broken vhost
|
65
|
+
if [ $(puppet master --configprint all 2>&1 | grep "Could not parse" | wc -l) != "0" ]; then
|
66
|
+
echo "Puppet config print not working properly, exiting"
|
67
|
+
exit 1
|
68
|
+
fi
|
69
|
+
|
70
|
+
# Initialize puppetmaster CA and generate the master certificate
|
16
71
|
# only if the host doesn't already have any puppet ssl certificate.
|
17
72
|
# The ssl key and cert need to be available (eg generated) before
|
18
|
-
# apache2 is configured and started since apache2 ssl configuration
|
73
|
+
# apache2 is configured and started since apache2 ssl configuration
|
19
74
|
# uses the puppetmaster ssl files.
|
20
|
-
|
21
|
-
|
22
|
-
|
75
|
+
if [ ! -e "$(puppet master --configprint hostcert)" ]; then
|
76
|
+
puppet cert generate $(puppet master --configprint certname)
|
77
|
+
fi
|
78
|
+
|
23
79
|
# Setup apache2 configuration files
|
24
|
-
APACHE2_SITE_FILE="/etc/apache2/sites-available
|
80
|
+
APACHE2_SITE_FILE="/etc/apache2/sites-available/$(apache2_puppetmaster_sitename)"
|
25
81
|
if [ ! -e "${APACHE2_SITE_FILE}" ]; then
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
82
|
+
tempfile=$(mktemp)
|
83
|
+
sed -r \
|
84
|
+
-e "s|(SSLCertificateFile\s+).+$|\1$(puppet master --configprint hostcert)|" \
|
85
|
+
-e "s|(SSLCertificateKeyFile\s+).+$|\1$(puppet master --configprint hostprivkey)|" \
|
86
|
+
-e "s|(SSLCACertificateFile\s+).+$|\1$(puppet master --configprint localcacert)|" \
|
87
|
+
-e "s|(SSLCertificateChainFile\s+).+$|\1$(puppet master --configprint localcacert)|" \
|
88
|
+
-e "s|(SSLCARevocationFile\s+).+$|\1$(puppet master --configprint cacrl)|" \
|
89
|
+
-e "s|DocumentRoot /etc/puppet/rack/public|DocumentRoot /usr/share/puppet/rack/puppetmasterd/public|" \
|
90
|
+
-e "s|<Directory /etc/puppet/rack/>|<Directory /usr/share/puppet/rack/puppetmasterd/>|" \
|
91
|
+
/usr/share/puppetmaster-passenger/apache2.site.conf.tmpl > $tempfile
|
92
|
+
update_vhost_for_passenger4
|
93
|
+
mv $tempfile "${APACHE2_SITE_FILE}"
|
37
94
|
fi
|
95
|
+
|
96
|
+
# Enable needed modules
|
38
97
|
a2enmod ssl
|
39
98
|
a2enmod headers
|
40
|
-
a2ensite
|
41
|
-
|
42
|
-
# Seems that a restart is needed. reload breaks ssl apparently.
|
43
|
-
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
|
44
|
-
invoke-rc.d apache2 restart || exit $?
|
45
|
-
else
|
46
|
-
/etc/init.d/apache2 restart || exit $?
|
47
|
-
fi
|
48
|
-
fi
|
99
|
+
a2ensite ${sitename}
|
100
|
+
restart_apache2
|
49
101
|
fi
|
102
|
+
|
50
103
|
# Fix CRL file on upgrade to use the CA crl file instead of the host crl.
|
51
104
|
if dpkg --compare-versions "$2" lt-nl "2.6.1-1"; then
|
52
105
|
if [ -e /etc/apache2/sites-available/puppetmaster ]; then
|
53
106
|
sed -r -i 's|SSLCARevocationFile[[:space:]]+/var/lib/puppet/ssl/crl.pem$|SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem|' /etc/apache2/sites-available/puppetmaster
|
54
|
-
|
55
|
-
# Seems that a restart is needed. reload breaks ssl apparently.
|
56
|
-
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
|
57
|
-
invoke-rc.d apache2 restart || exit $?
|
58
|
-
else
|
59
|
-
/etc/init.d/apache2 restart || exit $?
|
60
|
-
fi
|
61
|
-
fi
|
107
|
+
restart_apache2
|
62
108
|
fi
|
63
109
|
fi
|
64
110
|
fi
|
@@ -1,25 +1,53 @@
|
|
1
|
-
#!/bin/sh
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
sitename="puppetmaster"
|
6
|
+
|
7
|
+
# The debian provided a2* utils in Apache 2.4 uses "site name" as
|
8
|
+
# argument, while the version in Apache 2.2 uses "file name".
|
9
|
+
#
|
10
|
+
# For added fun, the Apache 2.4 version requires files to have a
|
11
|
+
# ".conf" suffix, but this must be stripped when using it as argument
|
12
|
+
# for the a2* utilities.
|
13
|
+
#
|
14
|
+
# This will end in tears…
|
15
|
+
# Can be removed when we only support apache >= 2.4
|
16
|
+
apache2_puppetmaster_sitename() {
|
17
|
+
apache2_version="$(dpkg-query --showformat='${Version}\n' --show apache2)"
|
18
|
+
if dpkg --compare-versions "$apache2_version" gt "2.4~"; then
|
19
|
+
echo "${sitename}.conf"
|
20
|
+
else
|
21
|
+
echo "${sitename}"
|
22
|
+
fi
|
23
|
+
}
|
24
|
+
|
25
|
+
# Can be removed when we only support apache >= 2.4
|
26
|
+
restart_apache2() {
|
27
|
+
if [ -x "/etc/init.d/apache2" ]; then
|
28
|
+
# Seems that a restart is needed. reload breaks ssl apparently.
|
29
|
+
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
|
30
|
+
invoke-rc.d apache2 restart || exit $?
|
31
|
+
else
|
32
|
+
/etc/init.d/apache2 restart || exit $?
|
33
|
+
fi
|
34
|
+
fi
|
35
|
+
}
|
2
36
|
|
3
37
|
case "$1" in
|
4
38
|
purge)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
39
|
+
if dpkg-statoverride --list /usr/share/puppet/rack/puppetmasterd/config.ru >/dev/null 2>&1
|
40
|
+
then
|
41
|
+
dpkg-statoverride --remove /usr/share/puppet/rack/puppetmasterd/config.ru
|
42
|
+
fi
|
43
|
+
# Remove the puppetmaster site configuration on purge
|
44
|
+
rm -f /etc/apache2/sites-available/$(apache2_puppetmaster_sitename)
|
45
|
+
;;
|
12
46
|
remove)
|
13
47
|
# Disable the puppetmaster apache2 site configuration on package removal
|
14
|
-
a2dissite
|
15
|
-
|
16
|
-
|
17
|
-
invoke-rc.d apache2 force-reload || exit $?
|
18
|
-
else
|
19
|
-
/etc/init.d/apache2 force-reload || exit $?
|
20
|
-
fi
|
21
|
-
fi
|
22
|
-
;;
|
48
|
+
a2dissite ${sitename}
|
49
|
+
restart_apache2
|
50
|
+
;;
|
23
51
|
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
24
52
|
;;
|
25
53
|
*)
|
data/lib/puppet/forge.rb
CHANGED
@@ -117,14 +117,11 @@ class Puppet::Forge < Semantic::Dependency::Source
|
|
117
117
|
|
118
118
|
name = meta['name'].tr('/', '-')
|
119
119
|
version = Semantic::Version.parse(meta['version'])
|
120
|
+
release = "#{name}@#{version}"
|
120
121
|
|
121
122
|
dependencies = (meta['dependencies'] || [])
|
122
123
|
dependencies.map! do |dep|
|
123
|
-
|
124
|
-
[
|
125
|
-
dep['name'].tr('/', '-'),
|
126
|
-
(Semantic::VersionRange.parse(range) rescue Semantic::VersionRange::EMPTY_RANGE),
|
127
|
-
]
|
124
|
+
Puppet::ModuleTool.parse_module_dependency(release, dep)[0..1]
|
128
125
|
end
|
129
126
|
|
130
127
|
super(source, name, version, Hash[dependencies])
|
data/lib/puppet/module_tool.rb
CHANGED
@@ -154,6 +154,29 @@ module Puppet
|
|
154
154
|
Puppet.lookup(:current_environment)
|
155
155
|
end
|
156
156
|
end
|
157
|
+
|
158
|
+
# Handles parsing of module dependency expressions into proper
|
159
|
+
# {Semantic::VersionRange}s, including reasonable error handling.
|
160
|
+
#
|
161
|
+
# @param where [String] a description of the thing we're parsing the
|
162
|
+
# dependency expression for
|
163
|
+
# @param dep [Hash] the dependency description to parse
|
164
|
+
# @return [Array(String, Semantic::VersionRange, String)] an tuple of the
|
165
|
+
# dependent module's name, the version range dependency, and the
|
166
|
+
# unparsed range expression.
|
167
|
+
def self.parse_module_dependency(where, dep)
|
168
|
+
dep_name = dep['name'].tr('/', '-')
|
169
|
+
range = dep['version_requirement'] || dep['versionRequirement'] || '>= 0.0.0'
|
170
|
+
|
171
|
+
begin
|
172
|
+
parsed_range = Semantic::VersionRange.parse(range)
|
173
|
+
rescue ArgumentError => e
|
174
|
+
Puppet.debug "Error in #{where} parsing dependency #{dep_name} (#{e.message}); using empty range."
|
175
|
+
parsed_range = Semantic::VersionRange::EMPTY_RANGE
|
176
|
+
end
|
177
|
+
|
178
|
+
[ dep_name, parsed_range, range ]
|
179
|
+
end
|
157
180
|
end
|
158
181
|
end
|
159
182
|
|
@@ -43,14 +43,6 @@ module Puppet::ModuleTool
|
|
43
43
|
modulefile_path = File.join(@path, 'Modulefile')
|
44
44
|
metadata_path = File.join(@path, 'metadata.json')
|
45
45
|
|
46
|
-
if File.file?(modulefile_path)
|
47
|
-
if File.file?(metadata_path)
|
48
|
-
Puppet.warning "Modulefile is deprecated. Using metadata.json."
|
49
|
-
else
|
50
|
-
Puppet.warning "Modulefile is deprecated. Building metadata.json from Modulefile."
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
46
|
if File.file?(metadata_path)
|
55
47
|
File.open(metadata_path) do |f|
|
56
48
|
begin
|
@@ -59,11 +51,20 @@ module Puppet::ModuleTool
|
|
59
51
|
raise ArgumentError, "Could not parse JSON #{metadata_path}", ex.backtrace
|
60
52
|
end
|
61
53
|
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if File.file?(modulefile_path)
|
57
|
+
if File.file?(metadata_path)
|
58
|
+
Puppet.warning "Modulefile is deprecated. Merging your Modulefile and metadata.json."
|
59
|
+
else
|
60
|
+
Puppet.warning "Modulefile is deprecated. Building metadata.json from Modulefile."
|
61
|
+
end
|
62
62
|
|
63
|
-
elsif File.file?(modulefile_path)
|
64
63
|
Puppet::ModuleTool::ModulefileReader.evaluate(@metadata, modulefile_path)
|
64
|
+
end
|
65
65
|
|
66
|
-
|
66
|
+
has_metadata = File.file?(modulefile_path) || File.file?(metadata_path)
|
67
|
+
if !has_metadata && require_metadata
|
67
68
|
raise ArgumentError, "No metadata found for module #{@path}"
|
68
69
|
end
|
69
70
|
|
@@ -69,11 +69,11 @@ module Puppet::ModuleTool
|
|
69
69
|
def write_json
|
70
70
|
metadata_path = File.join(build_path, 'metadata.json')
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
# TODO: This may necessarily change the order in which the metadata.json
|
73
|
+
# file is packaged from what was written by the user. This is a
|
74
|
+
# regretable, but required for now.
|
75
|
+
File.open(metadata_path, 'w') do |f|
|
76
|
+
f.write(metadata.to_json)
|
77
77
|
end
|
78
78
|
|
79
79
|
File.open(File.join(build_path, 'checksums.json'), 'w') do |f|
|
@@ -59,17 +59,18 @@ module Puppet::ModuleTool
|
|
59
59
|
@metadata = mod.metadata
|
60
60
|
name = mod.forge_name.tr('/', '-')
|
61
61
|
version = Semantic::Version.parse(mod.version)
|
62
|
+
release = "#{name}@#{version}"
|
62
63
|
|
63
64
|
super(source, name, version, {})
|
64
65
|
|
65
66
|
if mod.dependencies
|
66
67
|
mod.dependencies.each do |dep|
|
67
|
-
|
68
|
-
|
68
|
+
results = Puppet::ModuleTool.parse_module_dependency(release, dep)
|
69
|
+
dep_name, parsed_range, range = results
|
69
70
|
|
70
71
|
dep.tap do |dep|
|
71
|
-
add_constraint('initialize',
|
72
|
-
|
72
|
+
add_constraint('initialize', dep_name, range.to_s) do |node|
|
73
|
+
parsed_range === node.version
|
73
74
|
end
|
74
75
|
end
|
75
76
|
end
|
@@ -48,12 +48,11 @@ module Puppet::ModuleTool
|
|
48
48
|
@metadata = mod.metadata
|
49
49
|
name = mod.forge_name.tr('/', '-')
|
50
50
|
version = Semantic::Version.parse(mod.version)
|
51
|
+
release = "#{name}@#{version}"
|
51
52
|
|
52
53
|
if mod.dependencies
|
53
54
|
dependencies = mod.dependencies.map do |dep|
|
54
|
-
|
55
|
-
range = Semantic::VersionRange.parse(range) rescue Semantic::VersionRange::EMPTY_RANGE
|
56
|
-
[ dep['name'].tr('/', '-'), range ]
|
55
|
+
Puppet::ModuleTool.parse_module_dependency(release, dep)[0..1]
|
57
56
|
end
|
58
57
|
dependencies = Hash[dependencies]
|
59
58
|
end
|
@@ -1,28 +1,19 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
1
3
|
class Puppet::ModuleTool::Tar::Gnu
|
2
4
|
def unpack(sourcefile, destdir, owner)
|
3
5
|
sourcefile = File.expand_path(sourcefile)
|
4
6
|
destdir = File.expand_path(destdir)
|
5
7
|
|
6
8
|
Dir.chdir(destdir) do
|
7
|
-
|
8
|
-
Puppet::Util::Execution.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Puppet::Util::Execution.execute(['find', destdir] + %w[-type d -exec chmod 755 {} +])
|
13
|
-
Puppet::Util::Execution.execute(['find', destdir] + %w[-type f -exec chmod a-wst {} +])
|
14
|
-
Puppet::Util::Execution.execute(['chown', '-R', owner, destdir])
|
9
|
+
Puppet::Util::Execution.execute("gzip -dc #{Shellwords.shellescape(sourcefile)} | tar xof -")
|
10
|
+
Puppet::Util::Execution.execute("find . -type d -exec chmod 755 {} +")
|
11
|
+
Puppet::Util::Execution.execute("find . -type f -exec chmod a-wst {} +")
|
12
|
+
Puppet::Util::Execution.execute("chown -R #{owner} .")
|
15
13
|
end
|
16
14
|
end
|
17
15
|
|
18
16
|
def pack(sourcedir, destfile)
|
19
|
-
|
20
|
-
Puppet::Util::Execution.execpipe(['gzip', '-c'], true, 'w+') do |pipe|
|
21
|
-
pipe.write(tarball)
|
22
|
-
pipe.close_write
|
23
|
-
File.open(destfile, 'w+') do |file|
|
24
|
-
file.write(pipe.read)
|
25
|
-
end
|
26
|
-
end
|
17
|
+
Puppet::Util::Execution.execute("tar cf - #{sourcedir} | gzip -c > #{File.basename(destfile)}")
|
27
18
|
end
|
28
19
|
end
|
@@ -33,9 +33,8 @@ module Puppet::Util::Execution
|
|
33
33
|
# which is treated as a set of command arguments to pass through.
|
34
34
|
#
|
35
35
|
# In either case, the command is passed directly to the shell, STDOUT and
|
36
|
-
# STDERR are connected together, and STDOUT
|
37
|
-
#
|
38
|
-
# not been opened in read or write mode respectively will block indefinitely.)
|
36
|
+
# STDERR are connected together, and STDOUT will be streamed to the yielded
|
37
|
+
# pipe.
|
39
38
|
#
|
40
39
|
# @param command [String, Array<String>] the command to execute as one string,
|
41
40
|
# or as parts in an array. The parts of the array are joined with one
|
@@ -43,7 +42,6 @@ module Puppet::Util::Execution
|
|
43
42
|
# string to execute.
|
44
43
|
# @param failonfail [Boolean] (true) if the execution should fail with
|
45
44
|
# Exception on failure or not.
|
46
|
-
# @param mode [String] ('r') the mode to open the pipe with
|
47
45
|
# @yield [pipe] to a block executing a subprocess
|
48
46
|
# @yieldparam pipe [IO] the opened pipe
|
49
47
|
# @yieldreturn [String] the output to return
|
@@ -54,7 +52,7 @@ module Puppet::Util::Execution
|
|
54
52
|
#
|
55
53
|
# @see Kernel#open for `mode` values
|
56
54
|
# @api public
|
57
|
-
def self.execpipe(command, failonfail = true
|
55
|
+
def self.execpipe(command, failonfail = true)
|
58
56
|
# Paste together an array with spaces. We used to paste directly
|
59
57
|
# together, no spaces, which made for odd invocations; the user had to
|
60
58
|
# include whitespace between arguments.
|
@@ -76,7 +74,7 @@ module Puppet::Util::Execution
|
|
76
74
|
# a predictable output
|
77
75
|
english_env = ENV.to_hash.merge( {'LANG' => 'C', 'LC_ALL' => 'C'} )
|
78
76
|
output = Puppet::Util.withenv(english_env) do
|
79
|
-
open("| #{command_str} 2>&1"
|
77
|
+
open("| #{command_str} 2>&1") do |pipe|
|
80
78
|
yield pipe
|
81
79
|
end
|
82
80
|
end
|
@@ -14,7 +14,7 @@ module Semantic
|
|
14
14
|
def create_release(name, version, dependencies = {})
|
15
15
|
version = Version.parse(version) if version.is_a? String
|
16
16
|
dependencies = dependencies.inject({}) do |hash, (key, value)|
|
17
|
-
hash[key] = VersionRange.parse(value || '>= 0')
|
17
|
+
hash[key] = VersionRange.parse(value || '>= 0.0.0')
|
18
18
|
hash[key] ||= VersionRange::EMPTY_RANGE
|
19
19
|
hash
|
20
20
|
end
|
data/lib/puppet/version.rb
CHANGED
@@ -198,7 +198,7 @@ config_version=/some/script
|
|
198
198
|
with_config_version(File.expand_path('/some/script'))
|
199
199
|
end
|
200
200
|
|
201
|
-
expect(@logs.map(&:to_s).join).to match(/Invalid.*at
|
201
|
+
expect(@logs.map(&:to_s).join).to match(/Invalid.*at.*\/env1.*may not have sections.*ignored: 'foo'/)
|
202
202
|
end
|
203
203
|
|
204
204
|
it "logs a warning, but processes the main settings if there are any extraneous settings" do
|
@@ -214,7 +214,7 @@ config_version=/some/script
|
|
214
214
|
with_config_version(File.expand_path('/some/script'))
|
215
215
|
end
|
216
216
|
|
217
|
-
expect(@logs.map(&:to_s).join).to match(/Invalid.*at
|
217
|
+
expect(@logs.map(&:to_s).join).to match(/Invalid.*at.*\/env1.*unknown setting.*dog, cat/)
|
218
218
|
end
|
219
219
|
|
220
220
|
it "interpretes relative paths from the environment's directory" do
|
@@ -9,17 +9,15 @@ describe Puppet::ModuleTool::Tar::Gnu do
|
|
9
9
|
|
10
10
|
it "unpacks a tar file" do
|
11
11
|
Dir.expects(:chdir).with(File.expand_path(destdir)).yields(mock)
|
12
|
-
Puppet::Util::Execution.expects(:execute).with(
|
13
|
-
Puppet::Util::Execution.expects(:
|
14
|
-
Puppet::Util::Execution.expects(:execute).with(
|
15
|
-
Puppet::Util::Execution.expects(:execute).with(
|
16
|
-
Puppet::Util::Execution.expects(:execute).with(["chown", "-R", "<owner:group>", File.expand_path(destdir)])
|
12
|
+
Puppet::Util::Execution.expects(:execute).with("gzip -dc #{Shellwords.shellescape(File.expand_path(sourcefile))} | tar xof -")
|
13
|
+
Puppet::Util::Execution.expects(:execute).with("find . -type d -exec chmod 755 {} +")
|
14
|
+
Puppet::Util::Execution.expects(:execute).with("find . -type f -exec chmod a-wst {} +")
|
15
|
+
Puppet::Util::Execution.expects(:execute).with("chown -R <owner:group> .")
|
17
16
|
subject.unpack(sourcefile, destdir, '<owner:group>')
|
18
17
|
end
|
19
18
|
|
20
19
|
it "packs a tar file" do
|
21
|
-
Puppet::Util::Execution.expects(:execute).with(
|
22
|
-
Puppet::Util::Execution.expects(:execpipe).with(["gzip", "-c"], true, 'w+')
|
20
|
+
Puppet::Util::Execution.expects(:execute).with("tar cf - #{sourcedir} | gzip -c > #{File.basename(destfile)}")
|
23
21
|
subject.pack(sourcedir, destfile)
|
24
22
|
end
|
25
23
|
end
|
@@ -297,4 +297,34 @@ TREE
|
|
297
297
|
end
|
298
298
|
end
|
299
299
|
end
|
300
|
+
|
301
|
+
describe '.parse_module_dependency' do
|
302
|
+
it 'parses a dependency without a version range expression' do
|
303
|
+
name, range, expr = subject.parse_module_dependency('source', 'name' => 'foo-bar')
|
304
|
+
expect(name).to eql('foo-bar')
|
305
|
+
expect(range).to eql(Semantic::VersionRange.parse('>= 0.0.0'))
|
306
|
+
expect(expr).to eql('>= 0.0.0')
|
307
|
+
end
|
308
|
+
|
309
|
+
it 'parses a dependency with a version range expression' do
|
310
|
+
name, range, expr = subject.parse_module_dependency('source', 'name' => 'foo-bar', 'version_requirement' => '1.2.x')
|
311
|
+
expect(name).to eql('foo-bar')
|
312
|
+
expect(range).to eql(Semantic::VersionRange.parse('1.2.x'))
|
313
|
+
expect(expr).to eql('1.2.x')
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'parses a dependency with a version range expression in the (deprecated) versionRange key' do
|
317
|
+
name, range, expr = subject.parse_module_dependency('source', 'name' => 'foo-bar', 'versionRequirement' => '1.2.x')
|
318
|
+
expect(name).to eql('foo-bar')
|
319
|
+
expect(range).to eql(Semantic::VersionRange.parse('1.2.x'))
|
320
|
+
expect(expr).to eql('1.2.x')
|
321
|
+
end
|
322
|
+
|
323
|
+
it 'does not raise an error on invalid version range expressions' do
|
324
|
+
name, range, expr = subject.parse_module_dependency('source', 'name' => 'foo-bar', 'version_requirement' => 'nope')
|
325
|
+
expect(name).to eql('foo-bar')
|
326
|
+
expect(range).to eql(Semantic::VersionRange::EMPTY_RANGE)
|
327
|
+
expect(expr).to eql('nope')
|
328
|
+
end
|
329
|
+
end
|
300
330
|
end
|
@@ -596,27 +596,27 @@ describe Puppet::Util::Execution do
|
|
596
596
|
|
597
597
|
describe "#execpipe" do
|
598
598
|
it "should execute a string as a string" do
|
599
|
-
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1'
|
599
|
+
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1').returns('hello')
|
600
600
|
$CHILD_STATUS.expects(:==).with(0).returns(true)
|
601
601
|
Puppet::Util::Execution.execpipe('echo hello').should == 'hello'
|
602
602
|
end
|
603
603
|
|
604
604
|
it "should print meaningful debug message for string argument" do
|
605
605
|
Puppet::Util::Execution.expects(:debug).with("Executing 'echo hello'")
|
606
|
-
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1'
|
606
|
+
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1').returns('hello')
|
607
607
|
$CHILD_STATUS.expects(:==).with(0).returns(true)
|
608
608
|
Puppet::Util::Execution.execpipe('echo hello')
|
609
609
|
end
|
610
610
|
|
611
611
|
it "should print meaningful debug message for array argument" do
|
612
612
|
Puppet::Util::Execution.expects(:debug).with("Executing 'echo hello'")
|
613
|
-
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1'
|
613
|
+
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1').returns('hello')
|
614
614
|
$CHILD_STATUS.expects(:==).with(0).returns(true)
|
615
615
|
Puppet::Util::Execution.execpipe(['echo','hello'])
|
616
616
|
end
|
617
617
|
|
618
618
|
it "should execute an array by pasting together with spaces" do
|
619
|
-
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1'
|
619
|
+
Puppet::Util::Execution.expects(:open).with('| echo hello 2>&1').returns('hello')
|
620
620
|
$CHILD_STATUS.expects(:==).with(0).returns(true)
|
621
621
|
Puppet::Util::Execution.execpipe(['echo', 'hello']).should == 'hello'
|
622
622
|
end
|
metadata
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.0
|
5
|
-
prerelease: 6
|
4
|
+
version: 3.6.0
|
6
5
|
platform: x86-mingw32
|
7
6
|
authors:
|
8
7
|
- Puppet Labs
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: facter
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>'
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.6'
|
22
20
|
- - <
|
@@ -25,9 +23,8 @@ dependencies:
|
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - '>'
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '1.6'
|
33
30
|
- - <
|
@@ -36,7 +33,6 @@ dependencies:
|
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: hiera
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
37
|
- - ~>
|
42
38
|
- !ruby/object:Gem::Version
|
@@ -44,7 +40,6 @@ dependencies:
|
|
44
40
|
type: :runtime
|
45
41
|
prerelease: false
|
46
42
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
43
|
requirements:
|
49
44
|
- - ~>
|
50
45
|
- !ruby/object:Gem::Version
|
@@ -52,7 +47,6 @@ dependencies:
|
|
52
47
|
- !ruby/object:Gem::Dependency
|
53
48
|
name: rgen
|
54
49
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
50
|
requirements:
|
57
51
|
- - ~>
|
58
52
|
- !ruby/object:Gem::Version
|
@@ -60,7 +54,6 @@ dependencies:
|
|
60
54
|
type: :runtime
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
57
|
requirements:
|
65
58
|
- - ~>
|
66
59
|
- !ruby/object:Gem::Version
|
@@ -68,23 +61,20 @@ dependencies:
|
|
68
61
|
- !ruby/object:Gem::Dependency
|
69
62
|
name: json_pure
|
70
63
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
64
|
requirements:
|
73
|
-
- -
|
65
|
+
- - '>='
|
74
66
|
- !ruby/object:Gem::Version
|
75
67
|
version: '0'
|
76
68
|
type: :runtime
|
77
69
|
prerelease: false
|
78
70
|
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
71
|
requirements:
|
81
|
-
- -
|
72
|
+
- - '>='
|
82
73
|
- !ruby/object:Gem::Version
|
83
74
|
version: '0'
|
84
75
|
- !ruby/object:Gem::Dependency
|
85
76
|
name: ffi
|
86
77
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
78
|
requirements:
|
89
79
|
- - '='
|
90
80
|
- !ruby/object:Gem::Version
|
@@ -92,7 +82,6 @@ dependencies:
|
|
92
82
|
type: :runtime
|
93
83
|
prerelease: false
|
94
84
|
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
85
|
requirements:
|
97
86
|
- - '='
|
98
87
|
- !ruby/object:Gem::Version
|
@@ -100,7 +89,6 @@ dependencies:
|
|
100
89
|
- !ruby/object:Gem::Dependency
|
101
90
|
name: sys-admin
|
102
91
|
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
92
|
requirements:
|
105
93
|
- - '='
|
106
94
|
- !ruby/object:Gem::Version
|
@@ -108,7 +96,6 @@ dependencies:
|
|
108
96
|
type: :runtime
|
109
97
|
prerelease: false
|
110
98
|
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
99
|
requirements:
|
113
100
|
- - '='
|
114
101
|
- !ruby/object:Gem::Version
|
@@ -116,7 +103,6 @@ dependencies:
|
|
116
103
|
- !ruby/object:Gem::Dependency
|
117
104
|
name: win32-api
|
118
105
|
requirement: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
106
|
requirements:
|
121
107
|
- - '='
|
122
108
|
- !ruby/object:Gem::Version
|
@@ -124,7 +110,6 @@ dependencies:
|
|
124
110
|
type: :runtime
|
125
111
|
prerelease: false
|
126
112
|
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
113
|
requirements:
|
129
114
|
- - '='
|
130
115
|
- !ruby/object:Gem::Version
|
@@ -132,7 +117,6 @@ dependencies:
|
|
132
117
|
- !ruby/object:Gem::Dependency
|
133
118
|
name: win32-dir
|
134
119
|
requirement: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
120
|
requirements:
|
137
121
|
- - ~>
|
138
122
|
- !ruby/object:Gem::Version
|
@@ -140,7 +124,6 @@ dependencies:
|
|
140
124
|
type: :runtime
|
141
125
|
prerelease: false
|
142
126
|
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
127
|
requirements:
|
145
128
|
- - ~>
|
146
129
|
- !ruby/object:Gem::Version
|
@@ -148,7 +131,6 @@ dependencies:
|
|
148
131
|
- !ruby/object:Gem::Dependency
|
149
132
|
name: win32-eventlog
|
150
133
|
requirement: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
134
|
requirements:
|
153
135
|
- - ~>
|
154
136
|
- !ruby/object:Gem::Version
|
@@ -156,7 +138,6 @@ dependencies:
|
|
156
138
|
type: :runtime
|
157
139
|
prerelease: false
|
158
140
|
version_requirements: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
141
|
requirements:
|
161
142
|
- - ~>
|
162
143
|
- !ruby/object:Gem::Version
|
@@ -164,7 +145,6 @@ dependencies:
|
|
164
145
|
- !ruby/object:Gem::Dependency
|
165
146
|
name: win32-process
|
166
147
|
requirement: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
148
|
requirements:
|
169
149
|
- - ~>
|
170
150
|
- !ruby/object:Gem::Version
|
@@ -172,7 +152,6 @@ dependencies:
|
|
172
152
|
type: :runtime
|
173
153
|
prerelease: false
|
174
154
|
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
none: false
|
176
155
|
requirements:
|
177
156
|
- - ~>
|
178
157
|
- !ruby/object:Gem::Version
|
@@ -180,7 +159,6 @@ dependencies:
|
|
180
159
|
- !ruby/object:Gem::Dependency
|
181
160
|
name: win32-security
|
182
161
|
requirement: !ruby/object:Gem::Requirement
|
183
|
-
none: false
|
184
162
|
requirements:
|
185
163
|
- - ~>
|
186
164
|
- !ruby/object:Gem::Version
|
@@ -188,7 +166,6 @@ dependencies:
|
|
188
166
|
type: :runtime
|
189
167
|
prerelease: false
|
190
168
|
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
169
|
requirements:
|
193
170
|
- - ~>
|
194
171
|
- !ruby/object:Gem::Version
|
@@ -196,7 +173,6 @@ dependencies:
|
|
196
173
|
- !ruby/object:Gem::Dependency
|
197
174
|
name: win32-service
|
198
175
|
requirement: !ruby/object:Gem::Requirement
|
199
|
-
none: false
|
200
176
|
requirements:
|
201
177
|
- - '='
|
202
178
|
- !ruby/object:Gem::Version
|
@@ -204,7 +180,6 @@ dependencies:
|
|
204
180
|
type: :runtime
|
205
181
|
prerelease: false
|
206
182
|
version_requirements: !ruby/object:Gem::Requirement
|
207
|
-
none: false
|
208
183
|
requirements:
|
209
184
|
- - '='
|
210
185
|
- !ruby/object:Gem::Version
|
@@ -212,7 +187,6 @@ dependencies:
|
|
212
187
|
- !ruby/object:Gem::Dependency
|
213
188
|
name: win32-taskscheduler
|
214
189
|
requirement: !ruby/object:Gem::Requirement
|
215
|
-
none: false
|
216
190
|
requirements:
|
217
191
|
- - ~>
|
218
192
|
- !ruby/object:Gem::Version
|
@@ -220,7 +194,6 @@ dependencies:
|
|
220
194
|
type: :runtime
|
221
195
|
prerelease: false
|
222
196
|
version_requirements: !ruby/object:Gem::Requirement
|
223
|
-
none: false
|
224
197
|
requirements:
|
225
198
|
- - ~>
|
226
199
|
- !ruby/object:Gem::Version
|
@@ -228,7 +201,6 @@ dependencies:
|
|
228
201
|
- !ruby/object:Gem::Dependency
|
229
202
|
name: win32console
|
230
203
|
requirement: !ruby/object:Gem::Requirement
|
231
|
-
none: false
|
232
204
|
requirements:
|
233
205
|
- - '='
|
234
206
|
- !ruby/object:Gem::Version
|
@@ -236,7 +208,6 @@ dependencies:
|
|
236
208
|
type: :runtime
|
237
209
|
prerelease: false
|
238
210
|
version_requirements: !ruby/object:Gem::Requirement
|
239
|
-
none: false
|
240
211
|
requirements:
|
241
212
|
- - '='
|
242
213
|
- !ruby/object:Gem::Version
|
@@ -244,7 +215,6 @@ dependencies:
|
|
244
215
|
- !ruby/object:Gem::Dependency
|
245
216
|
name: windows-api
|
246
217
|
requirement: !ruby/object:Gem::Requirement
|
247
|
-
none: false
|
248
218
|
requirements:
|
249
219
|
- - ~>
|
250
220
|
- !ruby/object:Gem::Version
|
@@ -252,7 +222,6 @@ dependencies:
|
|
252
222
|
type: :runtime
|
253
223
|
prerelease: false
|
254
224
|
version_requirements: !ruby/object:Gem::Requirement
|
255
|
-
none: false
|
256
225
|
requirements:
|
257
226
|
- - ~>
|
258
227
|
- !ruby/object:Gem::Version
|
@@ -260,7 +229,6 @@ dependencies:
|
|
260
229
|
- !ruby/object:Gem::Dependency
|
261
230
|
name: windows-pr
|
262
231
|
requirement: !ruby/object:Gem::Requirement
|
263
|
-
none: false
|
264
232
|
requirements:
|
265
233
|
- - ~>
|
266
234
|
- !ruby/object:Gem::Version
|
@@ -268,7 +236,6 @@ dependencies:
|
|
268
236
|
type: :runtime
|
269
237
|
prerelease: false
|
270
238
|
version_requirements: !ruby/object:Gem::Requirement
|
271
|
-
none: false
|
272
239
|
requirements:
|
273
240
|
- - ~>
|
274
241
|
- !ruby/object:Gem::Version
|
@@ -276,7 +243,6 @@ dependencies:
|
|
276
243
|
- !ruby/object:Gem::Dependency
|
277
244
|
name: minitar
|
278
245
|
requirement: !ruby/object:Gem::Requirement
|
279
|
-
none: false
|
280
246
|
requirements:
|
281
247
|
- - ~>
|
282
248
|
- !ruby/object:Gem::Version
|
@@ -284,7 +250,6 @@ dependencies:
|
|
284
250
|
type: :runtime
|
285
251
|
prerelease: false
|
286
252
|
version_requirements: !ruby/object:Gem::Requirement
|
287
|
-
none: false
|
288
253
|
requirements:
|
289
254
|
- - ~>
|
290
255
|
- !ruby/object:Gem::Version
|
@@ -2564,6 +2529,7 @@ files:
|
|
2564
2529
|
- spec/watchr.rb
|
2565
2530
|
homepage: https://github.com/puppetlabs/puppet
|
2566
2531
|
licenses: []
|
2532
|
+
metadata: {}
|
2567
2533
|
post_install_message:
|
2568
2534
|
rdoc_options:
|
2569
2535
|
- --title
|
@@ -2574,22 +2540,20 @@ rdoc_options:
|
|
2574
2540
|
require_paths:
|
2575
2541
|
- lib
|
2576
2542
|
required_ruby_version: !ruby/object:Gem::Requirement
|
2577
|
-
none: false
|
2578
2543
|
requirements:
|
2579
|
-
- -
|
2544
|
+
- - '>='
|
2580
2545
|
- !ruby/object:Gem::Version
|
2581
2546
|
version: '0'
|
2582
2547
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2583
|
-
none: false
|
2584
2548
|
requirements:
|
2585
|
-
- -
|
2549
|
+
- - '>='
|
2586
2550
|
- !ruby/object:Gem::Version
|
2587
|
-
version:
|
2551
|
+
version: '0'
|
2588
2552
|
requirements: []
|
2589
2553
|
rubyforge_project: puppet
|
2590
|
-
rubygems_version:
|
2554
|
+
rubygems_version: 2.0.3
|
2591
2555
|
signing_key:
|
2592
|
-
specification_version:
|
2556
|
+
specification_version: 4
|
2593
2557
|
summary: Puppet, an automated configuration management tool
|
2594
2558
|
test_files:
|
2595
2559
|
- spec/fixtures/faulty_face/puppet/face/syntax.rb
|