bolt 1.13.1 → 1.14.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfc3f29c5078b142ebcebf3b104d0b8c1deb2357c319f1de58c270062c7db68c
4
- data.tar.gz: '083d0c5d89a44757eb875c92d88e4378ea1922921aad4a225f8dda2b3e1cb0d5'
3
+ metadata.gz: a29df5e9c84d323a9d9b739bff71705573816f077ef68848cf7deb0fba373879
4
+ data.tar.gz: add9bd7f64f5cc1a61b237421f9973f2d9afe52dcb2fa3f89db1adf94270a93f
5
5
  SHA512:
6
- metadata.gz: f380074432d77f88c782dd725bc6f835c707de52266fb1c030a0b7490fd06af98b984d6f42bd1a02fde367d573ebf25a7fb1dfe6c5c643f613b8336444fb3f8e
7
- data.tar.gz: 70b9128e64a00ee9efab71ad69937b61fcd5ed54c6ee787054942e3b3fd16060e7dd34c23ab10e50b0c02969cc7b8a47f2fc0c25a65a0911144887baf4456fc3
6
+ metadata.gz: 58002395a520aa67a681c85efe894f98d7fb172eaebf11ddc15719c918d7479335d16ad181873d5ad9cd15a1151eb59551752e4d6f6ecdd5bd1e15335ab7ef83
7
+ data.tar.gz: 92fbc2af2713bc301e476de777067bca1f9d391c6a538e40e0907a7d7adb821cd8a0b5ba0a9da666b4799a4392bd783d7abcb846993c7f51c1baf923e18a80b8
@@ -37,7 +37,7 @@ Puppet::Functions.create_function(:apply_prep) do
37
37
  # Returns true if the target has the puppet-agent feature defined, either from inventory or transport.
38
38
  def agent?(target, executor, inventory)
39
39
  inventory.features(target).include?('puppet-agent') ||
40
- executor.transport(target.protocol).provided_features.include?('puppet-agent')
40
+ executor.transport(target.transport).provided_features.include?('puppet-agent') || target.remote?
41
41
  end
42
42
 
43
43
  def apply_prep(target_spec)
@@ -43,25 +43,38 @@ module Bolt
43
43
  @custom_facts_task ||= begin
44
44
  path = File.join(libexec, 'custom_facts.rb')
45
45
  file = { 'name' => 'custom_facts.rb', 'path' => path }
46
- metadata = { 'supports_noop' => true, 'input_method' => 'stdin' }
46
+ metadata = { 'supports_noop' => true, 'input_method' => 'stdin',
47
+ 'implementations' => [
48
+ { 'name' => 'custom_facts.rb' },
49
+ { 'name' => 'custom_facts.rb', 'remote' => true }
50
+ ] }
47
51
  Bolt::Task.new(name: 'apply_helpers::custom_facts', files: [file], metadata: metadata)
48
52
  end
49
53
  end
50
54
 
51
55
  def catalog_apply_task
52
56
  @catalog_apply_task ||= begin
53
- path = File.join(libexec, 'apply_catalog.rb')
54
- file = { 'name' => 'apply_catalog.rb', 'path' => path }
55
- metadata = { 'supports_noop' => true, 'input_method' => 'stdin' }
56
- Bolt::Task.new(name: 'apply_helpers::apply_catalog', files: [file], metadata: metadata)
57
- end
57
+ path = File.join(libexec, 'apply_catalog.rb')
58
+ file = { 'name' => 'apply_catalog.rb', 'path' => path }
59
+ metadata = { 'supports_noop' => true, 'input_method' => 'stdin',
60
+ 'implementations' => [
61
+ { 'name' => 'apply_catalog.rb' },
62
+ { 'name' => 'apply_catalog.rb', 'remote' => true }
63
+ ] }
64
+ Bolt::Task.new(name: 'apply_helpers::apply_catalog', files: [file], metadata: metadata)
65
+ end
58
66
  end
59
67
 
60
68
  def query_resources_task
61
69
  @query_resources_task ||= begin
62
70
  path = File.join(libexec, 'query_resources.rb')
63
71
  file = { 'name' => 'query_resources.rb', 'path' => path }
64
- metadata = { 'supports_noop' => true, 'input_method' => 'stdin' }
72
+ metadata = { 'supports_noop' => true, 'input_method' => 'stdin',
73
+ 'implementations' => [
74
+ { 'name' => 'query_resources.rb' },
75
+ { 'name' => 'query_resources.rb', 'remote' => true }
76
+ ] }
77
+
65
78
  Bolt::Task.new(name: 'apply_helpers::query_resources', files: [file], metadata: metadata)
66
79
  end
67
80
  end
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '1.13.1'
4
+ VERSION = '1.14.0'
5
5
  end
@@ -48,6 +48,31 @@ begin
48
48
  $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
49
49
  end
50
50
 
