bolt 0.10.0 → 0.11.0

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.

Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bolt/cli.rb +43 -43
  3. data/lib/bolt/config.rb +25 -5
  4. data/lib/bolt/node.rb +3 -1
  5. data/lib/bolt/node/ssh.rb +15 -2
  6. data/lib/bolt/node/winrm.rb +20 -9
  7. data/lib/bolt/version.rb +1 -1
  8. data/modules/boltlib/lib/puppet/functions/run_plan.rb +1 -1
  9. data/modules/boltlib/lib/puppet/functions/run_task.rb +29 -32
  10. data/vendored/puppet/lib/puppet.rb +2 -5
  11. data/vendored/puppet/lib/puppet/application.rb +18 -1
  12. data/vendored/puppet/lib/puppet/application/agent.rb +8 -1
  13. data/vendored/puppet/lib/puppet/application/config.rb +1 -0
  14. data/vendored/puppet/lib/puppet/application/device.rb +1 -2
  15. data/vendored/puppet/lib/puppet/application/filebucket.rb +10 -2
  16. data/vendored/puppet/lib/puppet/application/help.rb +1 -0
  17. data/vendored/puppet/lib/puppet/application_support.rb +6 -1
  18. data/vendored/puppet/lib/puppet/configurer.rb +8 -3
  19. data/vendored/puppet/lib/puppet/defaults.rb +29 -9
  20. data/vendored/puppet/lib/puppet/environments.rb +2 -0
  21. data/vendored/puppet/lib/puppet/face/config.rb +14 -1
  22. data/vendored/puppet/lib/puppet/face/module/list.rb +1 -1
  23. data/vendored/puppet/lib/puppet/face/module/search.rb +4 -1
  24. data/vendored/puppet/lib/puppet/forge.rb +6 -0
  25. data/vendored/puppet/lib/puppet/functions/convert_to.rb +32 -0
  26. data/vendored/puppet/lib/puppet/gettext/config.rb +135 -37
  27. data/vendored/puppet/lib/puppet/gettext/module_translations.rb +42 -0
  28. data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +2 -0
  29. data/vendored/puppet/lib/puppet/module.rb +10 -18
  30. data/vendored/puppet/lib/puppet/network/http/factory.rb +9 -0
  31. data/vendored/puppet/lib/puppet/node/environment.rb +14 -0
  32. data/vendored/puppet/lib/puppet/parser/functions/sprintf.rb +17 -3
  33. data/vendored/puppet/lib/puppet/parser/scope.rb +11 -0
  34. data/vendored/puppet/lib/puppet/pops.rb +0 -1
  35. data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +13 -0
  36. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +39 -5
  37. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +64 -24
  38. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
  39. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +21 -70
  40. data/vendored/puppet/lib/puppet/pops/lookup/hiera_config.rb +2 -2
  41. data/vendored/puppet/lib/puppet/pops/parser/parser_support.rb +1 -1
  42. data/vendored/puppet/lib/puppet/pops/pcore.rb +43 -1
  43. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +4 -0
  44. data/vendored/puppet/lib/puppet/pops/types/types.rb +25 -5
  45. data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +5 -3
  46. data/vendored/puppet/lib/puppet/provider/service/smf.rb +2 -0
  47. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +14 -2
  48. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +1 -1
  49. data/vendored/puppet/lib/puppet/ssl/certificate_signer.rb +6 -0
  50. data/vendored/puppet/lib/puppet/ssl/host.rb +1 -1
  51. data/vendored/puppet/lib/puppet/type/file/checksum.rb +1 -1
  52. data/vendored/puppet/lib/puppet/type/file/checksum_value.rb +4 -3
  53. data/vendored/puppet/lib/puppet/type/k5login.rb +101 -0
  54. data/vendored/puppet/lib/puppet/type/tidy.rb +4 -2
  55. data/vendored/puppet/lib/puppet/util/checksums.rb +82 -1
  56. data/vendored/puppet/lib/puppet/util/command_line.rb +5 -0
  57. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
  58. data/vendored/puppet/lib/puppet_pal.rb +272 -11
  59. data/vendored/require_vendored.rb +0 -6
  60. metadata +8 -8
  61. data/vendored/puppet/lib/puppet/bindings.rb +0 -147
  62. data/vendored/puppet/lib/puppet/pops/types/task.rb +0 -116
@@ -3,9 +3,3 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'facter/lib'))
3
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'hiera/lib'))
4
4
 
5
5
  require 'puppet_pal'
