vagrant-scriptrock 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e2c55ff93b7cc3a3b20de20bea5246cd2c9d5d3
4
- data.tar.gz: 393fd217181267b7200a81f9500d97fcc6d5c6ea
3
+ metadata.gz: 3882e4771b3636fdab43dc218cc39d194d67c374
4
+ data.tar.gz: 64e808df145fff2ab3c9a43a271a598f92aeee7b
5
5
  SHA512:
6
- metadata.gz: b7a613ead4ee41e8ae8603643d34f55ea6cc15d69cf0774863cf1e76a6737e26cae8908fb722f96a1fa50b529b77928f0c074d74f1f0def3d04b4dd7f800edf1
7
- data.tar.gz: f85ec9679bdaf074b5647d52355aa2c2cb9b2c1f0c1b32796a2b4be00f52fdf154553eb9d9686120a89dbc08e15ce740c22150e24461b1dba740806c5a49b20f
6
+ metadata.gz: b8ffa61cf30d1a2a6ba15d2c78fa2887385bd1221e48ee099d440cfec197587675c5960b7effa335eb8bd7f577e639901172413c9c317d8af1ae7b21b2a8cba6
7
+ data.tar.gz: 687aa62182cc0bd49f222ae42120e42be29605682ab62825517dd29dcce28004ff7a6ca9a37605556d9287918cdd58d615189305211af30236b3b9d0735ff469
@@ -4,6 +4,10 @@ require 'httparty'
4
4
  module VagrantPlugins
5
5
  module ScriptRock
6
6
  class Provisioner < Vagrant.plugin("2", :provisioner)
7
+
8
+ class GuardrailPrivateKeyInstallError < Vagrant::Errors::VagrantError
9
+ end
10
+
7
11
  def initialize(machine, config)
8
12
  @debug = false
9
13
  @machine = machine
@@ -107,9 +111,13 @@ module VagrantPlugins
107
111
  puts "provision provision" if @debug
108
112
 
109
113
  # insert the guardrail public key onto the target node if it is not already present
114
+ puts "Checking for and possibly installing Guardrail public key in ~/.ssh/authorized_keys..."
115
+ pk = @root_config.scriptrock.ssh_pubkey
116
+ key_install_script = "mkdir -p ~/.ssh && " +
117
+ "(grep -q -s '#{pk}' ~/.ssh/authorized_keys || echo '#{pk}' >> ~/.ssh/authorized_keys) && "+
118
+ "grep -q -s '#{pk}' ~/.ssh/authorized_keys"
110
119
  @machine.communicate.tap do |comm|
111
- pk = @root_config.scriptrock.ssh_pubkey
112
- comm.execute("mkdir -p ~/.ssh && grep -q -s '#{pk}' ~/.ssh/authorized_keys || echo '#{pk}' >> ~/.ssh/authorized_keys")
120
+ comm.execute(key_install_script, error_class: GuardrailPrivateKeyInstallError)
113
121
  end
114
122
 
115
123
  # add this node to guardrail if not already present, then update to use the current credentials + forwarded port
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ScriptRock
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-scriptrock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Sheahan