miasma-azure 0.1.0 → 0.1.2

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
  SHA1:
3
- metadata.gz: be83f458b27083e4429033147f913df0d7e4fb91
4
- data.tar.gz: bec0131489f448f8a384f97144ff9f4f6c1aae27
3
+ metadata.gz: 930c7bce022b9900264a5edeeffead952cc6cb89
4
+ data.tar.gz: 3bab0bcf17dbce4f268e9b21ce326ac28d17c92c
5
5
  SHA512:
6
- metadata.gz: 340a89e131f1f5c59e2c26310ed5a526ba287d77ca638a4780fd165a8ffc0226b59887a8d1ab91151e32ef684d5967b605cb24ea53cd93df97d327534fa2546d
7
- data.tar.gz: 2ec209dab7c0a261cb17debcf991385b89e568658a53f0b3e27b9d1bc0d72d7357af16fcd87127fdf0db0ec12946400bb24da503892d2ee29f0b49def8c89a25
6
+ metadata.gz: 4003382c4e7203a3c86b86c2210b7f06db6c20f79a0c1e694681a256c3994a4dabc7509e9c5e3e03b5a74359d6473d94c12cafef22ad1e55af39c1de394e3152
7
+ data.tar.gz: e8ac70debf8ac21c16ccebaa421e7533c31f6a6e84f11a192875ba1b9f1732f3ec628bd467cf11a9551d583a980696b9b3f35c748e2a246f6566b4940433fcd1
data/CHANGELOG.md CHANGED
@@ -1,2 +1,6 @@
1
+ # v0.1.2
2
+ * [fix] properly load stack outputs into data model
3
+ * [fix] stub event output when stack is being destroyed
4
+
1
5
  # v0.1.0
2
6
  * Initial release
@@ -1,4 +1,4 @@
1
1
  module MiasmaAzure
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.1.0')
3
+ VERSION = Gem::Version.new('0.1.2')
4
4
  end
@@ -112,8 +112,11 @@ module Miasma
112
112
  [p_name, p_value[:value]]
113
113
  end
114
114
  ],
115
- :outputs => item.fetch(:outputs, {}).map{ |o_name, o_value|
116
- Smash.new(:key => o_name, :value => o_value[:value])
115
+ :outputs => item.fetch(:properties, :outputs, {}).map{ |o_name, o_value|
116
+ Stack::Output.new(stack,
117
+ :key => o_name,
118
+ :value => o_value[:value]
119
+ )
117
120
  },
118
121
  :template_url => item.get(:properties, :templateLink, :uri),
119
122
  :state => status_to_state(
@@ -413,28 +416,37 @@ module Miasma
413
416
  # @param stack [Models::Orchestration::Stack]
414
417
  # @return [Array<Models::Orchestration::Stack::Event>]
415
418
  def event_all(stack, evt_id=nil)
416
- result = request(
417
- :path => [generate_path(stack), 'operations'].join('/')
418
- )
419
- events = result.get(:body, :value).map do |event|
420
- Stack::Event.new(
421
- stack,
422
- :id => event[:operationId],
423
- :resource_id => event.get(:properties, :targetResource, :id),
424
- :resource_name => event.get(:properties, :targetResource, :resourceName),
425
- :resource_logical_id => event.get(:properties, :targetResource, :resourceName),
426
- :resource_state => status_to_state(event.get(:properties, :provisioningState)),
427
- :resource_status => event.get(:properties, :provisioningState),
428
- :resource_status_reason => event.get(:properties, :statusCode),
429
- :time => Time.parse(event.get(:properties, :timestamp))
430
- ).valid_state
431
- end
432
- if(evt_id)
433
- idx = events.index{|d| e.id == evt_id}
434
- idx = idx ? idx + 1 : 0
435
- events.slice(idx, events.size)
419
+ # TODO and NOTE
420
+ # Operations can't be viewed when deletion is progress. For now
421
+ # just return nothing. This should be replaced with customized
422
+ # events: poll resource group resources and generate event items
423
+ # as resources are deleted
424
+ if(stack.state.to_s.start_with?('delete'))
425
+ []
436
426
  else
437
- events
427
+ result = request(
428
+ :path => [generate_path(stack), 'operations'].join('/')
429
+ )
430
+ events = result.get(:body, :value).map do |event|
431
+ Stack::Event.new(
432
+ stack,
433
+ :id => event[:operationId],
434
+ :resource_id => event.get(:properties, :targetResource, :id),
435
+ :resource_name => event.get(:properties, :targetResource, :resourceName),
436
+ :resource_logical_id => event.get(:properties, :targetResource, :resourceName),
437
+ :resource_state => status_to_state(event.get(:properties, :provisioningState)),
438
+ :resource_status => event.get(:properties, :provisioningState),
439
+ :resource_status_reason => event.get(:properties, :statusCode),
440
+ :time => Time.parse(event.get(:properties, :timestamp))
441
+ ).valid_state
442
+ end
443
+ if(evt_id)
444
+ idx = events.index{|d| e.id == evt_id}
445
+ idx = idx ? idx + 1 : 0
446
+ events.slice(idx, events.size)
447
+ else
448
+ events
449
+ end
438
450
  end
439
451
  end
440
452
 
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.0
4
+ version: 0.1.2
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-21 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: miasma