bolt 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +25 -13
- data/lib/bolt/cli.rb +45 -15
- data/lib/bolt/config.rb +48 -132
- data/lib/bolt/executor.rb +3 -10
- data/lib/bolt/inventory.rb +15 -1
- data/lib/bolt/puppetdb.rb +11 -0
- data/lib/bolt/puppetdb/client.rb +68 -0
- data/lib/bolt/puppetdb/config.rb +76 -0
- data/lib/bolt/target.rb +5 -4
- data/lib/bolt/transport/base.rb +11 -2
- data/lib/bolt/transport/local.rb +11 -5
- data/lib/bolt/transport/orch.rb +16 -5
- data/lib/bolt/transport/ssh.rb +32 -1
- data/lib/bolt/transport/ssh/connection.rb +17 -10
- data/lib/bolt/transport/winrm.rb +18 -1
- data/lib/bolt/transport/winrm/connection.rb +15 -16
- data/lib/bolt/util.rb +15 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_ext/puppetdb_inventory.rb +5 -135
- data/vendored/facter/lib/facter/ec2/rest.rb +1 -1
- data/vendored/hiera/lib/hiera/version.rb +1 -1
- data/vendored/puppet/lib/puppet/application/agent.rb +1 -3
- data/vendored/puppet/lib/puppet/application/apply.rb +2 -4
- data/vendored/puppet/lib/puppet/application/cert.rb +6 -1
- data/vendored/puppet/lib/puppet/application/device.rb +100 -13
- data/vendored/puppet/lib/puppet/application/facts.rb +5 -0
- data/vendored/puppet/lib/puppet/application/lookup.rb +11 -1
- data/vendored/puppet/lib/puppet/configurer.rb +17 -4
- data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +1 -1
- data/vendored/puppet/lib/puppet/datatypes.rb +1 -1
- data/vendored/puppet/lib/puppet/defaults.rb +1 -1
- data/vendored/puppet/lib/puppet/environments.rb +2 -2
- data/vendored/puppet/lib/puppet/error.rb +6 -3
- data/vendored/puppet/lib/puppet/external/dot.rb +0 -7
- data/vendored/puppet/lib/puppet/external/nagios/parser.rb +1 -1
- data/vendored/puppet/lib/puppet/face/config.rb +41 -8
- data/vendored/puppet/lib/puppet/face/epp.rb +30 -5
- data/vendored/puppet/lib/puppet/face/facts.rb +49 -0
- data/vendored/puppet/lib/puppet/face/help.rb +33 -35
- data/vendored/puppet/lib/puppet/face/man.rb +55 -12
- data/vendored/puppet/lib/puppet/face/parser.rb +30 -3
- data/vendored/puppet/lib/puppet/file_bucket/file.rb +0 -2
- data/vendored/puppet/lib/puppet/file_serving/base.rb +10 -10
- data/vendored/puppet/lib/puppet/functions.rb +1 -3
- data/vendored/puppet/lib/puppet/functions/alert.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/all.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/annotate.rb +10 -10
- data/vendored/puppet/lib/puppet/functions/any.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/assert_type.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/binary_file.rb +14 -2
- data/vendored/puppet/lib/puppet/functions/break.rb +31 -2
- data/vendored/puppet/lib/puppet/functions/call.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/contain.rb +19 -3
- data/vendored/puppet/lib/puppet/functions/convert_to.rb +6 -5
- data/vendored/puppet/lib/puppet/functions/crit.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/debug.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/defined.rb +11 -9
- data/vendored/puppet/lib/puppet/functions/dig.rb +26 -2
- data/vendored/puppet/lib/puppet/functions/each.rb +8 -8
- data/vendored/puppet/lib/puppet/functions/emerg.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/empty.rb +79 -0
- data/vendored/puppet/lib/puppet/functions/err.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/filter.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/find_file.rb +15 -1
- data/vendored/puppet/lib/puppet/functions/flatten.rb +64 -0
- data/vendored/puppet/lib/puppet/functions/hiera.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_array.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_include.rb +8 -8
- data/vendored/puppet/lib/puppet/functions/include.rb +28 -2
- data/vendored/puppet/lib/puppet/functions/info.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/inline_epp.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/join.rb +56 -0
- data/vendored/puppet/lib/puppet/functions/keys.rb +25 -0
- data/vendored/puppet/lib/puppet/functions/length.rb +44 -0
- data/vendored/puppet/lib/puppet/functions/lest.rb +39 -1
- data/vendored/puppet/lib/puppet/functions/map.rb +10 -9
- data/vendored/puppet/lib/puppet/functions/match.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/new.rb +995 -2
- data/vendored/puppet/lib/puppet/functions/next.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/notice.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/reduce.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/regsubst.rb +9 -3
- data/vendored/puppet/lib/puppet/functions/require.rb +36 -2
- data/vendored/puppet/lib/puppet/functions/return.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/reverse_each.rb +71 -2
- data/vendored/puppet/lib/puppet/functions/slice.rb +23 -9
- data/vendored/puppet/lib/puppet/functions/split.rb +12 -10
- data/vendored/puppet/lib/puppet/functions/step.rb +73 -1
- data/vendored/puppet/lib/puppet/functions/strftime.rb +176 -2
- data/vendored/puppet/lib/puppet/functions/then.rb +65 -2
- data/vendored/puppet/lib/puppet/functions/tree_each.rb +19 -19
- data/vendored/puppet/lib/puppet/functions/type.rb +42 -1
- data/vendored/puppet/lib/puppet/functions/unique.rb +13 -13
- data/vendored/puppet/lib/puppet/functions/unwrap.rb +8 -4
- data/vendored/puppet/lib/puppet/functions/values.rb +25 -0
- data/vendored/puppet/lib/puppet/functions/versioncmp.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/warning.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/with.rb +6 -4
- data/vendored/puppet/lib/puppet/indirector/certificate_status/file.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +1 -3
- data/vendored/puppet/lib/puppet/indirector/facts/rest.rb +21 -0
- data/vendored/puppet/lib/puppet/indirector/facts/yaml.rb +0 -4
- data/vendored/puppet/lib/puppet/indirector/file_content/http.rb +3 -1
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +5 -3
- data/vendored/puppet/lib/puppet/indirector/request.rb +6 -2
- data/vendored/puppet/lib/puppet/module/task.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/tar/mini.rb +57 -4
- data/vendored/puppet/lib/puppet/network/authconfig.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +1 -0
- data/vendored/puppet/lib/puppet/network/resolver.rb +1 -2
- data/vendored/puppet/lib/puppet/node.rb +4 -3
- data/vendored/puppet/lib/puppet/parser/compiler.rb +12 -5
- data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +15 -4
- data/vendored/puppet/lib/puppet/parser/functions/new.rb +31 -46
- data/vendored/puppet/lib/puppet/parser/parser_factory.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/type_loader.rb +11 -11
- data/vendored/puppet/lib/puppet/pops/evaluator/closure.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -2
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +18 -1
- data/vendored/puppet/lib/puppet/pops/issues.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +1 -2
- data/vendored/puppet/lib/puppet/pops/loader/ruby_function_instantiator.rb +1 -2
- data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +4 -4
- data/vendored/puppet/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/loaders.rb +18 -7
- data/vendored/puppet/lib/puppet/pops/lookup/global_data_provider.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/model/factory.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/model/pn_transformer.rb +400 -0
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/lexer_support.rb +3 -2
- data/vendored/puppet/lib/puppet/pops/parser/locator.rb +0 -2
- data/vendored/puppet/lib/puppet/pops/parser/pn_parser.rb +316 -0
- data/vendored/puppet/lib/puppet/pops/pcore.rb +17 -17
- data/vendored/puppet/lib/puppet/pops/pn.rb +236 -0
- data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/class_loader.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/types/implementation_registry.rb +28 -35
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -3
- data/vendored/puppet/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/types/p_type_set_type.rb +24 -1
- data/vendored/puppet/lib/puppet/pops/types/ruby_generator.rb +3 -4
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +0 -4
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +14 -7
- data/vendored/puppet/lib/puppet/pops/types/types.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/utils.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +6 -2
- data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +3 -1
- data/vendored/puppet/lib/puppet/provider/group/windows_adsi.rb +4 -7
- data/vendored/puppet/lib/puppet/provider/nameservice.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/dnf.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pacman.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/package/pip.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/pkgdmg.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/package/portage.rb +9 -9
- data/vendored/puppet/lib/puppet/provider/package/zypper.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/service/smf.rb +3 -2
- data/vendored/puppet/lib/puppet/provider/user/useradd.rb +6 -2
- data/vendored/puppet/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/zfs/zfs.rb +3 -2
- data/vendored/puppet/lib/puppet/reference/configuration.rb +2 -0
- data/vendored/puppet/lib/puppet/reference/type.rb +11 -11
- data/vendored/puppet/lib/puppet/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +2 -2
- data/vendored/puppet/lib/puppet/resource/catalog.rb +2 -2
- data/vendored/puppet/lib/puppet/resource/status.rb +9 -2
- data/vendored/puppet/lib/puppet/resource/type.rb +1 -1
- data/vendored/puppet/lib/puppet/settings.rb +31 -19
- data/vendored/puppet/lib/puppet/settings/base_setting.rb +5 -0
- data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
- data/vendored/puppet/lib/puppet/settings/ttl_setting.rb +5 -0
- data/vendored/puppet/lib/puppet/ssl/certificate_factory.rb +2 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +0 -2
- data/vendored/puppet/lib/puppet/transaction/additional_resource_generator.rb +2 -2
- data/vendored/puppet/lib/puppet/transaction/event.rb +1 -1
- data/vendored/puppet/lib/puppet/transaction/report.rb +1 -1
- data/vendored/puppet/lib/puppet/type.rb +9 -13
- data/vendored/puppet/lib/puppet/type/augeas.rb +2 -2
- data/vendored/puppet/lib/puppet/type/cron.rb +11 -6
- data/vendored/puppet/lib/puppet/type/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/type/file.rb +4 -5
- data/vendored/puppet/lib/puppet/type/host.rb +1 -1
- data/vendored/puppet/lib/puppet/type/k5login.rb +30 -54
- data/vendored/puppet/lib/puppet/type/package.rb +3 -3
- data/vendored/puppet/lib/puppet/type/schedule.rb +12 -12
- data/vendored/puppet/lib/puppet/type/scheduled_task.rb +2 -2
- data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +5 -5
- data/vendored/puppet/lib/puppet/type/sshkey.rb +2 -2
- data/vendored/puppet/lib/puppet/type/tidy.rb +9 -2
- data/vendored/puppet/lib/puppet/type/user.rb +1 -1
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +25 -4
- data/vendored/puppet/lib/puppet/type/zfs.rb +4 -0
- data/vendored/puppet/lib/puppet/util.rb +0 -4
- data/vendored/puppet/lib/puppet/util/backups.rb +1 -1
- data/vendored/puppet/lib/puppet/util/http_proxy.rb +4 -2
- data/vendored/puppet/lib/puppet/util/inifile.rb +3 -4
- data/vendored/puppet/lib/puppet/util/log.rb +2 -5
- data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/vendored/puppet/lib/puppet/util/reference.rb +1 -8
- data/vendored/puppet/lib/puppet/util/tagging.rb +1 -1
- data/vendored/puppet/lib/puppet/util/warnings.rb +0 -2
- data/vendored/puppet/lib/puppet/util/windows/adsi.rb +15 -18
- data/vendored/puppet/lib/puppet/util/windows/com.rb +2 -1
- data/vendored/puppet/lib/puppet/util/windows/file.rb +2 -2
- data/vendored/puppet/lib/puppet/util/windows/principal.rb +7 -6
- data/vendored/puppet/lib/puppet/util/windows/sid.rb +60 -7
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -9
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- data/vendored/puppet/lib/puppet_pal.rb +53 -48
- metadata +15 -2
@@ -1,4 +1,9 @@
|
|
1
1
|
require 'puppet/application/indirection_base'
|
2
2
|
|
3
3
|
class Puppet::Application::Facts < Puppet::Application::IndirectionBase
|
4
|
+
# Allows `puppet facts` actions to be run against environments that
|
5
|
+
# don't exist locally, such as using the `--environment` flag to make a REST
|
6
|
+
# request to a specific environment on a master. There is no way to set this
|
7
|
+
# behavior per-action, so it must be set for the face as a whole.
|
8
|
+
environment_mode :not_required
|
4
9
|
end
|
@@ -335,7 +335,17 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
335
335
|
Puppet.settings[:facts_terminus] = 'facter'
|
336
336
|
end
|
337
337
|
|
338
|
-
|
338
|
+
unless node.is_a?(Puppet::Node) # to allow unit tests to pass a node instance
|
339
|
+
ni = Puppet::Node.indirection
|
340
|
+
tc = ni.terminus_class
|
341
|
+
if tc == :plain || options[:compile]
|
342
|
+
node = ni.find(node)
|
343
|
+
else
|
344
|
+
ni.terminus_class = :plain
|
345
|
+
node = ni.find(node)
|
346
|
+
ni.terminus_class = tc
|
347
|
+
end
|
348
|
+
end
|
339
349
|
|
340
350
|
fact_file = options[:fact_file]
|
341
351
|
|
@@ -424,8 +424,13 @@ class Puppet::Configurer
|
|
424
424
|
def retrieve_catalog_from_cache(query_options)
|
425
425
|
result = nil
|
426
426
|
@duration = thinmark do
|
427
|
-
result = Puppet::Resource::Catalog.indirection.find(
|
428
|
-
|
427
|
+
result = Puppet::Resource::Catalog.indirection.find(
|
428
|
+
Puppet[:node_name_value],
|
429
|
+
query_options.merge(
|
430
|
+
:ignore_terminus => true,
|
431
|
+
:environment => Puppet::Node::Environment.remote(@environment)
|
432
|
+
)
|
433
|
+
)
|
429
434
|
end
|
430
435
|
result
|
431
436
|
rescue => detail
|
@@ -436,8 +441,16 @@ class Puppet::Configurer
|
|
436
441
|
def retrieve_new_catalog(query_options)
|
437
442
|
result = nil
|
438
443
|
@duration = thinmark do
|
439
|
-
result = Puppet::Resource::Catalog.indirection.find(
|
440
|
-
|
444
|
+
result = Puppet::Resource::Catalog.indirection.find(
|
445
|
+
Puppet[:node_name_value],
|
446
|
+
query_options.merge(
|
447
|
+
:ignore_cache => true,
|
448
|
+
# We never want to update the cached Catalog if we're running in noop mode.
|
449
|
+
:ignore_cache_save => Puppet[:noop],
|
450
|
+
:environment => Puppet::Node::Environment.remote(@environment),
|
451
|
+
:fail_on_404 => true
|
452
|
+
)
|
453
|
+
)
|
441
454
|
end
|
442
455
|
result
|
443
456
|
rescue StandardError => detail
|
@@ -169,7 +169,7 @@ module Puppet::DataTypes
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
else
|
172
|
-
Puppet::Pops::Loaders.implementation_registry.register_implementation(created_type, @implementation_class
|
172
|
+
Puppet::Pops::Loaders.implementation_registry.register_implementation(created_type, @implementation_class)
|
173
173
|
end
|
174
174
|
created_type.implementation_class = @implementation_class
|
175
175
|
elsif !@implementation.nil?
|
@@ -115,7 +115,7 @@ module Puppet::Environments
|
|
115
115
|
def get_conf(name)
|
116
116
|
env = get(name)
|
117
117
|
if env
|
118
|
-
Puppet::Settings::EnvironmentConf.static_for(env,
|
118
|
+
Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
|
119
119
|
else
|
120
120
|
nil
|
121
121
|
end
|
@@ -314,7 +314,7 @@ module Puppet::Environments
|
|
314
314
|
end
|
315
315
|
|
316
316
|
# Returns the end of time (the next Mesoamerican Long Count cycle-end after 2012 (5125+2012) = 7137,
|
317
|
-
#
|
317
|
+
# or for a 32 bit machine using Ruby < 1.9.3, the year 2038.
|
318
318
|
def self.end_of_time
|
319
319
|
begin
|
320
320
|
Time.gm(7137)
|
@@ -46,7 +46,7 @@ module Puppet
|
|
46
46
|
|
47
47
|
# Contains an issue code and can be annotated with an environment and a node
|
48
48
|
class ParseErrorWithIssue < Puppet::ParseError
|
49
|
-
attr_reader :issue_code, :basic_message
|
49
|
+
attr_reader :issue_code, :basic_message, :arguments
|
50
50
|
attr_accessor :environment, :node
|
51
51
|
|
52
52
|
# @param message [String] The error message
|
@@ -55,11 +55,13 @@ module Puppet
|
|
55
55
|
# @param pos [Integer] The position on the line
|
56
56
|
# @param original [Exception] Original exception
|
57
57
|
# @param issue_code [Symbol] The issue code
|
58
|
+
# @param arguments [Hash{Symbol=>Object}] Issue arguments
|
58
59
|
#
|
59
|
-
def initialize(message, file=nil, line=nil, pos=nil, original=nil, issue_code= nil)
|
60
|
+
def initialize(message, file=nil, line=nil, pos=nil, original=nil, issue_code= nil, arguments = nil)
|
60
61
|
super(message, file, line, pos, original)
|
61
62
|
@issue_code = issue_code
|
62
63
|
@basic_message = message
|
64
|
+
@arguments = arguments
|
63
65
|
end
|
64
66
|
|
65
67
|
def to_s
|
@@ -83,7 +85,8 @@ module Puppet
|
|
83
85
|
line,
|
84
86
|
nil,
|
85
87
|
nil,
|
86
|
-
issue.issue_code
|
88
|
+
issue.issue_code,
|
89
|
+
args)
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
@@ -181,9 +181,6 @@ module DOT
|
|
181
181
|
# node element
|
182
182
|
|
183
183
|
class DOTNode < DOTElement
|
184
|
-
|
185
|
-
@ports
|
186
|
-
|
187
184
|
def initialize (params = {}, option_list = NODE_OPTS)
|
188
185
|
super(params, option_list)
|
189
186
|
@ports = params['ports'] ? params['ports'] : []
|
@@ -235,10 +232,6 @@ module DOT
|
|
235
232
|
# notation.
|
236
233
|
|
237
234
|
class DOTSubgraph < DOTElement
|
238
|
-
|
239
|
-
@nodes
|
240
|
-
@dot_string
|
241
|
-
|
242
235
|
def initialize (params = {}, option_list = GRAPH_OPTS)
|
243
236
|
super(params, option_list)
|
244
237
|
@nodes = params['nodes'] ? params['nodes'] : []
|
@@ -56,8 +56,9 @@ Puppet::Face.define(:config, '0.0.1') do
|
|
56
56
|
|
57
57
|
when_invoked do |*args|
|
58
58
|
options = args.pop
|
59
|
+
render_all_settings = args.empty? || args == ['all']
|
59
60
|
|
60
|
-
args = Puppet.settings.to_a.collect(&:first) if
|
61
|
+
args = Puppet.settings.to_a.collect(&:first) if render_all_settings
|
61
62
|
|
62
63
|
values_from_the_selected_section =
|
63
64
|
Puppet.settings.values(nil, options[:section].to_sym)
|
@@ -67,21 +68,53 @@ Puppet::Face.define(:config, '0.0.1') do
|
|
67
68
|
:basemodulepath => values_from_the_selected_section.interpolate(:basemodulepath),
|
68
69
|
}
|
69
70
|
|
71
|
+
to_be_rendered = nil
|
70
72
|
Puppet.override(Puppet.base_context(loader_settings),
|
71
73
|
_("New environment loaders generated from the requested section.")) do
|
72
74
|
# And now we can lookup values that include those from environments configured from
|
73
75
|
# the requested section
|
74
76
|
values = Puppet.settings.values(Puppet[:environment].to_sym, options[:section].to_sym)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
puts "#{setting_name} = #{values.interpolate(setting_name.to_sym)}"
|
80
|
-
end
|
77
|
+
|
78
|
+
to_be_rendered = {}
|
79
|
+
args.sort.each do |setting_name|
|
80
|
+
to_be_rendered[setting_name] = values.print(setting_name.to_sym)
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
|
+
# convert symbols to strings before formatting output
|
85
|
+
if render_all_settings
|
86
|
+
to_be_rendered = stringifyhash(to_be_rendered)
|
87
|
+
end
|
88
|
+
to_be_rendered
|
89
|
+
end
|
90
|
+
|
91
|
+
when_rendering :console do |to_be_rendered|
|
92
|
+
output = ''
|
93
|
+
if to_be_rendered.keys.length > 1
|
94
|
+
to_be_rendered.keys.sort.each do |setting|
|
95
|
+
output << "#{setting} = #{to_be_rendered[setting]}\n"
|
96
|
+
end
|
97
|
+
else
|
98
|
+
output << "#{to_be_rendered.to_a[0].last}\n"
|
99
|
+
end
|
100
|
+
|
101
|
+
output
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def stringifyhash(hash)
|
106
|
+
newhash = {}
|
107
|
+
hash.each do |key, val|
|
108
|
+
key = key.to_s
|
109
|
+
if val.is_a? Hash
|
110
|
+
newhash[key] = stringifyhash(val)
|
111
|
+
elsif val.is_a? Symbol
|
112
|
+
newhash[key] = val.to_s
|
113
|
+
else
|
114
|
+
newhash[key] = val
|
115
|
+
end
|
84
116
|
end
|
117
|
+
newhash
|
85
118
|
end
|
86
119
|
|
87
120
|
action(:set) do
|
@@ -104,13 +104,19 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
104
104
|
|
105
105
|
action (:dump) do
|
106
106
|
summary _("Outputs a dump of the internal template parse tree for debugging")
|
107
|
-
arguments "-e <source> | [<templates> ...] "
|
107
|
+
arguments "[--format <old|pn|json>] [--pretty] { -e <source> | [<templates> ...] } "
|
108
108
|
returns _("A dump of the resulting AST model unless there are syntax or validation errors.")
|
109
109
|
description <<-'EOT'
|
110
110
|
The dump action parses and validates the EPP syntax and dumps the resulting AST model
|
111
111
|
in a human readable (but not necessarily an easy to understand) format.
|
112
|
-
|
113
|
-
|
112
|
+
|
113
|
+
The output format can be controlled using the --format <old|pn|json> where:
|
114
|
+
* 'old' is the default, but now deprecated format which is not API.
|
115
|
+
* 'pn' is the Puppet Extended S-Expression Notation.
|
116
|
+
* 'json' outputs the same graph as 'pn' but with JSON syntax.
|
117
|
+
|
118
|
+
The output will be "pretty printed" when the option --pretty is given together with --format 'pn' or 'json'.
|
119
|
+
This option has no effect on the 'old' format.
|
114
120
|
|
115
121
|
The command accepts one or more templates (.epp) files, or an -e followed by the template
|
116
122
|
source text. The given templates can be paths to template files, or references
|
@@ -137,6 +143,14 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
137
143
|
summary _("Whether or not to validate the parsed result, if no-validate only syntax errors are reported.")
|
138
144
|
end
|
139
145
|
|
146
|
+
option('--format ' + _('<old, pn, or json>')) do
|
147
|
+
summary _("Get result in 'old' (deprecated format), 'pn' (new format), or 'json' (new format in JSON).")
|
148
|
+
end
|
149
|
+
|
150
|
+
option('--pretty') do
|
151
|
+
summary _('Pretty print output. Only applicable together with --format pn or json')
|
152
|
+
end
|
153
|
+
|
140
154
|
option("--[no-]header") do
|
141
155
|
summary _("Whether or not to show a file name header between files.")
|
142
156
|
end
|
@@ -353,7 +367,6 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
353
367
|
|
354
368
|
def dump_parse(source, filename, options, show_filename = true)
|
355
369
|
output = ""
|
356
|
-
dumper = Puppet::Pops::Model::ModelTreeDumper.new
|
357
370
|
evaluating_parser = Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.new
|
358
371
|
begin
|
359
372
|
if options[:validate]
|
@@ -365,7 +378,19 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
365
378
|
if show_filename && options[:header]
|
366
379
|
output << "--- #{filename}\n"
|
367
380
|
end
|
368
|
-
|
381
|
+
fmt = options[:format]
|
382
|
+
if fmt.nil? || fmt == 'old'
|
383
|
+
output << Puppet::Pops::Model::ModelTreeDumper.new.dump(parse_result) << "\n"
|
384
|
+
else
|
385
|
+
require 'puppet/pops/pn'
|
386
|
+
pn = Puppet::Pops::Model::PNTransformer.transform(parse_result)
|
387
|
+
case fmt
|
388
|
+
when 'json'
|
389
|
+
options[:pretty] ? JSON.pretty_unparse(pn.to_data) : JSON.dump(pn.to_data)
|
390
|
+
else
|
391
|
+
pn.format(options[:pretty] ? Puppet::Pops::PN::Indent.new(' ') : nil, output)
|
392
|
+
end
|
393
|
+
end
|
369
394
|
rescue Puppet::ParseError => detail
|
370
395
|
if show_filename
|
371
396
|
Puppet.err("--- #{filename}")
|
@@ -35,4 +35,53 @@ Puppet::Indirector::Face.define(:facts, '0.0.1') do
|
|
35
35
|
|
36
36
|
deactivate_action(:destroy)
|
37
37
|
deactivate_action(:search)
|
38
|
+
|
39
|
+
action(:upload) do
|
40
|
+
summary _("Upload local facts to the puppet master.")
|
41
|
+
description <<-'EOT'
|
42
|
+
Reads facts from the local system using the `facter` terminus, then
|
43
|
+
saves the returned facts using the rest terminus.
|
44
|
+
EOT
|
45
|
+
returns "Nothing."
|
46
|
+
notes <<-'EOT'
|
47
|
+
This action requires that the puppet master's `auth.conf` file
|
48
|
+
allow `PUT` or `save` access to the `/puppet/v3/facts` API endpoint.
|
49
|
+
|
50
|
+
For details on configuring Puppet Server's `auth.conf`, see:
|
51
|
+
|
52
|
+
<https://puppet.com/docs/puppetserver/latest/config_file_auth.html>
|
53
|
+
|
54
|
+
For legacy Rack-based Puppet Masters, see:
|
55
|
+
|
56
|
+
<https://puppet.com/docs/puppet/latest/config_file_auth.html>
|
57
|
+
EOT
|
58
|
+
examples <<-'EOT'
|
59
|
+
Upload facts:
|
60
|
+
|
61
|
+
$ puppet facts upload
|
62
|
+
EOT
|
63
|
+
|
64
|
+
render_as :json
|
65
|
+
|
66
|
+
when_invoked do |options|
|
67
|
+
# Use `agent` sections settings for certificates, Puppet Server URL,
|
68
|
+
# etc. instead of `user` section settings.
|
69
|
+
Puppet.settings.preferred_run_mode = :agent
|
70
|
+
Puppet::Node::Facts.indirection.terminus_class = :facter
|
71
|
+
|
72
|
+
facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
|
73
|
+
unless Puppet[:node_name_fact].empty?
|
74
|
+
Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
|
75
|
+
facts.name = Puppet[:node_name_value]
|
76
|
+
end
|
77
|
+
|
78
|
+
Puppet::Node::Facts.indirection.terminus_class = :rest
|
79
|
+
server = Puppet::Node::Facts::Rest.server
|
80
|
+
Puppet.notice(_("Uploading facts for '%{node}' to: '%{server}'") % {
|
81
|
+
node: Puppet[:node_name_value],
|
82
|
+
server: server})
|
83
|
+
|
84
|
+
Puppet::Node::Facts.indirection.save(facts)
|
85
|
+
end
|
86
|
+
end
|
38
87
|
end
|
@@ -26,47 +26,33 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
26
26
|
|
27
27
|
default
|
28
28
|
when_invoked do |*args|
|
29
|
-
# Check our invocation, because we want varargs and can't do defaults
|
30
|
-
# yet. REVISIT: when we do option defaults, and positional options, we
|
31
|
-
# should rewrite this to use those. --daniel 2011-04-04
|
32
29
|
options = args.pop
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
xtuevmh0m7xp6eoswin70khm5nrggkui6z8vdjnrgdqeojq40fya5qexk97g4d8qgw0hvokr
|
42
|
-
pli1biaz503grqf2ycy0ppkhz1hwhl6ifbpet7xd6jjepq4oe0ofl575lxdzjeg25217zyl4
|
43
|
-
nokn6tj5pq7gcdsjre75rqylydh7iia7s3yrko4f5ud9v8hdtqhu60stcitirvfj6zphppmx
|
44
|
-
7wfm7i9641d00bhs44n6vh6qvx39pg3urifgr6ihx3e0j1ychzypunyou7iplevitkyg6gbg
|
45
|
-
wm08oy1rvogcjakkqc1f7y1awdfvlb4ego8wrtgu9vzw4vmj59utwifn2ejcs569dh1oaavi
|
46
|
-
sc581n7jjg1dugzdu094fdobtx6rsvk3sfctvqnr36xctold
|
47
|
-
EOT
|
48
|
-
353.times{i,x=i.divmod(1184);a,b=x.divmod(37);print(c[a]*b)}
|
49
|
-
end
|
50
|
-
raise ArgumentError, _("Puppet help only takes two (optional) arguments: a subcommand and an action")
|
30
|
+
|
31
|
+
if default_case?(args) || help_for_help?(args)
|
32
|
+
return erb('global.erb').result(binding)
|
33
|
+
end
|
34
|
+
|
35
|
+
if args.length > 2
|
36
|
+
#TRANSLATORS 'puppet help' is a command line and should not be translated
|
37
|
+
raise ArgumentError, _("The 'puppet help' command takes two (optional) arguments: a subcommand and an action")
|
51
38
|
end
|
52
39
|
|
53
40
|
version = :current
|
54
|
-
if options.has_key? :version
|
55
|
-
if options[:version].to_s !~ /^current$/i
|
41
|
+
if options.has_key? :version
|
42
|
+
if options[:version].to_s !~ /^current$/i
|
56
43
|
version = options[:version]
|
57
44
|
else
|
58
|
-
if args.length == 0
|
59
|
-
|
45
|
+
if args.length == 0
|
46
|
+
#TRANSLATORS '--version' is a command line option and should not be translated
|
47
|
+
raise ArgumentError, _("Supplying a '--version' only makes sense when a Faces subcommand is given")
|
60
48
|
end
|
61
49
|
end
|
62
50
|
end
|
63
51
|
|
64
|
-
return erb('global.erb').result(binding) if args.empty?
|
65
|
-
|
66
52
|
facename, actionname = args
|
67
|
-
if legacy_applications.include? facename
|
68
|
-
if actionname
|
69
|
-
raise ArgumentError, _("
|
53
|
+
if legacy_applications.include? facename
|
54
|
+
if actionname
|
55
|
+
raise ArgumentError, _("The legacy subcommand '%{sub_command}' does not support supplying an action") % { sub_command: facename }
|
70
56
|
end
|
71
57
|
return render_application_help(facename)
|
72
58
|
else
|
@@ -75,6 +61,14 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
75
61
|
end
|
76
62
|
end
|
77
63
|
|
64
|
+
def default_case?(args)
|
65
|
+
args.empty?
|
66
|
+
end
|
67
|
+
|
68
|
+
def help_for_help?(args)
|
69
|
+
args.length == 1 && args.first == 'help'
|
70
|
+
end
|
71
|
+
|
78
72
|
def render_application_help(applicationname)
|
79
73
|
return Puppet::Application[applicationname].help
|
80
74
|
rescue StandardError, LoadError => detail
|
@@ -102,7 +96,7 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
102
96
|
face = Puppet::Face[facename.to_sym, version]
|
103
97
|
if actionname
|
104
98
|
action = face.get_action(actionname.to_sym)
|
105
|
-
if
|
99
|
+
if ! action
|
106
100
|
fail ArgumentError, _("Unable to load action %{actionname} from %{face}") % { actionname: actionname, face: face }
|
107
101
|
end
|
108
102
|
end
|
@@ -145,10 +139,12 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
145
139
|
begin
|
146
140
|
face = Puppet::Face[appname, :current]
|
147
141
|
# Add deprecation message to summary if the face is deprecated
|
148
|
-
summary = face.deprecated? ? face.summary + _("
|
142
|
+
summary = face.deprecated? ? face.summary + ' ' + _("(Deprecated)") : face.summary
|
149
143
|
result << [appname, summary]
|
150
144
|
rescue StandardError, LoadError
|
151
|
-
|
145
|
+
error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
|
146
|
+
error_message += ' ' + _("Check error logs.")
|
147
|
+
result << [ error_message ]
|
152
148
|
end
|
153
149
|
else
|
154
150
|
begin
|
@@ -158,7 +154,9 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
158
154
|
end
|
159
155
|
result << [appname, summary]
|
160
156
|
rescue StandardError, LoadError
|
161
|
-
|
157
|
+
error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
|
158
|
+
error_message += ' ' + _("Check error logs.")
|
159
|
+
result << [ error_message ]
|
162
160
|
end
|
163
161
|
end
|
164
162
|
end
|
@@ -171,7 +169,7 @@ Puppet::Face.define(:help, '0.0.1') do
|
|
171
169
|
# formatted. If we can't match the pattern we expect we return the empty
|
172
170
|
# string to ensure we don't blow up in the summary. --daniel 2011-04-11
|
173
171
|
while line = help.shift do
|
174
|
-
if md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line)
|
172
|
+
if md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line)
|
175
173
|
return md[1]
|
176
174
|
end
|
177
175
|
end
|