6
-
7
- # This can be removed when BOLT-66 is implemented, so that puppet_pal
8
- # is the only entry point
9
- require 'puppet'
10
- require 'puppet/node/environment'
11
- require 'puppet/info_service'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2017-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -230,16 +230,16 @@ dependencies:
230
230
  name: puppetlabs_spec_helper
231
231
  requirement: !ruby/object:Gem::Requirement
232
232
  requirements:
233
- - - "~>"
233
+ - - '='
234
234
  - !ruby/object:Gem::Version
235
- version: '2.5'
235
+ version: 2.5.1
236
236
  type: :development
237
237
  prerelease: false
238
238
  version_requirements: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - "~>"
240
+ - - '='
241
241
  - !ruby/object:Gem::Version
242
- version: '2.5'
242
+ version: 2.5.1
243
243
  - !ruby/object:Gem::Dependency
244
244
  name: bundler
245
245
  requirement: !ruby/object:Gem::Requirement
@@ -513,7 +513,6 @@ files:
513
513
  - vendored/puppet/lib/puppet/application/script.rb
514
514
  - vendored/puppet/lib/puppet/application/status.rb
515
515
  - vendored/puppet/lib/puppet/application_support.rb
516
- - vendored/puppet/lib/puppet/bindings.rb
517
516
  - vendored/puppet/lib/puppet/coercion.rb
518
517
  - vendored/puppet/lib/puppet/compilable_resource_type.rb
519
518
  - vendored/puppet/lib/puppet/configurer.rb
@@ -632,6 +631,7 @@ files:
632
631
  - vendored/puppet/lib/puppet/functions/break.rb
633
632
  - vendored/puppet/lib/puppet/functions/call.rb
634
633
  - vendored/puppet/lib/puppet/functions/contain.rb
634
+ - vendored/puppet/lib/puppet/functions/convert_to.rb
635
635
  - vendored/puppet/lib/puppet/functions/crit.rb
636
636
  - vendored/puppet/lib/puppet/functions/debug.rb
637
637
  - vendored/puppet/lib/puppet/functions/defined.rb
@@ -683,6 +683,7 @@ files:
683
683
  - vendored/puppet/lib/puppet/generate/models/type/type.rb
684
684
  - vendored/puppet/lib/puppet/generate/type.rb
685
685
  - vendored/puppet/lib/puppet/gettext/config.rb
686
+ - vendored/puppet/lib/puppet/gettext/module_translations.rb
686
687
  - vendored/puppet/lib/puppet/gettext/stubs.rb
687
688
  - vendored/puppet/lib/puppet/graph.rb
688
689
  - vendored/puppet/lib/puppet/graph/key.rb
@@ -1100,7 +1101,6 @@ files:
1100
1101
  - vendored/puppet/lib/puppet/pops/types/ruby_generator.rb
1101
1102
  - vendored/puppet/lib/puppet/pops/types/ruby_method.rb
1102
1103
  - vendored/puppet/lib/puppet/pops/types/string_converter.rb
1103
- - vendored/puppet/lib/puppet/pops/types/task.rb
1104
1104
  - vendored/puppet/lib/puppet/pops/types/tree_iterators.rb
1105
1105
  - vendored/puppet/lib/puppet/pops/types/type_acceptor.rb
1106
1106
  - vendored/puppet/lib/puppet/pops/types/type_asserter.rb
