vagrant-bolt 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5fba8cd90a1ba29c44dd28d5a1d7d6de8c8276a742386b1f24eacc900e638fc
4
- data.tar.gz: 75713e7c5c1f6b1c5e8338ec9a9012188258224c049b22ea8c929fffa15772bd
3
+ metadata.gz: ac8831c37dc6fd0c0e551015f54ba1cb85e0c0ef6d264d5767429e84d7ad2a45
4
+ data.tar.gz: 63ee832a3448361a91433d54d89484f1a3916f349bac2313602e478b1e4840f3
5
5
  SHA512:
6
- metadata.gz: 469933d26046b905881486ad771febef1310b6a99dc3911df6075ea28b1a62e8e262bb2202c327b837e195b0977548afee47d73b3b63651f760c806ad37badc0
7
- data.tar.gz: 0bb43ca82eef7a6aac4a5cbabec09130f9d8d81d19aa3155db7154fbf24174c7bf9c8a18494e162646d9e747c7ecd64ddb7b5fb4e7cd5246a6fdd8fd3d19e30b
6
+ metadata.gz: d12d5842671a0c5d49991d96d00ec6ff1e4242b22b64a49e5634ec341bb6168e96d7fcd56193d622301748eeb1a7039d4cbf79bfc45751cb80d4e9fa394c63bf
7
+ data.tar.gz: b85ae2521973b7c65c3be2aa0539ea78a6a6baf5728dd43eb4573ac5d77d9d9aaee0a491ba4d5326ef828a61f90890b954c87d8accec5ab12c181ad73db788e0
data/.gitignore CHANGED
@@ -12,4 +12,6 @@ Gemfile.local
12
12
  *.bak
13
13
  .vagrant
14
14
  /modules
15
+ /site-modules
15
16
  *.box
