puppet 4.1.0-x86-mingw32 → 4.2.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.
- data/ext/osx/puppet.plist +32 -0
- data/ext/redhat/client.init +3 -6
- data/ext/redhat/client.sysconfig +1 -10
- data/ext/suse/client.init +3 -6
- data/ext/systemd/puppet.service +2 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +4 -19
- data/lib/puppet/application/apply.rb +22 -6
- data/lib/puppet/configurer.rb +3 -2
- data/lib/puppet/configurer/plugin_handler.rb +6 -2
- data/lib/puppet/face/plugin.rb +7 -14
- data/lib/puppet/forge/repository.rb +1 -2
- data/lib/puppet/indirector/catalog/compiler.rb +4 -3
- data/lib/puppet/indirector/facts/facter.rb +8 -0
- data/lib/puppet/module.rb +17 -12
- data/lib/puppet/network/http/factory.rb +8 -4
- data/lib/puppet/node/environment.rb +11 -7
- data/lib/puppet/parser/ast/pops_bridge.rb +5 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
- data/lib/puppet/parser/scope.rb +39 -13
- data/lib/puppet/pops.rb +1 -0
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +31 -0
- data/lib/puppet/pops/parser/epp_support.rb +4 -2
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider.rb +5 -0
- data/lib/puppet/provider/augeas/augeas.rb +5 -0
- data/lib/puppet/provider/group/pw.rb +1 -0
- data/lib/puppet/provider/group/windows_adsi.rb +9 -0
- data/lib/puppet/provider/mount/parsed.rb +15 -1
- data/lib/puppet/provider/package.rb +6 -2
- data/lib/puppet/provider/package/gem.rb +16 -0
- data/lib/puppet/provider/package/openbsd.rb +7 -7
- data/lib/puppet/provider/package/pacman.rb +9 -8
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pip3.rb +18 -0
- data/lib/puppet/provider/package/pkgdmg.rb +4 -2
- data/lib/puppet/provider/package/pkgin.rb +3 -3
- data/lib/puppet/provider/package/rpm.rb +8 -14
- data/lib/puppet/provider/package/yum.rb +5 -4
- data/lib/puppet/provider/service/base.rb +3 -2
- data/lib/puppet/provider/service/bsd.rb +7 -7
- data/lib/puppet/provider/service/debian.rb +2 -1
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/systemd.rb +75 -6
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +1 -0
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/status.rb +9 -0
- data/lib/puppet/resource/type.rb +4 -2
- data/lib/puppet/settings.rb +43 -16
- data/lib/puppet/transaction.rb +27 -13
- data/lib/puppet/type/augeas.rb +1 -0
- data/lib/puppet/type/exec.rb +11 -2
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/mount.rb +2 -0
- data/lib/puppet/type/package.rb +13 -2
- data/lib/puppet/type/service.rb +9 -0
- data/lib/puppet/util.rb +8 -3
- data/lib/puppet/util/execution.rb +2 -2
- data/lib/puppet/util/http_proxy.rb +60 -0
- data/lib/puppet/util/log.rb +1 -1
- data/lib/puppet/util/splayer.rb +18 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-obsoletes.txt +195 -0
- data/spec/integration/application/apply_spec.rb +72 -30
- data/spec/integration/indirector/facts/facter_spec.rb +38 -0
- data/spec/integration/parser/scope_spec.rb +20 -2
- data/spec/integration/provider/mount_spec.rb +23 -36
- data/spec/integration/transaction_spec.rb +40 -1
- data/spec/integration/type/file_spec.rb +36 -0
- data/spec/integration/type/package_spec.rb +65 -0
- data/spec/lib/matchers/include_in_order.rb +0 -1
- data/spec/lib/puppet_spec/files.rb +14 -0
- data/spec/unit/agent_spec.rb +0 -38
- data/spec/unit/application/apply_spec.rb +13 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +42 -13
- data/spec/unit/configurer_spec.rb +5 -0
- data/spec/unit/face/plugin_spec.rb +33 -4
- data/spec/unit/file_serving/configuration/parser_spec.rb +25 -30
- data/spec/unit/indirector/catalog/compiler_spec.rb +16 -0
- data/spec/unit/indirector/facts/facter_spec.rb +2 -1
- data/spec/unit/module_spec.rb +0 -23
- data/spec/unit/network/http/factory_spec.rb +14 -0
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -2
- data/spec/unit/parser/functions/generate_spec.rb +3 -12
- data/spec/unit/parser/scope_spec.rb +9 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +19 -0
- data/spec/unit/pops/evaluator/variables_spec.rb +1 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +35 -3
- data/spec/unit/provider/augeas/augeas_spec.rb +9 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +5 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/base_spec.rb +18 -0
- data/spec/unit/provider/package/gem_spec.rb +70 -0
- data/spec/unit/provider/package/pacman_spec.rb +55 -0
- data/spec/unit/provider/package/pip3_spec.rb +257 -0
- data/spec/unit/provider/package/pip_spec.rb +1 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +18 -0
- data/spec/unit/provider/package/pkgin_spec.rb +23 -13
- data/spec/unit/provider/package/yum_spec.rb +11 -0
- data/spec/unit/provider/service/bsd_spec.rb +130 -0
- data/spec/unit/provider/service/debian_spec.rb +12 -1
- data/spec/unit/provider/service/freebsd_spec.rb +16 -0
- data/spec/unit/provider/service/systemd_spec.rb +84 -7
- data/spec/unit/provider/service/upstart_spec.rb +1 -0
- data/spec/unit/provider/zone/solaris_spec.rb +45 -12
- data/spec/unit/puppet_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +5 -0
- data/spec/unit/type/mount_spec.rb +8 -0
- data/spec/unit/type/service_spec.rb +5 -0
- data/spec/unit/util/http_proxy_spec.rb +87 -0
- data/spec/unit/util/log_spec.rb +12 -1
- data/spec/unit/util/splayer_spec.rb +45 -0
- metadata +3071 -3035
- checksums.yaml +0 -7
- data/ext/systemd/puppetmaster.service +0 -11
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>EnvironmentVariables</key>
|
6
|
+
<dict>
|
7
|
+
<key>PATH</key>
|
8
|
+
<string>/opt/puppetlabs/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
9
|
+
<key>LANG</key>
|
10
|
+
<string>en_US.UTF-8</string>
|
11
|
+
</dict>
|
12
|
+
<key>Label</key>
|
13
|
+
<string>puppet</string>
|
14
|
+
<key>KeepAlive</key>
|
15
|
+
<true/>
|
16
|
+
<key>ProgramArguments</key>
|
17
|
+
<array>
|
18
|
+
<string>/opt/puppetlabs/bin/puppet</string>
|
19
|
+
<string>agent</string>
|
20
|
+
<string>--verbose</string>
|
21
|
+
<string>--no-daemonize</string>
|
22
|
+
<string>--logdest</string>
|
23
|
+
<string>console</string>
|
24
|
+
</array>
|
25
|
+
<key>RunAtLoad</key>
|
26
|
+
<true/>
|
27
|
+
<key>StandardErrorPath</key>
|
28
|
+
<string>/var/log/puppetlabs/puppet/puppet.log</string>
|
29
|
+
<key>StandardOutPath</key>
|
30
|
+
<string>/var/log/puppetlabs/puppet/puppet.log</string>
|
31
|
+
</dict>
|
32
|
+
</plist>
|
data/ext/redhat/client.init
CHANGED
@@ -17,15 +17,12 @@ PATH=/opt/puppetlabs/puppet/bin:/usr/bin:/sbin:/bin:/usr/sbin
|
|
17
17
|
export PATH
|
18
18
|
|
19
19
|
[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
|
20
|
-
lockfile
|
21
|
-
pidfile
|
22
|
-
puppetd
|
20
|
+
lockfile=/var/lock/subsys/puppet
|
21
|
+
pidfile=/var/run/puppetlabs/agent.pid
|
22
|
+
puppetd=/opt/puppetlabs/puppet/bin/puppet
|
23
23
|
RETVAL=0
|
24
24
|
|
25
25
|
PUPPET_OPTS="agent "
|
26
|
-
[ -n "${PUPPET_SERVER}" ] && PUPPET_OPTS="${PUPPET_OPTS} --server=${PUPPET_SERVER}"
|
27
|
-
[ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
|
28
|
-
[ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --masterport=${PUPPET_PORT}"
|
29
26
|
|
30
27
|
# Determine if we can use the -p option to daemon, killproc, and status.
|
31
28
|
# RHEL < 5 can't.
|
data/ext/redhat/client.sysconfig
CHANGED
@@ -1,11 +1,2 @@
|
|
1
|
-
#
|
2
|
-
#PUPPET_SERVER=puppet
|
3
|
-
|
4
|
-
# If you wish to specify the port to connect to do so here
|
5
|
-
#PUPPET_PORT=8140
|
6
|
-
|
7
|
-
# Where to log to. Specify syslog to send log messages to the system log.
|
8
|
-
#PUPPET_LOG=/var/log/puppetlabs/puppet/puppet.log
|
9
|
-
|
10
|
-
# You may specify other parameters to the puppet client here
|
1
|
+
# You may specify parameters to the puppet client here
|
11
2
|
#PUPPET_EXTRA_OPTS=--waitforcert=500
|
data/ext/suse/client.init
CHANGED
@@ -33,15 +33,12 @@
|
|
33
33
|
# rc_exit exit appropriate to overall rc status
|
34
34
|
[ -f /etc/rc.status ] && . /etc/rc.status
|
35
35
|
[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
|
36
|
-
lockfile
|
37
|
-
pidfile
|
38
|
-
puppetd
|
36
|
+
lockfile=/var/lock/subsys/puppet
|
37
|
+
pidfile=/var/run/puppetlabs/agent.pid
|
38
|
+
puppetd=/opt/puppetlabs/puppet/bin/puppet
|
39
39
|
RETVAL=0
|
40
40
|
|
41
41
|
PUPPET_OPTS="agent"
|
42
|
-
[ -n "${PUPPET_SERVER}" ] && PUPPET_OPTS="${PUPPET_OPTS} --server=${PUPPET_SERVER}"
|
43
|
-
[ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
|
44
|
-
[ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --port=${PUPPET_PORT}"
|
45
42
|
|
46
43
|
# First reset status of this service
|
47
44
|
rc_reset
|
data/ext/systemd/puppet.service
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
[Unit]
|
2
2
|
Description=Puppet agent
|
3
3
|
Wants=basic.target
|
4
|
-
After=basic.target network.target
|
4
|
+
After=basic.target network.target
|
5
5
|
|
6
6
|
[Service]
|
7
7
|
EnvironmentFile=-/etc/sysconfig/puppetagent
|
8
8
|
EnvironmentFile=-/etc/sysconfig/puppet
|
9
|
+
EnvironmentFile=-/etc/default/puppet
|
9
10
|
ExecStart=/opt/puppetlabs/puppet/bin/puppet agent $PUPPET_EXTRA_OPTS --no-daemonize
|
10
11
|
KillMode=process
|
11
12
|
|
data/lib/puppet.rb
CHANGED
@@ -142,7 +142,7 @@ module Puppet
|
|
142
142
|
# code was deprecated in 2008, but this is still in heavy use. I suppose
|
143
143
|
# this can count as a soft deprecation for the next dev. --daniel 2011-04-12
|
144
144
|
def self.newtype(name, options = {}, &block)
|
145
|
-
Puppet.deprecation_warning("Puppet.newtype is deprecated and will be removed in a future release. Use Puppet::Type.newtype instead.")
|
145
|
+
Puppet.deprecation_warning("Creating #{name} via Puppet.newtype is deprecated and will be removed in a future release. Use Puppet::Type.newtype instead.")
|
146
146
|
Puppet::Type.newtype(name, options, &block)
|
147
147
|
end
|
148
148
|
|
data/lib/puppet/agent.rb
CHANGED
@@ -9,11 +9,12 @@ class Puppet::Agent
|
|
9
9
|
require 'puppet/agent/disabler'
|
10
10
|
include Puppet::Agent::Disabler
|
11
11
|
|
12
|
-
|
12
|
+
require 'puppet/util/splayer'
|
13
|
+
include Puppet::Util::Splayer
|
13
14
|
|
14
|
-
|
15
|
-
@splayed = false
|
15
|
+
attr_reader :client_class, :client, :should_fork
|
16
16
|
|
17
|
+
def initialize(client_class, should_fork=true)
|
17
18
|
@should_fork = can_fork? && should_fork
|
18
19
|
@client_class = client_class
|
19
20
|
end
|
@@ -60,22 +61,6 @@ class Puppet::Agent
|
|
60
61
|
Puppet::Application.stop_requested?
|
61
62
|
end
|
62
63
|
|
63
|
-
# Have we splayed already?
|
64
|
-
def splayed?
|
65
|
-
splayed
|
66
|
-
end
|
67
|
-
|
68
|
-
# Sleep when splay is enabled; else just return.
|
69
|
-
def splay(do_splay = Puppet[:splay])
|
70
|
-
return unless do_splay
|
71
|
-
return if splayed?
|
72
|
-
|
73
|
-
time = rand(Puppet[:splaylimit] + 1)
|
74
|
-
Puppet.info "Sleeping for #{time} seconds (splay is enabled)"
|
75
|
-
sleep(time)
|
76
|
-
@splayed = true
|
77
|
-
end
|
78
|
-
|
79
64
|
def run_in_fork(forking = true)
|
80
65
|
return yield unless forking or Puppet.features.windows?
|
81
66
|
|
@@ -3,6 +3,8 @@ require 'puppet/configurer'
|
|
3
3
|
require 'puppet/util/profiler/aggregate'
|
4
4
|
|
5
5
|
class Puppet::Application::Apply < Puppet::Application
|
6
|
+
require 'puppet/util/splayer'
|
7
|
+
include Puppet::Util::Splayer
|
6
8
|
|
7
9
|
option("--debug","-d")
|
8
10
|
option("--execute EXECUTE","-e") do |arg|
|
@@ -180,6 +182,9 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
180
182
|
Puppet.warning("Only one file can be applied per run. Skipping #{command_line.args.join(', ')}") if command_line.args.size > 0
|
181
183
|
end
|
182
184
|
|
185
|
+
# splay if needed
|
186
|
+
splay
|
187
|
+
|
183
188
|
unless Puppet[:node_name_fact].empty?
|
184
189
|
# Collect our facts.
|
185
190
|
unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
|
@@ -190,17 +195,25 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
190
195
|
facts.name = Puppet[:node_name_value]
|
191
196
|
end
|
192
197
|
|
193
|
-
|
198
|
+
# Find our Node
|
199
|
+
unless node = Puppet::Node.indirection.find(Puppet[:node_name_value])
|
200
|
+
raise "Could not find node #{Puppet[:node_name_value]}"
|
201
|
+
end
|
202
|
+
|
203
|
+
configured_environment = node.environment || Puppet.lookup(:current_environment)
|
204
|
+
|
194
205
|
apply_environment = manifest ?
|
195
206
|
configured_environment.override_with(:manifest => manifest) :
|
196
207
|
configured_environment
|
197
208
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
209
|
+
# Modify the node descriptor to use the special apply_environment.
|
210
|
+
# It is based on the actual environment from the node, or the locally
|
211
|
+
# configured environment if the node does not specify one.
|
212
|
+
# If a manifest file is passed on the command line, it overrides
|
213
|
+
# the :manifest setting of the apply_environment.
|
214
|
+
node.environment = apply_environment
|
203
215
|
|
216
|
+
Puppet.override({:current_environment => apply_environment}, "For puppet apply") do
|
204
217
|
# Merge in the facts.
|
205
218
|
node.merge(facts.values) if facts
|
206
219
|
|
@@ -273,6 +286,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
273
286
|
|
274
287
|
# Enable all of the most common test options.
|
275
288
|
def setup_test
|
289
|
+
Puppet.settings.handlearg("--no-splay")
|
276
290
|
Puppet.settings.handlearg("--show_diff")
|
277
291
|
options[:verbose] = true
|
278
292
|
options[:detailed_exitcodes] = true
|
@@ -290,6 +304,8 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
290
304
|
exit(1)
|
291
305
|
end
|
292
306
|
|
307
|
+
Puppet.settings.use :main, :agent, :ssl
|
308
|
+
|
293
309
|
# we want the last report to be persisted locally
|
294
310
|
Puppet::Transaction::Report.indirection.cache_class = :yaml
|
295
311
|
|
data/lib/puppet/configurer.rb
CHANGED
@@ -45,8 +45,6 @@ class Puppet::Configurer
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def initialize(factory = Puppet::Configurer::DownloaderFactory.new)
|
48
|
-
Puppet.settings.use(:main, :ssl, :agent)
|
49
|
-
|
50
48
|
@running = false
|
51
49
|
@splayed = false
|
52
50
|
@environment = Puppet[:environment]
|
@@ -161,6 +159,7 @@ class Puppet::Configurer
|
|
161
159
|
begin
|
162
160
|
if node = Puppet::Node.indirection.find(Puppet[:node_name_value],
|
163
161
|
:environment => Puppet::Node::Environment.remote(@environment),
|
162
|
+
:configured_environment => Puppet[:environment],
|
164
163
|
:ignore_cache => true,
|
165
164
|
:transaction_uuid => @transaction_uuid,
|
166
165
|
:fail_on_404 => true)
|
@@ -198,6 +197,7 @@ class Puppet::Configurer
|
|
198
197
|
|
199
198
|
query_options = get_facts(options) unless query_options
|
200
199
|
query_options[:transaction_uuid] = @transaction_uuid
|
200
|
+
query_options[:configured_environment] = Puppet[:environment]
|
201
201
|
|
202
202
|
unless catalog = prepare_and_retrieve_catalog(options, query_options)
|
203
203
|
return nil
|
@@ -218,6 +218,7 @@ class Puppet::Configurer
|
|
218
218
|
|
219
219
|
query_options = get_facts(options)
|
220
220
|
query_options[:transaction_uuid] = @transaction_uuid
|
221
|
+
query_options[:configured_environment] = Puppet[:environment]
|
221
222
|
|
222
223
|
return nil unless catalog = prepare_and_retrieve_catalog(options, query_options)
|
223
224
|
tries += 1
|
@@ -12,12 +12,16 @@ class Puppet::Configurer::PluginHandler
|
|
12
12
|
def download_plugins(environment)
|
13
13
|
plugin_downloader = @factory.create_plugin_downloader(environment)
|
14
14
|
|
15
|
+
result = []
|
16
|
+
|
15
17
|
if Puppet.features.external_facts?
|
16
18
|
plugin_fact_downloader = @factory.create_plugin_facts_downloader(environment)
|
17
|
-
plugin_fact_downloader.evaluate
|
19
|
+
result += plugin_fact_downloader.evaluate
|
18
20
|
end
|
19
21
|
|
20
|
-
plugin_downloader.evaluate
|
22
|
+
result += plugin_downloader.evaluate
|
21
23
|
Puppet::Util::Autoload.reload_changed
|
24
|
+
|
25
|
+
result
|
22
26
|
end
|
23
27
|
end
|
data/lib/puppet/face/plugin.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'puppet/face'
|
2
|
+
require 'puppet/configurer/downloader_factory'
|
3
|
+
require 'puppet/configurer/plugin_handler'
|
4
|
+
|
2
5
|
Puppet::Face.define(:plugin, '0.0.1') do
|
3
6
|
copyright "Puppet Labs", 2011
|
4
7
|
license "Apache 2 license; see COPYING"
|
@@ -37,21 +40,11 @@ Puppet::Face.define(:plugin, '0.0.1') do
|
|
37
40
|
EOT
|
38
41
|
|
39
42
|
when_invoked do |options|
|
40
|
-
require 'puppet/configurer/downloader'
|
41
43
|
remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment])
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
remote_environment_for_plugins).evaluate
|
47
|
-
if Puppet.features.external_facts?
|
48
|
-
result += Puppet::Configurer::Downloader.new("pluginfacts",
|
49
|
-
Puppet[:pluginfactdest],
|
50
|
-
Puppet[:pluginfactsource],
|
51
|
-
Puppet[:pluginsignore],
|
52
|
-
remote_environment_for_plugins).evaluate
|
53
|
-
end
|
54
|
-
result
|
44
|
+
|
45
|
+
factory = Puppet::Configurer::DownloaderFactory.new
|
46
|
+
handler = Puppet::Configurer::PluginHandler.new(factory)
|
47
|
+
handler.download_plugins(remote_environment_for_plugins)
|
55
48
|
end
|
56
49
|
|
57
50
|
when_rendering :console do |value|
|
@@ -130,8 +130,7 @@ class Puppet::Forge
|
|
130
130
|
#
|
131
131
|
# @return [Net::HTTP::Proxy] object constructed from repo settings
|
132
132
|
def get_http_object
|
133
|
-
|
134
|
-
proxy = proxy_class.new(@uri.host, @uri.port)
|
133
|
+
proxy = Puppet::Util::HttpProxy.proxy(@uri)
|
135
134
|
|
136
135
|
if @uri.scheme == 'https'
|
137
136
|
cert_store = OpenSSL::X509::Store.new
|
@@ -102,12 +102,13 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
102
102
|
end
|
103
103
|
|
104
104
|
# Turn our host name into a node object.
|
105
|
-
def find_node(name, environment, transaction_uuid)
|
105
|
+
def find_node(name, environment, transaction_uuid, configured_environment)
|
106
106
|
Puppet::Util::Profiler.profile("Found node information", [:compiler, :find_node]) do
|
107
107
|
node = nil
|
108
108
|
begin
|
109
109
|
node = Puppet::Node.indirection.find(name, :environment => environment,
|
110
|
-
:transaction_uuid => transaction_uuid
|
110
|
+
:transaction_uuid => transaction_uuid,
|
111
|
+
:configured_environment => configured_environment)
|
111
112
|
rescue => detail
|
112
113
|
message = "Failed when searching for node #{name}: #{detail}"
|
113
114
|
Puppet.log_exception(detail, message)
|
@@ -142,7 +143,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
142
143
|
# node's catalog with only one certificate and a modification to auth.conf
|
143
144
|
# If no key is provided we can only compile the currently connected node.
|
144
145
|
name = request.key || request.node
|
145
|
-
if node = find_node(name, request.environment, request.options[:transaction_uuid])
|
146
|
+
if node = find_node(name, request.environment, request.options[:transaction_uuid], request.options[:configured_environment])
|
146
147
|
return node
|
147
148
|
end
|
148
149
|
|
@@ -35,6 +35,14 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
|
|
35
35
|
setcode { Puppet.version.to_s }
|
36
36
|
end
|
37
37
|
|
38
|
+
Facter.add(:agent_specified_environment) do
|
39
|
+
setcode do
|
40
|
+
if Puppet.settings.set_by_config?(:environment)
|
41
|
+
Puppet[:environment]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
result = Puppet::Node::Facts.new(request.key, Facter.to_hash)
|
39
47
|
result.add_local_facts
|
40
48
|
result.sanitize
|
data/lib/puppet/module.rb
CHANGED
@@ -56,7 +56,7 @@ class Puppet::Module
|
|
56
56
|
attr_writer :environment
|
57
57
|
|
58
58
|
attr_accessor :dependencies, :forge_name
|
59
|
-
attr_accessor :source, :author, :version, :license, :
|
59
|
+
attr_accessor :source, :author, :version, :license, :summary, :description, :project_page
|
60
60
|
|
61
61
|
def initialize(name, path, environment)
|
62
62
|
@name = name
|
@@ -67,11 +67,23 @@ class Puppet::Module
|
|
67
67
|
|
68
68
|
load_metadata if has_metadata?
|
69
69
|
|
70
|
-
validate_puppet_version
|
71
|
-
|
72
70
|
@absolute_path_to_manifests = Puppet::FileSystem::PathPattern.absolute(manifests)
|
73
71
|
end
|
74
72
|
|
73
|
+
# @deprecated The puppetversion module metadata field is no longer used.
|
74
|
+
def puppetversion
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
|
78
|
+
# @deprecated The puppetversion module metadata field is no longer used.
|
79
|
+
def puppetversion=(something)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @deprecated The puppetversion module metadata field is no longer used.
|
83
|
+
def validate_puppet_version
|
84
|
+
return
|
85
|
+
end
|
86
|
+
|
75
87
|
def has_metadata?
|
76
88
|
return false unless metadata_file
|
77
89
|
|
@@ -136,11 +148,9 @@ class Puppet::Module
|
|
136
148
|
@metadata = data = JSON.parse(File.read(metadata_file))
|
137
149
|
@forge_name = data['name'].gsub('-', '/') if data['name']
|
138
150
|
|
139
|
-
[:source, :author, :version, :license, :
|
151
|
+
[:source, :author, :version, :license, :dependencies].each do |attr|
|
140
152
|
unless value = data[attr.to_s]
|
141
|
-
|
142
|
-
raise MissingMetadata, "No #{attr} module metadata provided for #{self.name}"
|
143
|
-
end
|
153
|
+
raise MissingMetadata, "No #{attr} module metadata provided for #{self.name}"
|
144
154
|
end
|
145
155
|
|
146
156
|
if attr == :dependencies
|
@@ -307,11 +317,6 @@ class Puppet::Module
|
|
307
317
|
unmet_dependencies
|
308
318
|
end
|
309
319
|
|
310
|
-
def validate_puppet_version
|
311
|
-
return unless puppetversion and puppetversion != Puppet.version
|
312
|
-
raise IncompatibleModule, "Module #{self.name} is only compatible with Puppet version #{puppetversion}, not #{Puppet.version}"
|
313
|
-
end
|
314
|
-
|
315
320
|
def ==(other)
|
316
321
|
self.name == other.name &&
|
317
322
|
self.version == other.version &&
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'openssl'
|
2
2
|
require 'net/http'
|
3
|
+
require 'puppet/util/http_proxy'
|
3
4
|
|
4
5
|
# Factory for <tt>Net::HTTP</tt> objects.
|
5
6
|
#
|
@@ -23,10 +24,13 @@ class Puppet::Network::HTTP::Factory
|
|
23
24
|
Puppet.debug("Creating new connection for #{site}")
|
24
25
|
|
25
26
|
args = [site.host, site.port]
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
|
28
|
+
unless Puppet::Util::HttpProxy.no_proxy?(site)
|
29
|
+
if Puppet[:http_proxy_host] == "none"
|
30
|
+
args << nil << nil
|
31
|
+
else
|
32
|
+
args << Puppet[:http_proxy_host] << Puppet[:http_proxy_port]
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
http = Net::HTTP.new(*args)
|
@@ -179,7 +179,7 @@ class Puppet::Node::Environment
|
|
179
179
|
# Puppet[:disable_per_environment_manifest] is true, and this environment's
|
180
180
|
# original environment.conf had a manifest setting that is not the
|
181
181
|
# Puppet[:default_manifest].
|
182
|
-
# @api private
|
182
|
+
# @api private
|
183
183
|
def conflicting_manifest_settings?
|
184
184
|
return false if !Puppet[:disable_per_environment_manifest]
|
185
185
|
environment_conf = Puppet.lookup(:environments).get_conf(name)
|
@@ -318,13 +318,17 @@ class Puppet::Node::Environment
|
|
318
318
|
def modules_by_path
|
319
319
|
modules_by_path = {}
|
320
320
|
modulepath.each do |path|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
321
|
+
if Puppet::FileSystem.exist?(path)
|
322
|
+
Dir.chdir(path) do
|
323
|
+
module_names = Dir.entries(path).select do |name|
|
324
|
+
Puppet::Module.is_module_directory?(name, path)
|
325
|
+
end
|
326
|
+
modules_by_path[path] = module_names.sort.map do |name|
|
327
|
+
Puppet::Module.new(name, File.join(path, name), self)
|
328
|
+
end
|
327
329
|
end
|
330
|
+
else
|
331
|
+
modules_by_path[path] = []
|
328
332
|
end
|
329
333
|
end
|
330
334
|
modules_by_path
|