miasma-azure 0.1.2 → 0.1.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: 930c7bce022b9900264a5edeeffead952cc6cb89
4
- data.tar.gz: 3bab0bcf17dbce4f268e9b21ce326ac28d17c92c
3
+ metadata.gz: 54845db70434630e69c25a63e10818cb14511585
4
+ data.tar.gz: 4374a9268fb417fc67a7e900af2860b57aa66b60
5
5
  SHA512:
6
- metadata.gz: 4003382c4e7203a3c86b86c2210b7f06db6c20f79a0c1e694681a256c3994a4dabc7509e9c5e3e03b5a74359d6473d94c12cafef22ad1e55af39c1de394e3152
7
- data.tar.gz: e8ac70debf8ac21c16ccebaa421e7533c31f6a6e84f11a192875ba1b9f1732f3ec628bd467cf11a9551d583a980696b9b3f35c748e2a246f6566b4940433fcd1
6
+ metadata.gz: 95eeefb4dda75bf05d4a39e6da9a8cba99fc4b0b4c4d85c973896da6fec1cfadde130409e08fcd2daa0871032bfdd749e45c9910594187f2f4d513a0969535ba
7
+ data.tar.gz: 7e16ed8ffd66ef61fa5af9af47a887b1cf497961f35e62c9ff035b94c448aa30120d14827c07802c0e02f2c8640e3b1698210f9d5b7d148b1912be89c18408e5
@@ -1,3 +1,6 @@
1
+ # v0.1.4
2
+ * [enhancement] Limit automatic retries to server side errors only
3
+
1
4
  # v0.1.2
2
5
  * [fix] properly load stack outputs into data model
3
6
  * [fix] stub event output when stack is being destroyed
@@ -1,4 +1,4 @@
1
1
  module MiasmaAzure
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.1.2')
3
+ VERSION = Gem::Version.new('0.1.4')
4
4
  end
@@ -317,7 +317,7 @@ module Miasma
317
317
 
318
318
  def request_client_token
319
319
  result = HTTP.post(
320
- File.join(azure_login_url, azure_tenant_id, 'oauth2', 'token'),
320
+ [azure_login_url, azure_tenant_id, 'oauth2', 'token'].join('/'),
321
321
  :form => {
322
322
  :grant_type => 'client_credentials',
323
323
  :client_id => azure_client_id,
@@ -326,11 +326,10 @@ module Miasma
326
326
  }
327
327
  )
328
328
  unless(result.code == 200)
329
- # TODO: Wrap this in custom exception to play nice
330
- puts result.inspect
331
- puts "FAIL: #{result.body.to_s}"
332
- puts result.headers
333
- raise 'ACK'
329
+ raise Miasma::Error::ApiError.new(
330
+ 'Request for client authentication token failed',
331
+ :response => result
332
+ )
334
333
  end
335
334
  @oauth_token_information = MultiJson.load(
336
335
  result.body.to_s
@@ -348,6 +347,18 @@ module Miasma
348
347
  end
349
348
  end
350
349
 
350
+ # Define when request should be retried
351
+ #
352
+ # @param exception [Exception]
353
+ # @return [TrueClass, FalseClass]
354
+ def perform_request_retry(exception)
355
+ if(exception.is_a?(Error::ApiError::RequestError))
356
+ exception.response.code >= 500
357
+ else
358
+ false
359
+ end
360
+ end
361
+
351
362
  # @return [String] custom escape
352
363
  def uri_escape(string)
353
364
  signer.safe_escape(string)
@@ -436,7 +436,7 @@ module Miasma
436
436
  :resource_logical_id => event.get(:properties, :targetResource, :resourceName),
437
437
  :resource_state => status_to_state(event.get(:properties, :provisioningState)),
438
438
  :resource_status => event.get(:properties, :provisioningState),
439
- :resource_status_reason => event.get(:properties, :statusCode),
439
+ :resource_status_reason => event.get(:properties, :statusCode).to_s,
440
440
  :time => Time.parse(event.get(:properties, :timestamp))
441
441
  ).valid_state
442
442
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miasma-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: miasma