51
+ if (conn_info = args['_target'])
52
+ unless (type = conn_info['remote-transport'])
53
+ puts "Cannot execute a catalog for a remote target without knowing it's the remote-transport type."
54
+ exit 1
55
+ end
56
+
57
+ begin
58
+ require 'puppet/resource_api/transport'
59
+ rescue LoadError
60
+ msg = "Could not load 'puppet/resource_api/transport', puppet-resource_api "\
61
+ "gem version 1.8.0 or greater is required on the proxy target"
62
+ puts msg
63
+ exit 1
64
+ end
65
+
66
+ # Transport.connect will modify this hash!
67
+ transport_conn_info = conn_info.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ transport = Puppet::ResourceApi::Transport.connect(type, transport_conn_info)
70
+ Puppet::ResourceApi::Transport.inject_device(type, transport)
71
+
72
+ Puppet[:facts_terminus] = :network_device
73
+ Puppet[:certname] = conn_info['uri']
74
+ end
75
+
51
76
  # Ensure custom facts are available for provider suitability tests
52
77
  facts = Puppet::Node::Facts.indirection.find(SecureRandom.uuid, environment: env)
53
78
 
@@ -57,8 +82,11 @@ begin
57
82
  Puppet::Transaction::Report.new('apply')
58
83
  end
59
84
 
60
- Puppet.override(current_environment: env,
61
- loaders: Puppet::Pops::Loaders.new(env)) do
85
+ overrides = { current_environment: env,
86
+ loaders: Puppet::Pops::Loaders.new(env) }
87
+ overrides[:network_device] = true if args['_target']
88
+
89
+ Puppet.override(overrides) do
62
90
  catalog = Puppet::Resource::Catalog.from_data_hash(args['catalog'])
63
91
  catalog.environment = env.name.to_s
64
92
  catalog.environment_instance = env
@@ -29,7 +29,33 @@ Dir.mktmpdir do |puppet_root|
29
29
  $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
30
30
  end
31
31
 
32
+ if (conn_info = args['_target'])
33
+ unless (type = conn_info['remote-transport'])
34
+ puts "Cannot collect facts for a remote target without knowing the remote-transport type."
35
+ exit 1
36
+ end
37
+
38
+ begin
39
+ require 'puppet/resource_api/transport'
40
+ rescue LoadError
41
+ msg = "Could not load 'puppet/resource_api/transport', puppet-resource_api "\
42
+ "gem version 1.8.0 or greater is required on the proxy target"
43
+ puts msg
44
+ exit 1
45
+ end
46
+
47
+ # Transport.connect will modify this hash!
48
+ transport_conn_info = conn_info.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
49
+ transport = Puppet::ResourceApi::Transport.connect(type, transport_conn_info)
50
+ Puppet::ResourceApi::Transport.inject_device(type, transport)
51
+
52
+ Puppet[:facts_terminus] = :network_device
53
+ Puppet[:certname] = conn_info['uri']
54
+ end
55
+
32
56
  facts = Puppet::Node::Facts.indirection.find(SecureRandom.uuid, environment: env)
57
+
58
+ facts.name = facts.values['clientcert']
33
59
  puts(facts.values.to_json)
34
60
  end
35
61
 
@@ -36,6 +36,31 @@ Dir.mktmpdir do |puppet_root|
36
36
  $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
37
37
  end
38
38
 
39
+ if (conn_info = args['_target'])
40
+ unless (type = conn_info['remote-transport'])
41
+ puts "Cannot discover resources for a remote target without knowing it's the remote-transport type."
42
+ exit 1
43
+ end
44
+
45
+ begin
46
+ require 'puppet/resource_api/transport'
47
+ rescue LoadError
48
+ msg = "Could not load 'puppet/resource_api/transport', puppet-resource_api "\
49
+ "gem version 1.8.0 or greater is required on the proxy target"
50
+ puts msg
51
+ exit 1
52
+ end
53
+
54
+ # Transport.connect will modify this hash!
55
+ transport_conn_info = conn_info.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ transport = Puppet::ResourceApi::Transport.connect(type, transport_conn_info)
58
+ Puppet::ResourceApi::Transport.inject_device(type, transport)
59
+
60
+ Puppet[:facts_terminus] = :network_device
61
+ Puppet[:certname] = conn_info['uri']
62
+ end
63
+
39
64
  resources = args['resources'].flat_map do |resource_desc|
40
65
  if (match = RESOURCE_INSTANCE.match(resource_desc))
41
66
  Puppet::Resource.indirection.find("#{match[1]}/#{match[2]}", environment: env)
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: 1.13.1
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-07 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.3.1
131
+ version: '0.4'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.3.1
138
+ version: '0.4'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: puppet
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -162,14 +162,14 @@ dependencies:
162
162
  requirements:
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
- version: '0'
165
+ version: 1.8.1
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
- version: '0'
172
+ version: 1.8.1
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: r10k
175
175
  requirement: !ruby/object:Gem::Requirement