vagrant-skytap 0.1.10 → 0.1.11

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.
data/eng-10369.diff DELETED
@@ -1,208 +0,0 @@
1
- # HG changeset patch
2
- # Parent d55067c6de25d1b7ff712f9a8a934dc122e82e14
3
- # Parent d55067c6de25d1b7ff712f9a8a934dc122e82e14
4
- ENG-10369 Detect errors in 200 response. Assume all are fatal.
5
-
6
- diff -r d55067c6de25 Vagrantfile
7
- --- a/Vagrantfile Mon Nov 09 18:52:55 2015 -0800
8
- +++ b/Vagrantfile Mon Nov 09 19:28:06 2015 -0800
9
- @@ -3,20 +3,20 @@
10
- config.vm.synced_folder ".", "/vagrant", disabled: true
11
-
12
- config.vm.provider :skytap do |skytap, override|
13
- - skytap.username = "etrue"
14
- - skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
15
- - skytap.base_url = "https://cloud.skytap.com/"
16
- - #skytap.username = "vagrant_provider_admin"
17
- - #skytap.api_token = "7c5718531a32eb90e92c804ce1f73da98be22cdf"
18
- - #skytap.base_url = "https://test.skytap.com/"
19
- +# skytap.username = "etrue"
20
- +# skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
21
- +# skytap.base_url = "https://cloud.skytap.com/"
22
- + skytap.username = "vagrant_provider_admin"
23
- + skytap.api_token = "7c5718531a32eb90e92c804ce1f73da98be22cdf"
24
- + skytap.base_url = "https://test.skytap.com/"
25
- #skytap.username = "jsmith"
26
- #skytap.api_token = "754be5220955f35840498340606b4dfa89f7eb61"
27
- #skytap.base_url = "https://cloud.skytap.dev/"
28
- end
29
-
30
- - GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
31
- +# GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
32
- # for test user
33
- - #GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/4840008'
34
- + GENERIC_UBUNTU = 'https://test.skytap.com/vms/4840008'
35
- # local user
36
- #GENERIC_UBUNTU = 'https://cloud.skytap.dev/vms/374'
37
-
38
- @@ -33,6 +33,8 @@
39
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A = "https://cloud.skytap.com/vms/7457184"
40
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B = "https://cloud.skytap.com/vms/7468766"
41
-
42
- + VAGRANT_CUSTOMER_VPN = "https://cloud.skytap.com/vpns/vpn-3195669"
43
- +
44
- # separate template
45
- # another ubuntu = 'https://cloud.skytap.com/vms/7242466'
46
- WINDOWS_WINRM_CONFIGURED = 'https://cloud.skytap.com/vms/7242468'
47
- @@ -40,12 +42,13 @@
48
- config.vm.define "vm1" do |ubuntu|
49
- ubuntu.vm.hostname = "vm1"
50
- ubuntu.vm.provider :skytap do |box|
51
- - box.vm_url = UBUNTU1#GENERIC_UBUNTU
52
- + box.vm_url = GENERIC_UBUNTU
53
- #box.cpus = 1
54
- #box.cpuspersocket = 1
55
- #box.ram = 1024
56
- #box.guestos = "ubuntu"
57
- #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
58
- + box.vpn_url = VAGRANT_CUSTOMER_VPN
59
- end
60
- ubuntu.vm.synced_folder "vm1", "/synced", type: :nfs
61
- ubuntu.vm.communicator = :ssh
62
- diff -r d55067c6de25 lib/vagrant-skytap/api/client.rb
63
- --- a/lib/vagrant-skytap/api/client.rb Mon Nov 09 18:52:55 2015 -0800
64
- +++ b/lib/vagrant-skytap/api/client.rb Mon Nov 09 19:28:06 2015 -0800
65
- @@ -67,7 +67,11 @@
66
- tries += 1
67
- http.send_request(method, URI.encode(path), body, headers).tap do |ret|
68
- @logger.debug("REST API response: #{ret.body}")
69
- - unless ret.code =~ /^2\d\d/
70
- + if ret.code =~ /^2\d\d/
71
- + if options[:raise_on_error_field] && err = error_string_from_body(ret)
72
- + raise Errors::OperationSucceededWithErrors, err: err
73
- + end
74
- + else
75
- raise Errors::DoesNotExist, object_name: "Object '#{path}'" if ret.code == '404'
76
- error_class = case ret.code
77
- when '403'
78
- @@ -96,7 +100,7 @@
79
- def error_string_from_body(resp)
80
- resp = resp.body if resp.respond_to?(:body)
81
- begin
82
- - resp = JSON.load(resp)
83
- + resp = JSON.load(resp) unless resp.is_a?(Hash)
84
- errors = resp['error'] || resp['errors']
85
- errors = errors.join('; ') if errors.respond_to? :join
86
- rescue
87
- diff -r d55067c6de25 lib/vagrant-skytap/api/resource.rb
88
- --- a/lib/vagrant-skytap/api/resource.rb Mon Nov 09 18:52:55 2015 -0800
89
- +++ b/lib/vagrant-skytap/api/resource.rb Mon Nov 09 19:28:06 2015 -0800
90
- @@ -23,8 +23,8 @@
91
- "/#{self.class.resource_name.downcase}s/#{id}"
92
- end
93
-
94
- - def reload
95
- - resp = api_client.get(url)
96
- + def reload(options={})
97
- + resp = api_client.get(url, options)
98
- refresh(JSON.load(resp.body))
99
- end
100
-
101
- diff -r d55067c6de25 lib/vagrant-skytap/api/runstate_operations.rb
102
- --- a/lib/vagrant-skytap/api/runstate_operations.rb Mon Nov 09 18:52:55 2015 -0800
103
- +++ b/lib/vagrant-skytap/api/runstate_operations.rb Mon Nov 09 19:28:06 2015 -0800
104
- @@ -36,12 +36,16 @@
105
- def wait_for_runstate(expected_runstate)
106
- expected_runstate = expected_runstate.to_s
107
- retry_while_resource_busy do
108
- - unless reload.busy?
109
- + unless reload_with_error_handling.busy?
110
- break if runstate == expected_runstate || expected_runstate == 'ready'
111
- end
112
- end
113
- end
114
-
115
- + def reload_with_error_handling
116
- + reload(raise_on_error_field: true)
117
- + end
118
- +
119
- def runstate
120
- get_api_attribute('runstate')
121
- end
122
- diff -r d55067c6de25 lib/vagrant-skytap/api/vm.rb
123
- --- a/lib/vagrant-skytap/api/vm.rb Mon Nov 09 18:52:55 2015 -0800
124
- +++ b/lib/vagrant-skytap/api/vm.rb Mon Nov 09 19:28:06 2015 -0800
125
- @@ -1,4 +1,4 @@
126
- -require 'vagrant-skytap/api/resource'
127
- + require 'vagrant-skytap/api/resource'
128
- require 'vagrant-skytap/api/interface'
129
- require 'vagrant-skytap/api/credentials'
130
- require_relative 'runstate_operations'
131
- @@ -20,12 +20,6 @@
132
- resp = env[:api_client].get(url)
133
- new(JSON.load(resp.body), env[:environment], env)
134
- end
135
- -
136
- - def current_vm(env)
137
- - if (environment = env[:environment]) && (machine = env[:machine]) && machine.id
138
- - environment.get_vm_by_id(machine.id)
139
- - end
140
- - end
141
- end
142
-
143
- def initialize(attrs, environment, env)
144
- @@ -40,6 +34,19 @@
145
- super
146
- end
147
-
148
- + def refresh_from_environment
149
- + raise VmVanished, name: machine.name unless vm = environment.get_vm_by_id(id)
150
- + refresh(vm.attrs)
151
- + end
152
- +
153
- + def reload_with_error_handling
154
- + environment.reload_with_error_handling
155
- + refresh_from_environment.tap do |ret|
156
- + err = api_client.error_string_from_body(ret.attrs)
157
- + raise Errors::OperationSucceededWithErrors, err: err if err
158
- + end
159
- + end
160
- +
161
- def interfaces
162
- @interfaces ||= (get_api_attribute('interfaces') || []).collect do |iface_attrs|
163
- Interface.new(iface_attrs, self, env)
164
- diff -r d55067c6de25 lib/vagrant-skytap/errors.rb
165
- --- a/lib/vagrant-skytap/errors.rb Mon Nov 09 18:52:55 2015 -0800
166
- +++ b/lib/vagrant-skytap/errors.rb Mon Nov 09 19:28:06 2015 -0800
167
- @@ -27,6 +27,10 @@
168
- error_key(:does_not_exist)
169
- end
170
-
171
- + class VmVanished < VagrantSkytapError
172
- + error_key(:vm_vanished)
173
- + end
174
- +
175
- class BadVmUrl < VagrantSkytapError
176
- error_key(:bad_vm_url)
177
- end
178
- @@ -51,6 +55,11 @@
179
- error_key(:operation_failed)
180
- end
181
-
182
- + # Raised when a 200 response contains errors
183
- + class OperationSucceededWithErrors < VagrantSkytapError
184
- + error_key(:operation_succeeded_with_errors)
185
- + end
186
- +
187
- class VpnConnectionFailed < VagrantSkytapError
188
- error_key(:vpn_connection_failed)
189
- end
190
- diff -r d55067c6de25 locales/en.yml
191
- --- a/locales/en.yml Mon Nov 09 18:52:55 2015 -0800
192
- +++ b/locales/en.yml Mon Nov 09 19:28:06 2015 -0800
193
- @@ -76,9 +76,15 @@
194
- does_not_exist: |-
195
- %{object_name} was not found.
196
-
197
- + vm_vanished: |-
198
- + The VM '%{name}' no longer exists on Skytap.
199
- +
200
- operation_failed: |-
201
- The operation failed: %{err}
202
-
203
- + operation_succeeded_with_errors: |-
204
- + An error occurred: %{err}
205
- +
206
- vpn_connection_failed: |-
207
- Could not connect to the VPN.
208
-