17
+ *.rerun.json
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Change Log
2
+
3
+ ## [0.1.1](https://github.com/oscar-stack/vagrant-bolt/tree/0.1.1) (2019-07-01)
4
+ [Full Changelog](https://github.com/oscar-stack/vagrant-bolt/compare/v0.1.0...0.1.1)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Add changelog generation [\#9](https://github.com/oscar-stack/vagrant-bolt/pull/9) ([jarretlavallee](https://github.com/jarretlavallee))
9
+ - Clean up command line arguments and paths [\#8](https://github.com/oscar-stack/vagrant-bolt/pull/8) ([jarretlavallee](https://github.com/jarretlavallee))
10
+ - Add connect\_timeout option to inventory [\#7](https://github.com/oscar-stack/vagrant-bolt/pull/7) ([jarretlavallee](https://github.com/jarretlavallee))
11
+
12
+ ## [v0.1.0](https://github.com/oscar-stack/vagrant-bolt/tree/v0.1.0) (2018-12-11)
13
+ **Merged pull requests:**
14
+
15
+ - \(SUP-874\) Add a command line interface [\#6](https://github.com/oscar-stack/vagrant-bolt/pull/6) ([jarretlavallee](https://github.com/jarretlavallee))
16
+ - Add Support for config\_builder bolt triggers [\#5](https://github.com/oscar-stack/vagrant-bolt/pull/5) ([jarretlavallee](https://github.com/jarretlavallee))
17
+ - Add Config Options and cleanup some bad code [\#4](https://github.com/oscar-stack/vagrant-bolt/pull/4) ([jarretlavallee](https://github.com/jarretlavallee))
18
+ - Consolidate files and add some spec tests [\#3](https://github.com/oscar-stack/vagrant-bolt/pull/3) ([jarretlavallee](https://github.com/jarretlavallee))
19
+ - Add the ability to use triggers and provisioners [\#2](https://github.com/oscar-stack/vagrant-bolt/pull/2) ([jarretlavallee](https://github.com/jarretlavallee))
20
+ - Initial Implementation [\#1](https://github.com/oscar-stack/vagrant-bolt/pull/1) ([jarretlavallee](https://github.com/jarretlavallee))
21
+
22
+
23
+
24
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile CHANGED
@@ -15,6 +15,7 @@ group :development do
15
15
  gem 'rubocop'
16
16
  gem 'rubocop-rspec'
17
17
  gem 'yard', '~> 0.9.16'
18
+ gem 'github_changelog_generator'
18
19
  end
19
20
 
20
21
  group :test do
data/Puppetfile CHANGED
@@ -2,6 +2,4 @@
2
2
 
3
3
  forge "http://forge.puppetlabs.com"
4
4
 
5
- moduledir File.join(File.dirname(__FILE__), 'modules')
6
-
7
5
  mod 'puppetlabs-facts', '0.3.1'
data/README.md CHANGED
@@ -166,7 +166,7 @@ The methods for a bolt command in a trigger allow for a task, plan, or command.
166
166
  * Required: `machine` The machine object
167
167
  * Optional: `**args` A hash of [Plugin Settings](#plugin-settings) which override any previous config
168
168
 
169
- Example of the arguments can be seen below.
169
+ An example of the arguments can be seen below.
170
170
 
171
171
  Run the `facts` task using a specific user and password.
172
172
 
@@ -248,6 +248,8 @@ The settings available in the triggers and the provisioner are the same.
248
248
  * Default: The port that vagrant uses to connect to the machine
249
249
  * `sudo_password`
250
250
  * Description: A string containing the password bolt will use to escalate privileges on the machine
251
+ * `connect_timeout`
252
+ * Description: A string which controls if the connection timeout for ssh (linux)
251
253
  * `host_key_check`
252
254
  * Description: A boolean which controls if the connection should check the host key on the remote host (linux)
253
255
  * Default: `false`
@@ -260,7 +262,6 @@ The settings available in the triggers and the provisioner are the same.
260
262
  * Description: A boolean which controls if the connection should verify SSL on with WinRM (Windows)
261
263
  * `modulepath`
262
264
  * Description: A string containing the path to bolt modules
263
- * Default: `modules` in the vagrant root
264
265
  * `tmpdir`
265
266
  * Description: A string containing the directory to upload and execute temporary files on the target
266
267
  * `verbose`
@@ -311,10 +312,10 @@ vms:
311
312
 
312
313
  ### Trigger Configuration
313
314
 
314
- Bolt triggers cab be configured at the root or within a VM object. To configure a bolt trigger a few additional params are required.
315
+ Bolt triggers cab be configured at the root or within a VM object. To configure a bolt trigger a few additional params are required.
315
316
 
316
317
  * `trigger_type`
317
- * Description: A symbol of the trigger type.
318
+ * Description: A symbol of the trigger type.
318
319
  * Valid Values: `:before` or `:after`
319
320
  * `trigger_commands`
320
321
  * Description: An array of symbols for the commands to run the trigger on
@@ -366,7 +367,7 @@ Options:
366
367
  -u, --[no-]updateinventory Update the inventory file (defaults to false)
367
368
  ~~~
368
369
 
369
- The command can be used to deploy the Puppetfile, for example.
370
+ The command can be used to deploy the Puppetfile, for example.
370
371
 
371
372
  ~~~shell
372
373
  vagrant bolt puppetfile install
@@ -380,7 +381,7 @@ vagrant bolt -u task run facts -n server
380
381
 
381
382
  The `--updateinventory` flag will regenerate the inventory file from the active running machines, however it defaults to being off. In the example above, the inventory file will be updated prior to running the task.
382
383
 
383
- All arguments except for the `-u` will be passed to bolt, so a bolt command like the exaple below can be run.
384
+ All arguments except for the `-u` will be passed to bolt, so a bolt command like the example below can be run.
384
385
 
385
386
  ~~~shell
386
387
  vagrant bolt command run 'date' -n agent,master
@@ -389,7 +390,7 @@ vagrant bolt command run 'date' -n agent,master
389
390
  Other Use Cases
390
391
  ---------------
391
392
 
392
- There are some other use cases for Vagrant Bolt. One of which is to not use the triggers or provisioning to run bolt commands on the nodes, but to manage the inventory file for manual testing. This can easily be accomplished by using a trigger to manage the `inventory.yaml` file and specifying the configuration for the nodes in the config based on the options above. Below is an example trigger that will manage a `./inventory.yaml` file for use with external bolt commands.
393
+ There are some other use cases for Vagrant Bolt. One of which is to not use the triggers or provisioning to run bolt commands on the nodes, but to manage the inventory file for manual testing. This can easily be accomplished by using a trigger to manage the `inventory.yaml` file and specifying the configuration for the nodes in the config based on the options above. Below is an example trigger that will manage a `./inventory.yaml` file for use with external bolt commands.
393
394
 
394
395
  ~~~ruby
395
396
  require 'vagrant-bolt'
@@ -422,10 +423,10 @@ Requirements
422
423
  ------------
423
424
 
424
425
  * Vagrant 2.2.0+ is required for this plugin.
425
- * Bolt 1.5+ needs to be installed on the platform machine and accessible on the path. Use the `bolt_exe` config parameter if it is not on the path.
426
+ * Bolt 1.10+ needs to be installed on the platform machine and accessible on the path. Use the `bolt_exe` config parameter if it is not on the path.
426
427
  * Ruby 2.3+
427
428
 
428
429
  Known Issues
429
430
  ------------
430
431
 
431
- * Machine names with hyphens in them are not valid in bolt 1.5.0. This is because of <https://tickets.puppetlabs.com/browse/BOLT-1022>.
432
+ * Machine names with hyphens in them are not valid until bolt 1.10.0. Please upgrade to Bolt 1.10.0+ to use hyphens in the machine names.
@@ -42,20 +42,17 @@ class VagrantBolt::Command < Vagrant.plugin('2', :command)
42
42
  execute_bolt_command(bolt_args)
43
43
  end
44
44
 
45
- # Run a bolt command with the inventory path, module path, and boltdir
45
+ # Run a bolt command with the inventory path, and boltdir
46
46
  # @param args [Array<String>] An array containing the bolt arguments
47
47
  def execute_bolt_command(args)
48
48
  bolt_exe = @env.vagrantfile.config.bolt.bolt_exe
49
- modulepath = VagrantBolt::Util::Config.full_path(@env.vagrantfile.config.bolt.modulepath, @env.root_path)
50
- boltdir = VagrantBolt::Util::Config.full_path(@env.vagrantfile.config.bolt.boltdir, @env.root_path)
49
+ boltdir = VagrantBolt::Util::Config.relative_path(@env.vagrantfile.config.bolt.boltdir, @env.root_path)
51
50
  inventoryfile = VagrantBolt::Util::Bolt.inventory_file(@env)
52
51
 
53
52
  quoted_args = args.flatten.compact.map { |a| "'#{a}'" }
54
53
  command = [
55
54
  "\'#{bolt_exe}\'",
56
55
  quoted_args,
57
- '--modulepath',
58
- "\'#{modulepath}\'",
59
56
  '--boltdir',
60
57
  "\'#{boltdir}\'",
61
58
  ]
@@ -9,12 +9,16 @@ class VagrantBolt::Config::Global < Vagrant.plugin('2', :config)
9
9
  # @return [String] The bolt working directory. Defaults to `.`
10
10
  attr_accessor :boltdir
11
11
 
12
+ # @!attribute [rw] host_key_check
13
+ # @return [String] If the connection should check the host key on the remote host (linux)
14
+ attr_accessor :connect_timeout
15
+
12
16
  # @!attribute [rw] host_key_check
13
17
  # @return [Boolean] If the connection should check the host key on the remote host (linux)
14
18
  attr_accessor :host_key_check
15
19
 
16
20
  # @!attribute [rw] modulepath
17
- # @return [String] The path to the modules. Defaults to `modules`.
21
+ # @return [String] The path to the modules.
18
22
  attr_accessor :modulepath
19
23
 
20
24
  # @!attribute [rw] user
@@ -74,45 +78,47 @@ class VagrantBolt::Config::Global < Vagrant.plugin('2', :config)
74
78
  attr_accessor :features
75
79
 
76
80
  def initialize
77
- @bolt_exe = UNSET_VALUE
78
- @boltdir = UNSET_VALUE
79
- @host_key_check = UNSET_VALUE
80
- @modulepath = UNSET_VALUE
81
- @password = UNSET_VALUE
82
- @port = UNSET_VALUE
83
- @private_key = UNSET_VALUE
84
- @run_as = UNSET_VALUE
85
- @ssl = UNSET_VALUE
86
- @ssl_verify = UNSET_VALUE
87
- @sudo_password = UNSET_VALUE
88
- @tmpdir = UNSET_VALUE
89
- @user = UNSET_VALUE
90
- @verbose = UNSET_VALUE
91
- @debug = UNSET_VALUE
92
- @facts = UNSET_VALUE
93
- @vars = UNSET_VALUE
94
- @features = UNSET_VALUE
81
+ @bolt_exe = UNSET_VALUE
82
+ @boltdir = UNSET_VALUE
83
+ @connect_timeout = UNSET_VALUE
84
+ @host_key_check = UNSET_VALUE
85
+ @modulepath = UNSET_VALUE
86
+ @password = UNSET_VALUE
87
+ @port = UNSET_VALUE
88
+ @private_key = UNSET_VALUE
89
+ @run_as = UNSET_VALUE
90
+ @ssl = UNSET_VALUE
91
+ @ssl_verify = UNSET_VALUE
92
+ @sudo_password = UNSET_VALUE
93
+ @tmpdir = UNSET_VALUE
94
+ @user = UNSET_VALUE
95
+ @verbose = UNSET_VALUE
96
+ @debug = UNSET_VALUE
97
+ @facts = UNSET_VALUE
98
+ @vars = UNSET_VALUE
99
+ @features = UNSET_VALUE
95
100
  end
96
101
 
97
102
  def finalize!
98
- @bolt_exe = 'bolt' if @bolt_exe == UNSET_VALUE
99
- @boltdir = '.' if @boltdir == UNSET_VALUE
100
- @host_key_check = nil if @host_key_check == UNSET_VALUE
101
- @modulepath = 'modules' if @modulepath == UNSET_VALUE
102
- @port = nil if @port == UNSET_VALUE
103
- @password = nil if @password == UNSET_VALUE
104
- @private_key = nil if @private_key == UNSET_VALUE
105
- @run_as = nil if @run_as == UNSET_VALUE
106
- @ssl = nil if @ssl == UNSET_VALUE
107
- @ssl_verify = nil if @ssl_verify == UNSET_VALUE
108
- @sudo_password = nil if @sudo_password == UNSET_VALUE
109
- @tmpdir = nil if @tmpdir == UNSET_VALUE
110
- @user = nil if @user == UNSET_VALUE
111
- @verbose = nil if @verbose == UNSET_VALUE
112
- @debug = nil if @debug == UNSET_VALUE
113
- @facts = nil if @facts == UNSET_VALUE
114
- @features = nil if @features == UNSET_VALUE
115
- @vars = nil if @vars == UNSET_VALUE
103
+ @bolt_exe = 'bolt' if @bolt_exe == UNSET_VALUE
104
+ @boltdir = '.' if @boltdir == UNSET_VALUE
105
+ @connect_timeout = nil if @connect_timeout == UNSET_VALUE
106
+ @host_key_check = nil if @host_key_check == UNSET_VALUE
107
+ @modulepath = nil if @modulepath == UNSET_VALUE
108
+ @port = nil if @port == UNSET_VALUE
109
+ @password = nil if @password == UNSET_VALUE
110
+ @private_key = nil if @private_key == UNSET_VALUE
111
+ @run_as = nil if @run_as == UNSET_VALUE
112
+ @ssl = nil if @ssl == UNSET_VALUE
113
+ @ssl_verify = nil if @ssl_verify == UNSET_VALUE
114
+ @sudo_password = nil if @sudo_password == UNSET_VALUE
115
+ @tmpdir = nil if @tmpdir == UNSET_VALUE
116
+ @user = nil if @user == UNSET_VALUE
117
+ @verbose = nil if @verbose == UNSET_VALUE
118
+ @debug = nil if @debug == UNSET_VALUE
119
+ @facts = nil if @facts == UNSET_VALUE
120
+ @features = nil if @features == UNSET_VALUE
121
+ @vars = nil if @vars == UNSET_VALUE
116
122
  end
117
123
 
118
124
  def validate(_machine)
@@ -127,7 +133,7 @@ class VagrantBolt::Config::Global < Vagrant.plugin('2', :config)
127
133
  group_objects = ['facts', 'features', 'vars']
128
134
  config = {}
129
135
  instance_variables_hash.each do |key, value|
130
- next if value.nil?
136
+ next if value.nil? || (value == UNSET_VALUE)
131
137
 
132
138
  if group_objects.include?(key)
133
139
  config[key] = value
@@ -154,6 +160,7 @@ class VagrantBolt::Config::Global < Vagrant.plugin('2', :config)
154
160
  'run_as',
155
161
  'port',
156
162
  'private_key',
163
+ 'connect_timeout',
157
164
  'host_key_check',
158
165
  'sudo_password',
159
166
  'tmpdir',
@@ -20,12 +20,16 @@ class VagrantBolt::ConfigBuilder::Config < ConfigBuilder::Model::Base
20
20
  # @return [Boolean] Shows debug logging
21
21
  def_model_attribute :debug
22
22
 
23
+ # @!attribute [rw] connect_timeout
24
+ # @return [String] The timeout for the ssh connection (linux)
25
+ def_model_attribute :connect_timeout
26
+
23
27
  # @!attribute [rw] host_key_check
24
28
  # @return [Boolean] If the connection should check the host key on the remote host (linux)
25
29
  def_model_attribute :host_key_check
26
30
 
27
31
  # @!attribute [rw] modulepath
28
- # @return [String] The path to the modules. Defaults to `modules`.
32
+ # @return [String] The path to the modules.
29
33
  def_model_attribute :modulepath
30
34
 
31
35
  # @!attribute [rw] name
@@ -118,32 +122,33 @@ class VagrantBolt::ConfigBuilder::Config < ConfigBuilder::Model::Base
118
122
  def to_proc
119
123
  proc do |config|
120
124
  bolt = config.bolt
121
- with_attr(:args) { |val| bolt.args = val }
122
- with_attr(:bolt_exe) { |val| bolt.bolt_exe = val }
123
- with_attr(:command) { |val| bolt.command = val }
124
- with_attr(:boltdir) { |val| bolt.boltdir = val }
125
- with_attr(:debug) { |val| bolt.debug = val }
126
- with_attr(:host_key_check) { |val| bolt.host_key_check = val }
127
- with_attr(:modulepath) { |val| bolt.modulepath = val }
128
- with_attr(:name) { |val| bolt.name = val }
129
- with_attr(:nodes) { |val| bolt.nodes = val }
130
- with_attr(:noop) { |val| bolt.noop = val }
131
- with_attr(:excludes) { |val| bolt.excludes = val }
132
- with_attr(:node_list) { |val| bolt.node_list = val }
133
- with_attr(:params) { |val| bolt.params = val }
134
- with_attr(:user) { |val| bolt.user = val }
135
- with_attr(:password) { |val| bolt.password = val }
136
- with_attr(:port) { |val| bolt.port = val }
137
- with_attr(:private_key) { |val| bolt.private_key = val }
138
- with_attr(:run_as) { |val| bolt.run_as = val }
139
- with_attr(:sudo_password) { |val| bolt.sudo_password = val }
140
- with_attr(:ssl) { |val| bolt.ssl = val }
141
- with_attr(:ssl_verify) { |val| bolt.ssl_verify = val }
142
- with_attr(:tmpdir) { |val| bolt.tmpdir = val }
143
- with_attr(:verbose) { |val| bolt.verbose = val }
144
- with_attr(:facts) { |val| bolt.facts = val }
145
- with_attr(:features) { |val| bolt.features = val }
146
- with_attr(:vars) { |val| bolt.vars = val }
125
+ with_attr(:args) { |val| bolt.args = val }
126
+ with_attr(:bolt_exe) { |val| bolt.bolt_exe = val }
127
+ with_attr(:command) { |val| bolt.command = val }
128
+ with_attr(:boltdir) { |val| bolt.boltdir = val }
129
+ with_attr(:debug) { |val| bolt.debug = val }
130
+ with_attr(:connect_timeout) { |val| bolt.connect_timeout = val }
131
+ with_attr(:host_key_check) { |val| bolt.host_key_check = val }
132
+ with_attr(:modulepath) { |val| bolt.modulepath = val }
133
+ with_attr(:name) { |val| bolt.name = val }
134
+ with_attr(:nodes) { |val| bolt.nodes = val }
135
+ with_attr(:noop) { |val| bolt.noop = val }
136
+ with_attr(:excludes) { |val| bolt.excludes = val }
137
+ with_attr(:node_list) { |val| bolt.node_list = val }
138
+ with_attr(:params) { |val| bolt.params = val }
139
+ with_attr(:user) { |val| bolt.user = val }
140
+ with_attr(:password) { |val| bolt.password = val }
141
+ with_attr(:port) { |val| bolt.port = val }
142
+ with_attr(:private_key) { |val| bolt.private_key = val }
143
+ with_attr(:run_as) { |val| bolt.run_as = val }
144
+ with_attr(:sudo_password) { |val| bolt.sudo_password = val }
145
+ with_attr(:ssl) { |val| bolt.ssl = val }
146
+ with_attr(:ssl_verify) { |val| bolt.ssl_verify = val }
147
+ with_attr(:tmpdir) { |val| bolt.tmpdir = val }
148
+ with_attr(:verbose) { |val| bolt.verbose = val }
149
+ with_attr(:facts) { |val| bolt.facts = val }
150
+ with_attr(:features) { |val| bolt.features = val }
151
+ with_attr(:vars) { |val| bolt.vars = val }
147
152
  end
148
153
  end
149
154
  # rubocop:enable Metrics/BlockLength
@@ -20,12 +20,16 @@ class VagrantBolt::ConfigBuilder::Provisioner < ConfigBuilder::Model::Provisione
20
20
  # @return [Boolean] Shows debug logging
21
21
  def_model_attribute :debug
22
22
 
23
+ # @!attribute [rw] connect_timeout
24
+ # @return [String] The ssh connection timeout (linux)
25
+ def_model_attribute :connect_timeout
26
+
23
27
  # @!attribute [rw] host_key_check
24
28
  # @return [Boolean] If the connection should check the host key on the remote host (linux)
25
29
  def_model_attribute :host_key_check
26
30
 
27
31
  # @!attribute [rw] modulepath
28
- # @return [String] The path to the modules. Defaults to `modules`.
32
+ # @return [String] The path to the modules.
29
33
  def_model_attribute :modulepath
30
34
 
31
35
  # @!attribute [rw] name
@@ -50,8 +50,8 @@ class VagrantBolt::Runner
50
50
  config.node_list ||= @machine.name.to_s unless config.excludes.include?(@machine.name.to_s)
51
51
 
52
52
  # Ensure these are absolute paths to allow for running vagrant commands outside of the root dir
53
- config.modulepath = VagrantBolt::Util::Config.full_path(config.modulepath, @env.root_path)
54
- config.boltdir = VagrantBolt::Util::Config.full_path(config.boltdir, @env.root_path)
53
+ config.modulepath = VagrantBolt::Util::Config.relative_path(config.modulepath, @env.root_path)
54
+ config.boltdir = VagrantBolt::Util::Config.relative_path(config.boltdir, @env.root_path)
55
55
 
56
56
  config
57
57
  end
@@ -108,7 +108,7 @@ module VagrantBolt::Util
108
108
  # @param env [Object] The environment
109
109
  # @return [String] The path to the inventory file
110
110
  def self.inventory_file(env)
111
- File.join(env.local_data_path, 'bolt_inventory.yaml')
111
+ VagrantBolt::Util::Config.relative_path('bolt_inventory.yaml', env.local_data_path)
112
112
  end
113
113
 
114
114
  # Update and write the inventory file for the current running machines
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'pathname'
4
+
3
5
  module VagrantBolt::Util
4
6
  module Config
5
7
  # Config Utility Functions
@@ -30,14 +32,25 @@ module VagrantBolt::Util
30
32
  result
31
33
  end
32
34
 
33
- # Convert a path to the absolute path of the inventory if it is relative
35
+ # Convert a path to the absolute path if it is relative
34
36
  # @param path [String] The path to convert
35
37
  # @param root_path [Object] The root path to append
36
38
  # @return [String] The absolute path or nil if path is nil
37
39
  def self.full_path(path, root_path)
38
40
  return path if path.nil? || root_path.nil?
39
41
 
40
- %r{^/.*}.match?(path) ? path : "#{root_path}/#{path}"
42
+ (Pathname.new path).absolute? ? path : File.expand_path(path, root_path)
43
+ end
44
+
45
+ # Convert a path to the relative path from the current directory
46
+ # @param path [String] The path to convert
47
+ # @param root_path [Object] The root path to append
48
+ # @return [String] The relative path or nil if path is nil
49
+ def self.relative_path(path, root_path)
50
+ return path if path.nil?
51
+
52
+ absolute_path = Pathname.new full_path(path, root_path)
53
+ absolute_path.relative_path_from(Pathname.getwd).to_s
41
54
  end
42
55
  end
43
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VagrantBolt
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -21,7 +21,6 @@ describe VagrantBolt::Config::Global do
21
21
 
22
22
  context "defaults" do
23
23
  expected_values = {
24
- modulepath: "modules",
25
24
  bolt_exe: "bolt",
26
25
  boltdir: ".",
27
26
  }
@@ -42,12 +41,14 @@ describe VagrantBolt::Config::Global do
42
41
  "run_as",
43
42
  "ssl",
44
43
  "ssl_verify",
44
+ "connect_timeout",
45
45
  "host_key_check",
46
46
  "verbose",
47
47
  "debug",
48
48
  "facts",
49
49
  "vars",
50
50
  "features",
51
+ "modulepath",
51
52
  ]
52
53
  expected_nil.each do |val|
53
54
  it "defaults #{val} to nil" do
@@ -28,13 +28,11 @@ describe VagrantBolt::Runner do
28
28
  allow(result).to receive(:stderr).and_return("")
29
29
  end
30
30
  end
31
- let(:root_path) { '/root/path' }
32
- let(:local_data_path) { '/local/data/path' }
33
- let(:inventory_path) { "#{local_data_path}/bolt_inventory.yaml" }
31
+ let(:root_path) { Dir.getwd }
32
+ let(:local_data_path) { "#{root_path}/.vagrant" }
33
+ let(:inventory_path) { ".vagrant/bolt_inventory.yaml" }
34
34
  before(:each) do
35
35
  allow(VagrantBolt::Util::Bolt).to receive(:update_inventory_file).with(iso_env).and_return(inventory_path)
36
- allow(iso_env).to receive(:root_path).and_return(root_path)
37
- allow(iso_env).to receive(:local_data_path).and_return(local_data_path)
38
36
  allow(machine).to receive(:env).and_return(:iso_env)
39
37
  allow(machine).to receive(:ssh_info).and_return(
40
38
  host: 'foo',
@@ -94,6 +92,8 @@ describe VagrantBolt::Runner do
94
92
  let(:options) { { notify: [:stdout, :stderr], env: { PATH: nil } } }
95
93
  before(:each) do
96
94
  allow(Vagrant::Util::Subprocess).to receive(:execute).and_return(subprocess_result)
95
+ allow(iso_env).to receive(:root_path).and_return(root_path)
96
+ allow(iso_env).to receive(:local_data_path).and_return(local_data_path)
97
97
  end
98
98
 
99
99
  it 'does not raise an exeption when all parameters are specified' do
@@ -110,11 +110,10 @@ describe VagrantBolt::Runner do
110
110
 
111
111
  it 'creates a shell execution' do
112
112
  config.bolt_exe = 'bolt'
113
- config.modulepath = 'modules'
114
113
  config.boltdir = '.'
115
114
  config.node_list = 'ssh://test:22'
116
115
  config.finalize!
117
- command = "bolt task run 'foo' --boltdir '#{root_path}/.' --modulepath '#{root_path}/modules' --inventoryfile '#{inventory_path}' --nodes 'ssh://test:22'"
116
+ command = "bolt task run 'foo' --boltdir '.' --inventoryfile '#{inventory_path}' --nodes 'ssh://test:22'"
118
117
  expect(Vagrant::Util::Subprocess).to receive(:execute).with('bash', '-c', command, options).and_return(subprocess_result)
119
118
  subject.run('task', 'foo')
120
119
  end
@@ -29,6 +29,7 @@ describe VagrantBolt::Util::Bolt do
29
29
  "alias" => "machine",
30
30
  "config" => {
31
31
  "ssh" => {
32
+ "connect-timeout" => "30",
32
33
  "host-key-check" => false,
33
34
  "port" => "22",
34
35
  "user" => "vagrant",
@@ -56,6 +57,7 @@ describe VagrantBolt::Util::Bolt do
56
57
  config.run_as = 'root'
57
58
  config.port = '22'
58
59
  config.private_key = 'bar'
60
+ config.connect_timeout = '30'
59
61
  config.host_key_check = false
60
62
  config.user = 'vagrant'
61
63
  config.facts = { 'a' => 'b' }
@@ -0,0 +1,8 @@
1
+ require 'github_changelog_generator/task'
2
+ require_relative '../lib/vagrant-bolt/version'
3
+
4
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
5
+ config.user ='oscar-stack'
6
+ config.project = 'vagrant-bolt'
7
+ config.future_release = VagrantBolt::VERSION
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarret Lavallee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2019-07-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " Vagrant provisioning with Puppet Bolt\n"
14
14
  email:
@@ -22,6 +22,7 @@ files:
22
22
  - ".rubocop.yml"
23
23
  - ".travis.yml"
24
24
  - ".yardopts"
25
+ - CHANGELOG.md
25
26
  - Gemfile
26
27
  - LICENSE
27
28
  - Puppetfile
@@ -79,6 +80,7 @@ files:
79
80
  - spec/unit/util/config_spec.rb
80
81
  - spec/unit/vagrant_spec.rb
81
82
  - tasks/acceptance.rake
83
+ - tasks/changelog.rake
82
84
  - tasks/spec.rake
83
85
  - templates/locales/en.yml
84
86
  - vagrant-bolt.gemspec