opendelivery 0.0.24 → 0.1.25

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.
@@ -30,17 +30,55 @@ module OpenDelivery
30
30
  end
31
31
 
32
32
  def load_stack_properties(domain, stack)
33
- stack.resources.each do |resource|
34
- set_property(domain, stack.name, resource.resource_type, resource.physical_resource_id)
33
+ AWS::SimpleDB.consistent_reads do
34
+ stack.resources.each do |resource|
35
+ set_property(domain, stack.name, resource.resource_type, resource.physical_resource_id)
36
+ end
35
37
  end
36
38
  end
37
39
 
38
- def get_property(domain, item_name, key, index=0)
40
+ # Look for AWS::Some:Type|MyItemName or just AWS::Some::Type.
41
+
42
+ def get_property(domain, item_name, key, index=0, name=nil)
39
43
  property_value = nil
44
+ attribute = nil
45
+
40
46
  AWS::SimpleDB.consistent_reads do
41
47
  item = @sdb.domains[domain].items[item_name]
42
48
  if !item.nil?
43
- attribute = item.attributes[key]
49
+ item.attributes.each do |att|
50
+ col_name = nil
51
+
52
+ att_array = att.name.split('|')
53
+ col_title = att_array.first
54
+
55
+ if att_array.length > 1
56
+ col_name = att_array[1]
57
+ end
58
+
59
+ if col_title == key
60
+ # Found a column with first portion that matches our search 'key'
61
+ # Now, determine if we need to match the "|name" name criteria.
62
+
63
+ if name.nil?
64
+ # Not given a name to search for, just return the first one
65
+ # we have found.
66
+ attribute = att
67
+ break
68
+ else
69
+
70
+ # Give a 'name' search criteria, so match it against this column
71
+ if name == col_name
72
+ # 'name' criteria matches "|name" value, found a match
73
+ attribute = att
74
+ break
75
+ else
76
+ # 'name' criteria did not match, keep searching
77
+ end
78
+
79
+ end
80
+ end
81
+ end
44
82
  if !attribute.nil?
45
83
  value = attribute.values[index]
46
84
  if !value.nil?
@@ -52,7 +90,8 @@ module OpenDelivery
52
90
  return property_value
53
91
  end
54
92
 
55
- def set_property(domain, item_name, key, value)
93
+ def set_property(domain, item_name, key, value, name=nil)
94
+ if name then key = key + "|" + name end
56
95
  AWS::SimpleDB.consistent_reads do
57
96
  item = @sdb.domains[domain].items[item_name]
58
97
  item.attributes.set(key => [value])
@@ -144,7 +144,9 @@ module OpenDelivery
144
144
  print_status(status, silent)
145
145
  sleep (sleep_time * 0.1)
146
146
  end
147
- sleep(sleep_time)
147
+ if keep_watching
148
+ sleep(sleep_time)
149
+ end
148
150
  end
149
151
  return success
150
152
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendelivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.1.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-10-24 00:00:00.000000000 Z
14
+ date: 2013-11-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec