vagrant-scriptrock 0.0.4 → 0.0.5

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: 3882e4771b3636fdab43dc218cc39d194d67c374
4
- data.tar.gz: 64e808df145fff2ab3c9a43a271a598f92aeee7b
3
+ metadata.gz: 4f4c9bf8163d876c54c15965a74b2d55b2befaee
4
+ data.tar.gz: a92d790d341853ddffaf39f16937b1aa2b107802
5
5
  SHA512:
6
- metadata.gz: b8ffa61cf30d1a2a6ba15d2c78fa2887385bd1221e48ee099d440cfec197587675c5960b7effa335eb8bd7f577e639901172413c9c317d8af1ae7b21b2a8cba6
7
- data.tar.gz: 687aa62182cc0bd49f222ae42120e42be29605682ab62825517dd29dcce28004ff7a6ca9a37605556d9287918cdd58d615189305211af30236b3b9d0735ff469
6
+ metadata.gz: 9c427a2249a88cf2110fc97cceafbc0d3a41d9f55486e434ab078b8276f56b20f8123f7809667fd3ad837f2bb25e78c549a4fab2000f07f48a59be5677e5fdf8
7
+ data.tar.gz: 8a60e9ec03e84255a26e4408b88c6d6cab5a515a508a994c881464a9f49e2903bae90924de8c97331c186ee0ac4b7a5024bf72de9435a450c0feb71de1eb7002
@@ -11,6 +11,7 @@ module VagrantPlugins
11
11
  attr_accessor :secret_key
12
12
  attr_accessor :connect_url
13
13
  attr_accessor :ssh_pubkey
14
+ attr_accessor :name_prefix
14
15
 
15
16
  def initialize
16
17
  @debug = false
@@ -21,6 +22,7 @@ module VagrantPlugins
21
22
  @secret_key = UNSET_VALUE
22
23
  @connect_url = UNSET_VALUE
23
24
  @ssh_pubkey = UNSET_VALUE
25
+ @name_prefix = UNSET_VALUE
24
26
  end
25
27
 
26
28
  def load_vars_from_yml
@@ -77,6 +79,9 @@ module VagrantPlugins
77
79
  if unset(@first_hop)
78
80
  @first_hop = ""
79
81
  end
82
+ if unset(@name_prefix)
83
+ @name_prefix = "vagrant"
84
+ end
80
85
  end
81
86
 
82
87
  def unset(v)
@@ -21,7 +21,7 @@ module VagrantPlugins
21
21
  end
22
22
 
23
23
  def guardrail_name
24
- return "vagrant #{@machine.name} #{@machine.id}"
24
+ return "#{@root_config.scriptrock.name_prefix} #{@machine.name}"
25
25
  end
26
26
 
27
27
  def guardrail_auth_headers
@@ -37,7 +37,7 @@ module VagrantPlugins
37
37
  response = HTTParty.get(url, :headers => guardrail_auth_headers)
38
38
  responseJson = JSON.parse(response.body)
39
39
  if response.code == 200
40
- puts "ScriptRock: node already exists, id #{responseJson["id"]} name #{guardrail_name}"
40
+ puts "ScriptRock: node already exists, id #{responseJson["id"]} name '#{guardrail_name}'"
41
41
  return responseJson
42
42
  end
43
43
  end
@@ -54,7 +54,7 @@ module VagrantPlugins
54
54
  })
55
55
  responseJson = JSON.parse(response.body)
56
56
  if response.code == 201
57
- puts "ScriptRock: created new node, id #{responseJson["id"]} name #{guardrail_name}"
57
+ puts "ScriptRock: created new node, id #{responseJson["id"]} name '#{guardrail_name}'"
58
58
  return responseJson
59
59
  else
60
60
  throw "ScriptRock Guardrail create node error code #{response.code} body: #{response.body}"
@@ -80,7 +80,9 @@ module VagrantPlugins
80
80
  def guardrail_delete
81
81
  begin
82
82
  node = guardrail_lookup_and_show
83
- if node != nil
83
+ if node == nil
84
+ puts "ScriptRock: node with name '#{guardrail_name}' not found"
85
+ else
84
86
  url = "#{@root_config.scriptrock.connect_url}/api/v1/nodes/#{node["id"]}.json"
85
87
  response = HTTParty.delete(url, :headers => guardrail_auth_headers)
86
88
  if response.code == 204
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ScriptRock
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Sheahan