@@ -1,147 +0,0 @@
1
- # This class allows registration of named bindings that are later contributed to a layer via
2
- # a binding scheme.
3
- #
4
- # The intended use is for a .rb file to be placed in confdir's or module's `lib/bindings` directory structure, with a
5
- # name corresponding to the symbolic bindings name.
6
- #
7
- # Here are two equivalent examples, the first using chained methods (which is compact for simple cases), and the
8
- # second which uses a block.
9
- #
10
- # @example MyModule's lib/bindings/mymodule/default.rb
11
- # Puppet::Bindings.newbindings('mymodule::default') do
12
- # bind.integer.named('meaning of life').to(42)
13
- # end
14
- #
15
- # @example Using blocks
16
- # Puppet::Bindings.newbindings('mymodule::default') do
17
- # bind do
18
- # integer
19
- # name 'meaning of life'
20
- # to 42
21
- # end
22
- # end
23
- #
24
- # If access is needed to the scope, this can be declared as a block parameter.
25
- # @example MyModule's lib/bindings/mymodule/default.rb with scope
26
- # Puppet::Bindings.newbindings('mymodule::default') do |scope|
27
- # bind.integer.named('meaning of life').to("#{scope['::fqdn']} also think it is 42")
28
- # end
29
- #
30
- # If late evaluation is wanted, this can be achieved by binding a puppet expression.
31
- # @example binding a puppet expression
32
- # Puppet::Bindings.newbindings('mymodule::default') do |scope|
33
- # bind.integer.named('meaning of life').to(puppet_string("${::fqdn} also think it is 42")
34
- # end
35
- #
36
- # It is allowed to define methods in the block given to `newbindings`, these can be used when
37
- # producing bindings. (Care should naturally be taken to not override any of the already defined methods).
38
- # @example defining method to be used while creating bindings
39
- # Puppet::Bindings.newbindings('mymodule::default') do
40
- # def square(x)
41
- # x * x
42
- # end
43
- # bind.integer.named('meaning of life squared').to(square(42))
44
- # end
45
- #
46
- # For all details see {Puppet::Pops::Binder::BindingsFactory}, which is used behind the scenes.
47
- # @api public
48
- #
49
- class Puppet::Bindings
50
- extend Enumerable
51
-
52
- Environment = Puppet::Node::Environment
53
-
54
- # Constructs and registers a {Puppet::Pops::Binder::Bindings::NamedBindings NamedBindings} that later can be contributed
55
- # to a bindings layer in a bindings configuration via a URI. The name is symbolic, fully qualified with module name, and at least one
56
- # more qualifying name (where the name `default` is used in the default bindings configuration.
57
- #
58
- # The given block is called with a `self` bound to an instance of {Puppet::Pops::Binder::BindingsFactory::BindingsContainerBuilder}
59
- # which most notably has a `#bind` method which it turn calls a block bound to an instance of
60
- # {Puppet::Pops::Binder::BindingsFactory::BindingsBuilder}.
61
- # Depending on the use-case a direct chaining method calls or nested blocks may be used.
62
- #
63
- # @example simple bindings
64
- # Puppet::Bindings.newbindings('mymodule::default') do
65
- # bind.name('meaning of life').to(42)
66
- # bind.integer.named('port').to(8080)
67
- # bind.integer.named('apache::port').to(8080)
68
- # end
69
- #
70
- # The block form is more suitable for longer, more complex forms of bindings.
71
- #
72
- def self.newbindings(name, &block)
73
- register_proc(name, block)
74
- end
75
-
76
- def self.register_proc(name, block)
77
- adapter = NamedBindingsAdapter.adapt(Puppet.lookup(:current_environment))
78
- adapter[name] = block
79
- end
80
-
81
- # Registers a named_binding under its name
82
- # @param named_bindings [Puppet::Pops::Binder::Bindings::NamedBindings] The named bindings to register.
83
- # @api public
84
- #
85
- def self.register(named_bindings)
86
- adapter = NamedBindingsAdapter.adapt(Puppet.lookup(:current_environment))
87
- adapter[named_bindings.name] = named_bindings
88
- end
89
-
90
- def self.resolve(scope, name)
91
- entry = get(name)
92
- return entry unless entry.is_a?(Proc)
93
- named_bindings = Puppet::Pops::Binder::BindingsFactory.safe_named_bindings(name, scope, &entry).model
94
- adapter = NamedBindingsAdapter.adapt(Puppet.lookup(:current_environment))
95
- adapter[named_bindings.name] = named_bindings
96
- named_bindings
97
- end
98
-
99
- # Returns the named bindings with the given name, or nil if no such bindings have been registered.
100
- # @param name [String] The fully qualified name of a binding to get
101
- # @return [Proc, Puppet::Pops::Binder::Bindings::NamedBindings] a Proc producing named bindings, or a named bindings directly
102
- # @api public
103
- #
104
- def self.get(name)
105
- adapter = NamedBindingsAdapter.adapt(Puppet.lookup(:current_environment))
106
- adapter[name]
107
- end
108
-
109
- def self.[](name)
110
- get(name)
111
- end
112
-
113
- # Supports Enumerable iteration (k,v) over the named bindings hash.
114
- def self.each
115
- adapter = NamedBindingsAdapter.adapt(Puppet.lookup(:current_environment))
116
- adapter.each_pair {|k,v| yield k,v }
117
- end
118
-
119
- # A NamedBindingsAdapter holds a map of name to Puppet::Pops::Binder::Bindings::NamedBindings.
120
- # It is intended to be used as an association between an Environment and named bindings.
121
- #
122
- class NamedBindingsAdapter < Puppet::Pops::Adaptable::Adapter
123
- def initialize()
124
- @named_bindings = {}
125
- end
126
-
127
- def [](name)
128
- @named_bindings[name]
129
- end
130
-
131
- def has_name?(name)
132
- @named_bindings.has_key?
133
- end
134
-
135
- def []=(name, value)
136
- unless value.is_a?(Puppet::Pops::Binder::Bindings::NamedBindings) || value.is_a?(Proc)
137
- raise ArgumentError, "Given value must be a NamedBindings, or a Proc producing one, got: #{value.class}."
138
- end
139
- @named_bindings[name] = value
140
- end
141
-
142
- def each_pair(&block)
143
- @named_bindings.each_pair(&block)
144
- end
145
- end
146
-
147
- end
@@ -1,116 +0,0 @@
1
- require 'json'
2
-
3
- module Puppet::Pops
4
- module Types
5
- # Ruby implementation of the Task Pcore type. It is the super type of a custom task that either has parameters
6
- # or explicitly declared that it has zero parameters (by providing an empty parameters clause).
7
- class Task
8
- include PuppetObject
9
-
10
- # Pattern used for task parameter names
11
- PARAMETER_NAME_PATTERN = PPatternType.new([PRegexpType.new(/\A[a-z][a-z0-9_]*\z/)])
12
-
13
- # Register the Task type with the Pcore loader and implementation registry
14
- def self.register_ptype(loader, ir)
15
- @type = Pcore::create_object_type(loader, ir, self, 'Task', nil, {
16
- 'supports_noop' => {
17
- 'type' => PBooleanType::DEFAULT,
18
- 'value' => false,
19
- 'kind' => 'constant'
20
- },
21
- 'input_method' => {
22
- 'type' => PStringType::DEFAULT,
23
- 'value' => 'both',
24
- 'kind' => 'constant'
25
- },
26
- 'executable' => {
27
- 'type' => PStringType::DEFAULT,
28
- 'kind' => 'constant',
29
- 'value' => ''
30
- },
31
- 'task_json' => {
32
- 'type' => PStringType::DEFAULT,
33
- 'kind' => 'derived'
34
- },
35
- })
36
- end
37
-
38
- def self._pcore_type
39
- @type
40
- end
41
-
42
- # Calculates the full path of the executable file. It is required that the type was loaded
43
- # using a file based loader
44
- # @return [String] The full path to the executable.
45
- def executable_path
46
- loader = _pcore_type.loader
47
- unless loader.is_a?(Loader::ModuleLoaders::FileBased)
48
- raise Puppet::Error,
49
- _('Absolute path of executable %{file} for task %{task} cannot be determined. This type was not loaded by a file based loader') %
50
- { :filename => executable, :task => _pcore_type.name }
51
- end
52
- File.join(loader.path, 'tasks', executable)
53
- end
54
-
55
- # Returns the parameters of this instance represented as a JSON string
56
- # @return [String] the JSON string representation of all parameter values
57
- def task_json
58
- # Convert this instance into Data and strip off the __pcore_type__ key. It's not
59
- # needed when executing the task
60
- rich_json = Serialization::ToDataConverter.convert(self, :rich_data => true)
61
- rich_json.delete('__pcore_type__')
62
- rich_json.to_json
63
- end
64
-
65
- # Returns the parameters of this instance as a Hash
66
- # @return [Hash] a map of attribute names to values as given when the instance of Task was created
67
- #
68
- def task_args()
69
- _pcore_init_hash
70
- end
71
- end
72
-
73
- # Ruby implementation of the GenericTask. It is a specialization of the Task Pcore type used as the super type
74
- # of custom task that lacks a 'parameters' definition (or lacks metadata altogether). This task accepts any
75
- # parameters and keeps them in an 'args' hash.
76
- class GenericTask < Task
77
- # Register the GenericTask type with the Pcore loader and implementation registry
78
- def self.register_ptype(loader, ir)
79
- @type = Pcore::create_object_type(loader, ir, self, 'GenericTask', 'Task', {
80
- 'args' => {
81
- 'type' => PHashType.new(PARAMETER_NAME_PATTERN, PTypeReferenceType.new('Data')),
82
- 'value' => EMPTY_HASH
83
- }
84
- })
85
- end
86
-
87
- def self._pcore_type
88
- @type
89
- end
90
-
91
- attr_reader :args
92
-
93
- def _pcore_init_hash
94
- { 'args' => args }
95
- end
96
-
97
- def initialize(args = EMPTY_HASH)
98
- @args = args
99
- end
100
-
101
- def task_json
102
- @args.to_json
103
- end
104
-
105
- def task_args()
106
- args
107
- end
108
-
109
- # Special to_s needed to cloak the 'attr' attribute and instead present
110
- # the hash
111
- def to_s
112
- "#{_pcore_type.name}(#{TypeFormatter.string(@args)})"
113
- end
114
- end
115
- end
116
- end