puppet 2.7.18 → 2.7.19
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 +82 -0
- data/CONTRIBUTING.md +114 -171
- data/README.md +8 -0
- data/README_DEVELOPER.md +38 -3
- data/Rakefile +19 -3
- data/conf/osx/createpackage.sh +3 -1
- data/conf/redhat/logrotate +1 -1
- data/conf/redhat/puppet.spec +35 -8
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +2 -0
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/configurer.rb +2 -3
- data/lib/puppet/defaults.rb +6 -5
- data/lib/puppet/face/module/install.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/indirector/file_content.rb +2 -2
- data/lib/puppet/indirector/file_metadata.rb +2 -2
- data/lib/puppet/indirector/indirection.rb +3 -4
- data/lib/puppet/indirector/rest.rb +12 -6
- data/lib/puppet/interface/action_manager.rb +1 -2
- data/lib/puppet/module_tool/applications/unpacker.rb +22 -3
- data/lib/puppet/network/handler/fileserver.rb +2 -2
- data/lib/puppet/parser/ast/resource.rb +9 -2
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -1
- data/lib/puppet/parser/functions/md5.rb +2 -2
- data/lib/puppet/parser/functions/sha1.rb +2 -2
- data/lib/puppet/parser/functions/template.rb +0 -2
- data/lib/puppet/parser/type_loader.rb +1 -2
- data/lib/puppet/provider/augeas/augeas.rb +19 -1
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/package/msi.rb +97 -51
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -0
- data/lib/puppet/provider/service/gentoo.rb +0 -2
- data/lib/puppet/provider/service/openrc.rb +69 -0
- data/lib/puppet/provider/service/windows.rb +6 -4
- data/lib/puppet/provider/user/aix.rb +8 -4
- data/lib/puppet/provider/user/useradd.rb +6 -0
- data/lib/puppet/rails/benchmark.rb +2 -2
- data/lib/puppet/reports/store.rb +9 -9
- data/lib/puppet/resource/catalog.rb +2 -1
- data/lib/puppet/resource/type_collection.rb +2 -1
- data/lib/puppet/ssl/base.rb +1 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +1 -0
- data/lib/puppet/test/test_helper.rb +2 -1
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/scheduled_task.rb +8 -10
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/util.rb +63 -25
- data/lib/puppet/util/autoload.rb +6 -4
- data/lib/puppet/util/checksums.rb +3 -8
- data/lib/puppet/util/diff.rb +2 -1
- data/lib/puppet/util/filetype.rb +1 -3
- data/lib/puppet/util/run_mode.rb +2 -1
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/file.rb +27 -0
- data/lib/puppet/util/windows/user.rb +1 -2
- data/man/man8/puppet-agent.8 +4 -0
- data/man/man8/puppet-master.8 +4 -0
- data/man/man8/puppetmasterd.8 +4 -0
- data/spec/fixtures/unit/provider/augeas/augeas/augeas/lenses/test.aug +13 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/fstab +10 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/hosts +6 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/test +3 -0
- data/spec/fixtures/unit/provider/augeas/augeas/test.aug +13 -0
- data/spec/fixtures/unit/provider/service/openrc/rcservice_list +8 -0
- data/spec/fixtures/unit/provider/service/openrc/rcstatus +43 -0
- data/spec/integration/defaults_spec.rb +3 -3
- data/spec/integration/network/server/mongrel_spec.rb +8 -6
- data/spec/integration/parser/parser_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +49 -12
- data/spec/lib/puppet_spec/database.rb +5 -3
- data/spec/lib/puppet_spec/files.rb +2 -1
- data/spec/monkey_patches/alias_should_to_must.rb +15 -2
- data/spec/shared_behaviours/file_serving_model.rb +9 -6
- data/spec/shared_behaviours/path_parameters.rb +5 -5
- data/spec/shared_behaviours/things_that_declare_options.rb +5 -5
- data/spec/unit/application/facts_spec.rb +1 -1
- data/spec/unit/application_spec.rb +10 -8
- data/spec/unit/configurer_spec.rb +11 -2
- data/spec/unit/face/ca_spec.rb +15 -15
- data/spec/unit/face/help_spec.rb +5 -5
- data/spec/unit/face/module/install_spec.rb +13 -2
- data/spec/unit/face/node_spec.rb +7 -6
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -1
- data/spec/unit/indirector/envelope_spec.rb +0 -13
- data/spec/unit/indirector/facts/inventory_service_spec.rb +1 -1
- data/spec/unit/indirector/queue_spec.rb +3 -3
- data/spec/unit/indirector/rest_spec.rb +31 -20
- data/spec/unit/indirector_spec.rb +5 -5
- data/spec/unit/interface/action_builder_spec.rb +3 -2
- data/spec/unit/interface/action_manager_spec.rb +1 -1
- data/spec/unit/interface/action_spec.rb +4 -3
- data/spec/unit/interface/face_collection_spec.rb +1 -1
- data/spec/unit/interface/option_spec.rb +13 -9
- data/spec/unit/interface_spec.rb +5 -5
- data/spec/unit/module_tool/applications/unpacker_spec.rb +61 -0
- data/spec/unit/network/handler/fileserver_spec.rb +3 -3
- data/spec/unit/other/transbucket_spec.rb +6 -9
- data/spec/unit/parser/ast/resource_spec.rb +27 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +12 -12
- data/spec/unit/parser/lexer_spec.rb +5 -5
- data/spec/unit/provider/augeas/augeas_spec.rb +78 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +6 -6
- data/spec/unit/provider/package/freebsd_spec.rb +2 -2
- data/spec/unit/provider/package/msi_spec.rb +181 -114
- data/spec/unit/provider/package/openbsd_spec.rb +1 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +3 -3
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1 -1
- data/spec/unit/provider/service/openrc_spec.rb +209 -0
- data/spec/unit/provider/service/windows_spec.rb +57 -59
- data/spec/unit/provider/user/useradd_spec.rb +7 -0
- data/spec/unit/reports/store_spec.rb +13 -13
- data/spec/unit/resource/catalog_spec.rb +29 -24
- data/spec/unit/resource_spec.rb +13 -13
- data/spec/unit/simple_graph_spec.rb +12 -12
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +3 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +11 -10
- data/spec/unit/transaction_spec.rb +3 -3
- data/spec/unit/type/cron_spec.rb +171 -171
- data/spec/unit/type/exec_spec.rb +29 -27
- data/spec/unit/type/file_spec.rb +22 -13
- data/spec/unit/type/interface_spec.rb +1 -1
- data/spec/unit/type/scheduled_task_spec.rb +15 -14
- data/spec/unit/type/tidy_spec.rb +2 -2
- data/spec/unit/type/user_spec.rb +15 -15
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +22 -25
- data/spec/unit/util/autoload_spec.rb +13 -7
- data/spec/unit/util/backups_spec.rb +36 -67
- data/spec/unit/util/storage_spec.rb +2 -9
- data/spec/unit/util/suidmanager_spec.rb +1 -1
- data/spec/unit/util_spec.rb +20 -28
- data/test/ral/manager/attributes.rb +1 -1
- metadata +1553 -1542
data/Rakefile
CHANGED
@@ -2,14 +2,30 @@
|
|
2
2
|
|
3
3
|
$LOAD_PATH << File.join(File.dirname(__FILE__), 'tasks')
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'rubygems'
|
7
|
+
require 'rubygems/package_task'
|
8
|
+
rescue LoadError
|
9
|
+
# Users of older versions of Rake (0.8.7 for example) will not necessarily
|
10
|
+
# have rubygems installed, or the newer rubygems package_task for that
|
11
|
+
# matter.
|
12
|
+
require 'rake/packagetask'
|
13
|
+
require 'rake/gempackagetask'
|
14
|
+
end
|
15
|
+
|
5
16
|
require 'rake'
|
6
|
-
require 'rake/packagetask'
|
7
|
-
require 'rake/gempackagetask'
|
8
17
|
require 'rspec'
|
9
18
|
require "rspec/core/rake_task"
|
10
19
|
|
20
|
+
|
11
21
|
module Puppet
|
12
|
-
|
22
|
+
%x{which git &> /dev/null}
|
23
|
+
if $?.success? and File.exist?('.git')
|
24
|
+
# remove the git hash from git describe string
|
25
|
+
PUPPETVERSION=%x{git describe}.chomp.gsub('-','.').split('.')[0..3].join('.')
|
26
|
+
else
|
27
|
+
PUPPETVERSION=File.read('lib/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
|
28
|
+
end
|
13
29
|
end
|
14
30
|
|
15
31
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
data/conf/osx/createpackage.sh
CHANGED
@@ -53,6 +53,7 @@ function install_puppet() {
|
|
53
53
|
"${installer}" --destdir="${pkgroot}" --bindir="${BINDIR}" --sbindir="${SBINDIR}" --sitelibdir="${SITELIBDIR}"
|
54
54
|
mkdir -p ${pkgroot}/var/lib/puppet
|
55
55
|
chown -R root:admin "${pkgroot}"
|
56
|
+
chmod -R go-w "${pkgroot}"
|
56
57
|
}
|
57
58
|
|
58
59
|
function install_docs() {
|
@@ -107,7 +108,8 @@ function create_package() {
|
|
107
108
|
rm -fr "$(pwd)/puppet-${puppet_version}.pkg"
|
108
109
|
echo "Building package"
|
109
110
|
echo "Note that packagemaker is reknowned for spurious errors. Don't panic."
|
110
|
-
"${PACKAGEMAKER}" --
|
111
|
+
"${PACKAGEMAKER}" --verbose --no-recommend --no-relocate \
|
112
|
+
--root "${pkgroot}" \
|
111
113
|
--info "${pkgtemp}/${PROTO_PLIST}" \
|
112
114
|
--scripts ${pkgtemp}/scripts \
|
113
115
|
--out "$(pwd)/puppet-${puppet_version}.pkg"
|
data/conf/redhat/logrotate
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
create 0644 puppet puppet
|
5
5
|
sharedscripts
|
6
6
|
postrotate
|
7
|
-
|
7
|
+
pkill -USR2 -u puppet -f /usr/sbin/puppetmasterd || true
|
8
8
|
[ -e /etc/init.d/puppet ] && /etc/init.d/puppet reload > /dev/null 2>&1 || true
|
9
9
|
endscript
|
10
10
|
}
|
data/conf/redhat/puppet.spec
CHANGED
@@ -1,20 +1,28 @@
|
|
1
1
|
# Augeas and SELinux requirements may be disabled at build time by passing
|
2
2
|
# --without augeas and/or --without selinux to rpmbuild or mock
|
3
3
|
|
4
|
-
|
4
|
+
# Fedora 17 ships with Ruby 1.9, which uses vendorlibdir instead of
|
5
|
+
# sitelibdir. Adjust our target if installing on f17.
|
6
|
+
%if 0%{?fedora} >= 17
|
7
|
+
%global puppet_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')
|
8
|
+
%else
|
9
|
+
%global puppet_libdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
|
10
|
+
%endif
|
11
|
+
|
5
12
|
%global confdir conf/redhat
|
6
13
|
|
7
14
|
Name: puppet
|
8
|
-
Version: 2.7.
|
9
|
-
#Release: 0.
|
15
|
+
Version: 2.7.19
|
16
|
+
#Release: 0.1rc3%{?dist}
|
10
17
|
Release: 1%{?dist}
|
18
|
+
Vendor: %{?_host_vendor}
|
11
19
|
Summary: A network tool for managing many disparate systems
|
12
20
|
License: ASL 2.0
|
13
21
|
URL: http://puppetlabs.com
|
14
22
|
Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz
|
15
|
-
#Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}
|
23
|
+
#Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc3.tar.gz
|
16
24
|
Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc
|
17
|
-
#Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}
|
25
|
+
#Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc3.tar.gz.asc
|
18
26
|
|
19
27
|
Group: System Environment/Base
|
20
28
|
|
@@ -67,7 +75,7 @@ The server can also function as a certificate authority and file server.
|
|
67
75
|
|
68
76
|
%prep
|
69
77
|
%setup -q -n %{name}-%{version}
|
70
|
-
#%setup -q -n %{name}-%{version}
|
78
|
+
#%setup -q -n %{name}-%{version}rc3
|
71
79
|
patch -s -p1 < conf/redhat/rundir-perms.patch
|
72
80
|
|
73
81
|
|
@@ -91,7 +99,7 @@ mv conf/puppet-queue.conf examples/etc/puppet/
|
|
91
99
|
|
92
100
|
%install
|
93
101
|
rm -rf %{buildroot}
|
94
|
-
ruby install.rb --destdir=%{buildroot} --quick --no-rdoc
|
102
|
+
ruby install.rb --destdir=%{buildroot} --quick --no-rdoc --sitelibdir=%{puppet_libdir}
|
95
103
|
|
96
104
|
install -d -m0755 %{buildroot}%{_sysconfdir}/puppet/manifests
|
97
105
|
install -d -m0755 %{buildroot}%{_datadir}/%{name}/modules
|
@@ -136,6 +144,9 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \
|
|
136
144
|
%{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
|
137
145
|
%endif
|
138
146
|
|
147
|
+
# Create puppet modules directory for puppet module tool
|
148
|
+
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/modules
|
149
|
+
|
139
150
|
%files
|
140
151
|
%defattr(-, root, root, 0755)
|
141
152
|
%doc CHANGELOG LICENSE README.md examples
|
@@ -146,9 +157,10 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \
|
|
146
157
|
%{_bindir}/puppetdoc
|
147
158
|
%{_sbindir}/puppetca
|
148
159
|
%{_sbindir}/puppetd
|
149
|
-
%{
|
160
|
+
%{puppet_libdir}/*
|
150
161
|
%{_initrddir}/puppet
|
151
162
|
%dir %{_sysconfdir}/puppet
|
163
|
+
%dir %{_sysconfdir}/%{name}/modules
|
152
164
|
%if 0%{?fedora} >= 15
|
153
165
|
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
|
154
166
|
%endif
|
@@ -289,6 +301,21 @@ fi
|
|
289
301
|
rm -rf %{buildroot}
|
290
302
|
|
291
303
|
%changelog
|
304
|
+
* Tue Aug 21 2012 Moses Mendoza <moses@puppetlabs.com> - 2.7.19-1
|
305
|
+
- Update for 2.7.19
|
306
|
+
|
307
|
+
* Tue Aug 14 2012 Moses Mendoza <moses@puppetlabs.com> - 2.7.19-0.1rc3
|
308
|
+
- Update for 2.7.19rc3
|
309
|
+
|
310
|
+
* Tue Aug 7 2012 Moses Mendoza <moses@puppetlabs.com> - 2.7.19-0.1rc2
|
311
|
+
- Update for 2.7.19rc2
|
312
|
+
|
313
|
+
* Wed Aug 1 2012 Moses Mendoza <moses@puppetlabs.com> - 2.7.19-0.1rc1
|
314
|
+
- Update for 2.7.19rc1
|
315
|
+
|
316
|
+
* Wed Jul 11 2012 William Hopper <whopper@puppetlabs.com> - 2.7.18-2
|
317
|
+
- (#15221) Create /etc/puppet/modules for puppet module tool
|
318
|
+
|
292
319
|
* Mon Jul 9 2012 Moses Mendoza <moses@puppetlabs.com> - 2.7.18-1
|
293
320
|
- Update for 2.7.18
|
294
321
|
|
data/lib/puppet.rb
CHANGED
@@ -293,6 +293,8 @@ Puppet agent accepts the following signals:
|
|
293
293
|
Shut down the puppet agent daemon.
|
294
294
|
* SIGUSR1:
|
295
295
|
Immediately retrieve and apply configurations from the puppet master.
|
296
|
+
* SIGUSR2:
|
297
|
+
Close file descriptors for log files and reopen them. Used with logrotate.
|
296
298
|
|
297
299
|
AUTHOR
|
298
300
|
------
|
data/lib/puppet/configurer.rb
CHANGED
@@ -180,9 +180,8 @@ class Puppet::Configurer
|
|
180
180
|
|
181
181
|
def save_last_run_summary(report)
|
182
182
|
mode = Puppet.settings.setting(:lastrunfile).mode
|
183
|
-
Puppet::Util
|
184
|
-
|
185
|
-
file.print YAML.dump(report.raw_summary)
|
183
|
+
Puppet::Util.replace_file(Puppet[:lastrunfile], mode) do |fh|
|
184
|
+
fh.print YAML.dump(report.raw_summary)
|
186
185
|
end
|
187
186
|
rescue => detail
|
188
187
|
puts detail.backtrace if Puppet[:trace]
|
data/lib/puppet/defaults.rb
CHANGED
@@ -180,9 +180,10 @@ module Puppet
|
|
180
180
|
end
|
181
181
|
},
|
182
182
|
:thin_storeconfigs => {:default => false, :desc =>
|
183
|
-
"Boolean;
|
184
|
-
|
185
|
-
|
183
|
+
"Boolean; whether Puppet should store only facts and exported resources in the storeconfigs
|
184
|
+
database. This will improve the performance of exported resources with the older
|
185
|
+
`active_record` backend, but will disable external tools that search the storeconfigs database.
|
186
|
+
Thinning catalogs is generally unnecessary when using PuppetDB to store catalogs.",
|
186
187
|
:hook => proc do |value|
|
187
188
|
Puppet.settings[:storeconfigs] = true if value
|
188
189
|
end
|
@@ -505,7 +506,7 @@ EOT
|
|
505
506
|
rest indirections. This can be used as a fine-grained
|
506
507
|
authorization system for `puppet master`."
|
507
508
|
],
|
508
|
-
:ca => [true, "
|
509
|
+
:ca => [true, "Whether the master should function as a certificate authority."],
|
509
510
|
:modulepath => {
|
510
511
|
:default => "$confdir/modules#{File::PATH_SEPARATOR}/usr/share/puppet/modules",
|
511
512
|
:desc => "The search path for modules, as a list of directories separated by the system path separator character. (The POSIX path separator is ':', and the Windows path separator is ';'.)",
|
@@ -713,7 +714,7 @@ EOT
|
|
713
714
|
"Whether to send reports after every transaction."
|
714
715
|
],
|
715
716
|
:lastrunfile => { :default => "$statedir/last_run_summary.yaml",
|
716
|
-
:mode =>
|
717
|
+
:mode => 0644,
|
717
718
|
:desc => "Where puppet agent stores the last run report summary in yaml format."
|
718
719
|
},
|
719
720
|
:lastrunreport => { :default => "$statedir/last_run_report.yaml",
|
@@ -147,13 +147,14 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
147
147
|
|
148
148
|
when_invoked do |name, options|
|
149
149
|
sep = File::PATH_SEPARATOR
|
150
|
+
|
150
151
|
if options[:target_dir]
|
151
|
-
options[:target_dir] = File.expand_path(options[:target_dir])
|
152
152
|
options[:modulepath] = "#{options[:target_dir]}#{sep}#{options[:modulepath]}"
|
153
153
|
end
|
154
154
|
|
155
155
|
Puppet.settings[:modulepath] = options[:modulepath]
|
156
156
|
options[:target_dir] = Puppet.settings[:modulepath].split(sep).first
|
157
|
+
options[:target_dir] = File.expand_path(options[:target_dir])
|
157
158
|
|
158
159
|
Puppet.notice "Preparing to install into #{options[:target_dir]} ..."
|
159
160
|
Puppet::ModuleTool::Applications::Installer.run(name, options)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
require 'puppet/file_bucket'
|
2
3
|
require 'puppet/file_bucket/file'
|
3
4
|
require 'puppet/indirector/request'
|
@@ -99,7 +100,6 @@ class Puppet::FileBucket::Dipper
|
|
99
100
|
|
100
101
|
private
|
101
102
|
def absolutize_path( path )
|
102
|
-
require 'pathname'
|
103
103
|
Pathname.new(path).realpath
|
104
104
|
end
|
105
105
|
|
@@ -10,6 +10,9 @@ class Puppet::Indirector::Indirection
|
|
10
10
|
include Puppet::Util::Docs
|
11
11
|
extend Puppet::Util::Instrumentation::Instrumentable
|
12
12
|
|
13
|
+
attr_accessor :name, :model
|
14
|
+
attr_reader :termini
|
15
|
+
|
13
16
|
probe :find, :label => Proc.new { |parent, key, *args| "find_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
|
14
17
|
probe :save, :label => Proc.new { |parent, key, *args| "save_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
|
15
18
|
probe :search, :label => Proc.new { |parent, key, *args| "search_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
|
@@ -36,10 +39,6 @@ class Puppet::Indirector::Indirection
|
|
36
39
|
match.model
|
37
40
|
end
|
38
41
|
|
39
|
-
attr_accessor :name, :model
|
40
|
-
|
41
|
-
attr_reader :termini
|
42
|
-
|
43
42
|
# Create and return our cache terminus.
|
44
43
|
def cache
|
45
44
|
raise(Puppet::DevError, "Tried to cache when no cache class was set") unless cache_class
|
@@ -80,21 +80,27 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
80
80
|
def http_request(method, request, *args)
|
81
81
|
http_connection = network(request)
|
82
82
|
peer_certs = []
|
83
|
+
verify_errors = []
|
83
84
|
|
84
|
-
# We add the callback to collect the certificates for use in constructing
|
85
|
-
# the error message if the verification failed. This is necessary since we
|
86
|
-
# don't have direct access to the cert that we expected the connection to
|
87
|
-
# use otherwise.
|
88
|
-
#
|
89
85
|
http_connection.verify_callback = proc do |preverify_ok, ssl_context|
|
86
|
+
# We use the callback to collect the certificates for use in constructing
|
87
|
+
# the error message if the verification failed. This is necessary since we
|
88
|
+
# don't have direct access to the cert that we expected the connection to
|
89
|
+
# use otherwise.
|
90
90
|
peer_certs << Puppet::SSL::Certificate.from_s(ssl_context.current_cert.to_pem)
|
91
|
+
# And also keep the detailed verification error if such an error occurs
|
92
|
+
if ssl_context.error_string and not preverify_ok
|
93
|
+
verify_errors << "#{ssl_context.error_string} for #{ssl_context.current_cert.subject}"
|
94
|
+
end
|
91
95
|
preverify_ok
|
92
96
|
end
|
93
97
|
|
94
98
|
http_connection.send(method, *args)
|
95
99
|
rescue OpenSSL::SSL::SSLError => error
|
96
100
|
if error.message.include? "certificate verify failed"
|
97
|
-
|
101
|
+
msg = error.message
|
102
|
+
msg << ": [" + verify_errors.join('; ') + "]"
|
103
|
+
raise Puppet::Error, msg
|
98
104
|
elsif error.message =~ /hostname (was )?not match/
|
99
105
|
raise unless cert = peer_certs.find { |c| c.name !~ /^puppet ca/i }
|
100
106
|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'puppet/interface/action'
|
2
|
+
require 'puppet/interface/action_builder'
|
2
3
|
|
3
4
|
module Puppet::Interface::ActionManager
|
4
5
|
# Declare that this app can take a specific action, and provide
|
5
6
|
# the code to do so.
|
6
7
|
def action(name, &block)
|
7
|
-
require 'puppet/interface/action_builder'
|
8
|
-
|
9
8
|
@actions ||= {}
|
10
9
|
raise "Action #{name} already defined for #{self}" if action?(name)
|
11
10
|
|
@@ -21,16 +21,35 @@ module Puppet::ModuleTool
|
|
21
21
|
@module_dir
|
22
22
|
end
|
23
23
|
|
24
|
+
# Obtain a suitable temporary path for building and unpacking tarballs
|
25
|
+
#
|
26
|
+
# @return [Pathname] path to temporary build location
|
27
|
+
def build_dir
|
28
|
+
Puppet::Forge::Cache.base_path + "tmp-unpacker-#{Digest::SHA1.hexdigest(@filename.basename.to_s)}"
|
29
|
+
end
|
30
|
+
|
24
31
|
private
|
25
32
|
def extract_module_to_install_dir
|
26
33
|
delete_existing_installation_or_abort!
|
27
34
|
|
28
|
-
build_dir = Puppet::Forge::Cache.base_path + "tmp-unpacker-#{Digest::SHA1.hexdigest(@filename.basename.to_s)}"
|
29
35
|
build_dir.mkpath
|
30
36
|
begin
|
31
|
-
|
32
|
-
|
37
|
+
begin
|
38
|
+
if Facter.value('operatingsystem') == "Solaris"
|
39
|
+
# Solaris tar is not as safe and works differently, so we prefer
|
40
|
+
# gnutar instead.
|
41
|
+
if Puppet::Util.which('gtar')
|
42
|
+
Puppet::Util.execute("gtar xzf #{@filename} -C #{build_dir}")
|
43
|
+
else
|
44
|
+
raise RuntimeError, "Cannot find the command 'gtar'. Make sure GNU tar is installed, and is in your PATH."
|
45
|
+
end
|
46
|
+
else
|
47
|
+
Puppet::Util.execute("tar xzf #{@filename} -C #{build_dir}")
|
48
|
+
end
|
49
|
+
rescue Puppet::ExecutionFailure => e
|
50
|
+
raise RuntimeError, "Could not extract contents of module archive: #{e.message}"
|
33
51
|
end
|
52
|
+
|
34
53
|
# grab the first directory
|
35
54
|
extracted = build_dir.children.detect { |c| c.directory? }
|
36
55
|
FileUtils.mv extracted, @module_dir
|
@@ -645,9 +645,9 @@ class Puppet::Network::Handler
|
|
645
645
|
nil
|
646
646
|
end
|
647
647
|
|
648
|
+
require 'puppet/file_serving'
|
649
|
+
require 'puppet/file_serving/fileset'
|
648
650
|
def reclist(abspath, recurse, ignore)
|
649
|
-
require 'puppet/file_serving'
|
650
|
-
require 'puppet/file_serving/fileset'
|
651
651
|
if recurse.is_a?(Fixnum)
|
652
652
|
args = { :recurse => true, :recurselimit => recurse, :links => :follow }
|
653
653
|
else
|
@@ -32,14 +32,21 @@ class Resource < AST::Branch
|
|
32
32
|
resource_titles = instance.title.safeevaluate(scope)
|
33
33
|
|
34
34
|
# it's easier to always use an array, even for only one name
|
35
|
-
resource_titles = [resource_titles]
|
35
|
+
resource_titles = [resource_titles].flatten.collect do |title|
|
36
|
+
case title
|
37
|
+
when ::String, ::Numeric, ::Symbol, true, false
|
38
|
+
title.to_s
|
39
|
+
else
|
40
|
+
raise Puppet::ParseError, "Resource title must be a String, not #{title.class}"
|
41
|
+
end
|
42
|
+
end
|
36
43
|
|
37
44
|
fully_qualified_type, resource_titles = scope.resolve_type_and_titles(type, resource_titles)
|
38
45
|
|
39
46
|
# Second level of implicit iteration; build a resource for each
|
40
47
|
# title. This handles things like:
|
41
48
|
# file { ['/foo', '/bar']: owner => blah }
|
42
|
-
resource_titles.
|
49
|
+
resource_titles.collect { |resource_title|
|
43
50
|
exceptwrap :type => Puppet::ParseError do
|
44
51
|
resource = Puppet::Parser::Resource.new(
|
45
52
|
fully_qualified_type, resource_title,
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
1
3
|
Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
|
2
4
|
"Generates random numbers based on the node's fqdn. Generated random values
|
3
5
|
will be a range from 0 up to and excluding n, where n is the first parameter.
|
@@ -5,7 +7,6 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
|
|
5
7
|
|
6
8
|
$random_number = fqdn_rand(30)
|
7
9
|
$random_number_seed = fqdn_rand(30,30)") do |args|
|
8
|
-
require 'digest/md5'
|
9
10
|
max = args.shift
|
10
11
|
srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),args].join(':')).hex)
|
11
12
|
rand(max).to_s
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
require 'md5'
|
1
|
+
require 'digest/md5'
|
3
2
|
|
3
|
+
Puppet::Parser::Functions::newfunction(:md5, :type => :rvalue, :doc => "Returns a MD5 hash value from a provided string.") do |args|
|
4
4
|
Digest::MD5.hexdigest(args[0])
|
5
5
|
end
|