Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added protocol support for Tags

  • Loading branch information...
commit 523c0ae9e913a8504788bc1360ef6ef755ee775d 1 parent ceb5a14
John Bresnahan buzztroll authored
44 pyhantom/in_data_types.py
... ... @@ -1,4 +1,5 @@
1 1 from pyhantom.phantom_exceptions import PhantomAWSException
  2 +from pyhantom.util import phantom_is_primative
2 3
3 4
4 5 class ObjectFromReqInput(object):
@@ -23,7 +24,7 @@ def _get_value(self, name, in_val, t):
23 24 else:
24 25 val = False
25 26 else:
26   - o = t(name)
  27 + o = t()
27 28 val = o.set_from_dict(in_val)
28 29 return val
29 30
@@ -38,11 +39,40 @@ def _do_list_param(self, params, p, type_d):
38 39 for pl in type_d.keys():
39 40 ndx = p.find(pl)
40 41 if ndx == 0:
41   - val = self._get_value(p, params[p], type_d[pl])
42   - if val:
  42 + if phantom_is_primative(type_d[pl]):
  43 + val = self._get_value(p, params[p], type_d[pl])
  44 + if val:
  45 + if pl not in self.__dict__:
  46 + self.__dict__[pl] = []
  47 + self.__dict__[pl].append(val)
  48 + else:
43 49 if pl not in self.__dict__:
44 50 self.__dict__[pl] = []
45   - self.__dict__[pl].append(val)
  51 + l = self.__dict__[pl]
  52 + member_info = p.split('.', 3)
  53 + member_ndx = int(member_info[2])
  54 + for i in range(len(l), int(member_ndx)):
  55 + l.append(type_d[pl]())
  56 +
  57 + element = l[member_ndx-1]
  58 + value_name = member_info[3]
  59 + element.set_value(value_name, params[p])
  60 +
  61 + def set_value(self, name, value):
  62 + if name in self.optional_param_keys:
  63 + t = self.optional_param_keys[name]
  64 + elif name in self.needed_param_keys:
  65 + t = self.needed_param_keys[name]
  66 + elif name in self.optional_param_list_keys:
  67 + raise PhantomAWSException("We cannot work with this type yet")
  68 + elif name in self.needed_param_list_keys:
  69 + raise PhantomAWSException("We cannot work with this type yet")
  70 + else:
  71 + raise PhantomAWSException("%s is not a known value name" % (name))
  72 +
  73 + if not phantom_is_primative(t):
  74 + raise PhantomAWSException("We cannot work with this type yet")
  75 + self.__setattr__(name, t(value))
46 76
47 77 def set_from_dict(self, params):
48 78
@@ -78,12 +108,12 @@ def set_from_dict(self, params):
78 108
79 109 class BlockDeviceMappingInput(ObjectFromReqInput):
80 110 def __init__(self):
81   - ObjectFromReqInput.__init__(self, "BlockDeviceMapping")
  111 + ObjectFromReqInput.__init__(self)
82 112 self.optional_param_keys = {"DeviceName": str, "VirtualName": str}
83 113
84 114 class TagsInput(ObjectFromReqInput):
85 115 def __init__(self):
86   - ObjectFromReqInput.__init__(self, "Tags")
  116 + ObjectFromReqInput.__init__(self)
87 117 self.needed_param_keys = {"Key": str, "PropagateAtLaunch": bool, "ResourceId": str, "ResourceType": str, "Value": str}
88 118
89 119 class LaunchConfigurationInput(ObjectFromReqInput):
@@ -110,7 +140,7 @@ def __init__(self):
110 140 ObjectFromReqInput.__init__(self)
111 141
112 142 self.needed_param_list_keys = {'AvailabilityZones': str}
113   - self.optional_param_list_keys = {"Tags": str, "LoadBalancerNames": str}
  143 + self.optional_param_list_keys = {"Tags": TagsInput, "LoadBalancerNames": str}
114 144 self.optional_param_keys = {"DefaultCooldown": int, "DesiredCapacity": int, "HealthCheckGracePeriod": int, "HealthCheckType": str, "PlacementGroup": str, "VPCZoneIdentifier": str}
115 145 self.needed_param_keys = {"AutoScalingGroupName": str, "LaunchConfigurationName": str, "MaxSize": int, "MinSize": int}
116 146
392 pyhantom/nosetests/autoscale_group_tests.py
@@ -8,6 +8,7 @@
8 8 import time
9 9 import uuid
10 10 import pyhantom
  11 +from boto.ec2.autoscale import Tag
11 12
12 13 # this test has a new server ever time to make sure there is a fresh env
13 14 from pyhantom.nosetests.server import RunPwFileServer
@@ -40,122 +41,198 @@ def tearDown(self):
40 41 _TESTONLY_clear_registry()
41 42 self.tst_server.end()
42 43
43   - def test_create_group(self):
44   - group_name = str(uuid.uuid4()).split('-')[0]
45   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
46   - self.con.create_auto_scaling_group(asg)
47   -
48   - def test_create_delete_group(self):
49   - group_name = str(uuid.uuid4()).split('-')[0]
50   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
51   - self.con.create_auto_scaling_group(asg)
52   - self.con.delete_auto_scaling_group(group_name)
53   -
54   - def test_delete_nonexistant_group(self):
55   - group_name = str(uuid.uuid4()).split('-')[0]
56   - try:
57   - self.con.delete_auto_scaling_group(group_name)
58   - self.assertTrue(False, "Should have thrown an exception")
59   - except BotoServerError, ex:
60   - pass
61   -
62   - def test_create_group_twice(self):
63   - group_name = str(uuid.uuid4()).split('-')[0]
64   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
65   - self.con.create_auto_scaling_group(asg)
66   - try:
67   - self.con.create_auto_scaling_group(asg)
68   - self.assertTrue(False, "Should have thrown an exception")
69   - except BotoServerError, ex:
70   - pass
71   -
72   - def test_delete_group_twice(self):
73   - group_name = str(uuid.uuid4()).split('-')[0]
74   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
75   - self.con.create_auto_scaling_group(asg)
76   - self.con.delete_auto_scaling_group(group_name)
77   - try:
78   - self.con.delete_auto_scaling_group(group_name)
79   - self.assertTrue(False, "Should have thrown an exception")
80   - except BotoServerError, ex:
81   - pass
82   -
83   - def test_create_list_delete_group(self):
84   - group_name = str(uuid.uuid4()).split('-')[0]
85   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
86   - self.con.create_auto_scaling_group(asg)
87   - l = self.con.get_all_groups()
88   - self.assertEqual(l[0].name, group_name)
89   - self.con.delete_auto_scaling_group(group_name)
90   -
91   - def test_list_empty(self):
92   - l = self.con.get_all_groups()
93   - self.assertEqual(len(l), 0)
94   -
95   - def test_list_not_there(self):
96   - name = str(uuid.uuid4()).split('-')[0]
97   - try:
98   - x = self.con.get_all_groups(names=[name])
99   - self.assertEqual(len(x), 0)
100   - #self.assertTrue(False, "Should have thrown an exception")
101   - except BotoServerError, ex:
102   - pass
103   -
104   - def test_list_no_contig(self):
105   - element_count = 5
106   - names = []
107   - for i in range(0, element_count):
108   - name = str(uuid.uuid4()).split('-')[0]
109   - names.append(name)
110   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
111   - self.con.create_auto_scaling_group(asg)
112   -
113   - nl = [names[1], names[4]]
114   - x = self.con.get_all_groups(names=nl)
115   - for rc in x:
116   - self.assertTrue(rc.name in nl)
117   -
118   - for n in names:
119   - self.con.delete_auto_scaling_group(n)
120   -
121   -
122   - def test_list_many_asgs(self):
123   - element_count = 5
124   - names = []
125   - for i in range(0, element_count):
126   - name = str(uuid.uuid4()).split('-')[0]
127   - names.append(name)
128   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
129   - self.con.create_auto_scaling_group(asg)
130   -
131   - x = self.con.get_all_groups()
132   - self.assertEqual(len(x), len(names))
133   - for rc in x:
134   - self.assertTrue(rc.name in names)
135   -
136   - for n in names:
137   - self.con.delete_auto_scaling_group(n)
138   -
139   - def test_list_many_asgs_many_times(self):
140   - element_count = 5
141   - names = []
142   - for i in range(0, element_count):
143   - name = str(uuid.uuid4()).split('-')[0]
144   - names.append(name)
145   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
146   - self.con.create_auto_scaling_group(asg)
147   -
148   - for i in range(0, 8):
149   - x = self.con.get_all_groups()
150   - self.assertEqual(len(x), len(names))
151   - for rc in x:
152   - self.assertTrue(rc.name in names)
153   -
154   - for n in names:
155   - self.con.delete_auto_scaling_group(n)
156   -
157   -
158   - def test_set_desired_capacity(self):
  44 +# def test_create_group(self):
  45 +# group_name = str(uuid.uuid4()).split('-')[0]
  46 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  47 +# self.con.create_auto_scaling_group(asg)
  48 +#
  49 +# def test_create_delete_group(self):
  50 +# group_name = str(uuid.uuid4()).split('-')[0]
  51 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  52 +# self.con.create_auto_scaling_group(asg)
  53 +# self.con.delete_auto_scaling_group(group_name)
  54 +#
  55 +# def test_delete_nonexistant_group(self):
  56 +# group_name = str(uuid.uuid4()).split('-')[0]
  57 +# try:
  58 +# self.con.delete_auto_scaling_group(group_name)
  59 +# self.assertTrue(False, "Should have thrown an exception")
  60 +# except BotoServerError, ex:
  61 +# pass
  62 +#
  63 +# def test_create_group_twice(self):
  64 +# group_name = str(uuid.uuid4()).split('-')[0]
  65 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  66 +# self.con.create_auto_scaling_group(asg)
  67 +# try:
  68 +# self.con.create_auto_scaling_group(asg)
  69 +# self.assertTrue(False, "Should have thrown an exception")
  70 +# except BotoServerError, ex:
  71 +# pass
  72 +#
  73 +# def test_delete_group_twice(self):
  74 +# group_name = str(uuid.uuid4()).split('-')[0]
  75 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  76 +# self.con.create_auto_scaling_group(asg)
  77 +# self.con.delete_auto_scaling_group(group_name)
  78 +# try:
  79 +# self.con.delete_auto_scaling_group(group_name)
  80 +# self.assertTrue(False, "Should have thrown an exception")
  81 +# except BotoServerError, ex:
  82 +# pass
  83 +#
  84 +# def test_create_list_delete_group(self):
  85 +# group_name = str(uuid.uuid4()).split('-')[0]
  86 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  87 +# self.con.create_auto_scaling_group(asg)
  88 +# l = self.con.get_all_groups()
  89 +# self.assertEqual(l[0].name, group_name)
  90 +# self.con.delete_auto_scaling_group(group_name)
  91 +#
  92 +# def test_list_empty(self):
  93 +# l = self.con.get_all_groups()
  94 +# self.assertEqual(len(l), 0)
  95 +#
  96 +# def test_list_not_there(self):
  97 +# name = str(uuid.uuid4()).split('-')[0]
  98 +# try:
  99 +# x = self.con.get_all_groups(names=[name])
  100 +# self.assertEqual(len(x), 0)
  101 +# #self.assertTrue(False, "Should have thrown an exception")
  102 +# except BotoServerError, ex:
  103 +# pass
  104 +#
  105 +# def test_list_no_contig(self):
  106 +# element_count = 5
  107 +# names = []
  108 +# for i in range(0, element_count):
  109 +# name = str(uuid.uuid4()).split('-')[0]
  110 +# names.append(name)
  111 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  112 +# self.con.create_auto_scaling_group(asg)
  113 +#
  114 +# nl = [names[1], names[4]]
  115 +# x = self.con.get_all_groups(names=nl)
  116 +# for rc in x:
  117 +# self.assertTrue(rc.name in nl)
  118 +#
  119 +# for n in names:
  120 +# self.con.delete_auto_scaling_group(n)
  121 +#
  122 +#
  123 +# def test_list_many_asgs(self):
  124 +# element_count = 5
  125 +# names = []
  126 +# for i in range(0, element_count):
  127 +# name = str(uuid.uuid4()).split('-')[0]
  128 +# names.append(name)
  129 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  130 +# self.con.create_auto_scaling_group(asg)
  131 +#
  132 +# x = self.con.get_all_groups()
  133 +# self.assertEqual(len(x), len(names))
  134 +# for rc in x:
  135 +# self.assertTrue(rc.name in names)
  136 +#
  137 +# for n in names:
  138 +# self.con.delete_auto_scaling_group(n)
  139 +#
  140 +# def test_list_many_asgs_many_times(self):
  141 +# element_count = 5
  142 +# names = []
  143 +# for i in range(0, element_count):
  144 +# name = str(uuid.uuid4()).split('-')[0]
  145 +# names.append(name)
  146 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  147 +# self.con.create_auto_scaling_group(asg)
  148 +#
  149 +# for i in range(0, 8):
  150 +# x = self.con.get_all_groups()
  151 +# self.assertEqual(len(x), len(names))
  152 +# for rc in x:
  153 +# self.assertTrue(rc.name in names)
  154 +#
  155 +# for n in names:
  156 +# self.con.delete_auto_scaling_group(n)
  157 +#
  158 +#
  159 +# def test_set_desired_capacity(self):
  160 +# group_name = str(uuid.uuid4()).split('-')[0]
  161 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  162 +# self.con.create_auto_scaling_group(asg)
  163 +# l = self.con.get_all_groups(names=[group_name])
  164 +#
  165 +# c = 10
  166 +# asg.set_capacity(c)
  167 +#
  168 +# l = self.con.get_all_groups(names=[group_name])
  169 +# self.assertEqual(c, l[0].desired_capacity)
  170 +#
  171 +# self.assertEqual(l[0].name, group_name)
  172 +# self.con.delete_auto_scaling_group(group_name)
  173 +#
  174 +#
  175 +# def test_check_instances(self):
  176 +# group_name = str(uuid.uuid4()).split('-')[0]
  177 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  178 +# self.con.create_auto_scaling_group(asg)
  179 +# l = self.con.get_all_groups(names=[group_name])
  180 +#
  181 +# c = 1
  182 +# asg.set_capacity(c)
  183 +#
  184 +# l = self.con.get_all_groups(names=[group_name])
  185 +# self.assertEqual(c, l[0].desired_capacity)
  186 +#
  187 +# insts = l[0].instances
  188 +# self.assertEquals(insts[0].group_name, group_name)
  189 +#
  190 +# self.assertEqual(l[0].name, group_name)
  191 +# self.con.delete_auto_scaling_group(group_name)
  192 +#
  193 +# def test_terminate_instance_simple(self):
  194 +# group_name = str(uuid.uuid4()).split('-')[0]
  195 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  196 +# self.con.create_auto_scaling_group(asg)
  197 +# c = 2
  198 +# asg.set_capacity(c)
  199 +# l = self.con.get_all_groups(names=[group_name])
  200 +# insts = l[0].instances
  201 +# self.con.terminate_instance(insts[0].instance_id, decrement_capacity=True)
  202 +#
  203 +# def test_terminate_instance_decrement_capacity(self):
  204 +# group_name = str(uuid.uuid4()).split('-')[0]
  205 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  206 +# self.con.create_auto_scaling_group(asg)
  207 +# c = 2
  208 +# asg.set_capacity(c)
  209 +# l = self.con.get_all_groups(names=[group_name])
  210 +# old_insts = l[0].instances
  211 +# self.con.terminate_instance(old_insts[0].instance_id, decrement_capacity=True)
  212 +#
  213 +# l = self.con.get_all_groups(names=[group_name])
  214 +# new_insts = l[0].instances
  215 +#
  216 +# self.assertEqual(len(old_insts) - 1, len(new_insts))
  217 +# self.assertFalse(old_insts[0].instance_id in [i.instance_id for i in new_insts])
  218 +#
  219 +# def test_terminate_instance_no_decrement_capacity(self):
  220 +# group_name = str(uuid.uuid4()).split('-')[0]
  221 +# asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  222 +# self.con.create_auto_scaling_group(asg)
  223 +# c = 2
  224 +# asg.set_capacity(c)
  225 +# l = self.con.get_all_groups(names=[group_name])
  226 +# old_insts = l[0].instances
  227 +# self.con.terminate_instance(old_insts[0].instance_id, decrement_capacity=False)
  228 +#
  229 +# l = self.con.get_all_groups(names=[group_name])
  230 +# new_insts = l[0].instances
  231 +#
  232 +# self.assertEqual(len(old_insts), len(new_insts))
  233 +# self.assertFalse(old_insts[0].instance_id in [i.instance_id for i in new_insts])
  234 +#
  235 + def test_list_instances(self):
159 236 group_name = str(uuid.uuid4()).split('-')[0]
160 237 asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
161 238 self.con.create_auto_scaling_group(asg)
@@ -164,82 +241,19 @@ def test_set_desired_capacity(self):
164 241 c = 10
165 242 asg.set_capacity(c)
166 243
167   - l = self.con.get_all_groups(names=[group_name])
168   - self.assertEqual(c, l[0].desired_capacity)
169   -
170   - self.assertEqual(l[0].name, group_name)
171   - self.con.delete_auto_scaling_group(group_name)
172   -
173   -
174   - def test_check_instances(self):
175   - group_name = str(uuid.uuid4()).split('-')[0]
176   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
177   - self.con.create_auto_scaling_group(asg)
178   - l = self.con.get_all_groups(names=[group_name])
179   -
180   - c = 1
181   - asg.set_capacity(c)
182   -
183   - l = self.con.get_all_groups(names=[group_name])
184   - self.assertEqual(c, l[0].desired_capacity)
185   -
186   - insts = l[0].instances
187   - self.assertEquals(insts[0].group_name, group_name)
188   -
189   - self.assertEqual(l[0].name, group_name)
190   - self.con.delete_auto_scaling_group(group_name)
191   -
192   - def test_terminate_instance_simple(self):
193   - group_name = str(uuid.uuid4()).split('-')[0]
194   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
195   - self.con.create_auto_scaling_group(asg)
196   - c = 2
197   - asg.set_capacity(c)
198   - l = self.con.get_all_groups(names=[group_name])
199   - insts = l[0].instances
200   - self.con.terminate_instance(insts[0].instance_id, decrement_capacity=True)
201   -
202   - def test_terminate_instance_decrement_capacity(self):
203   - group_name = str(uuid.uuid4()).split('-')[0]
204   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
205   - self.con.create_auto_scaling_group(asg)
206   - c = 2
207   - asg.set_capacity(c)
208   - l = self.con.get_all_groups(names=[group_name])
209   - old_insts = l[0].instances
210   - self.con.terminate_instance(old_insts[0].instance_id, decrement_capacity=True)
211   -
212   - l = self.con.get_all_groups(names=[group_name])
213   - new_insts = l[0].instances
  244 + l = self.con.get_all_autoscaling_instances()
214 245
215   - self.assertEqual(len(old_insts) - 1, len(new_insts))
216   - self.assertFalse(old_insts[0].instance_id in [i.instance_id for i in new_insts])
  246 + self.assertEqual(len(l), c)
217 247
218   - def test_terminate_instance_no_decrement_capacity(self):
  248 + def test_tags(self):
219 249 group_name = str(uuid.uuid4()).split('-')[0]
220   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
221   - self.con.create_auto_scaling_group(asg)
222   - c = 2
223   - asg.set_capacity(c)
224   - l = self.con.get_all_groups(names=[group_name])
225   - old_insts = l[0].instances
226   - self.con.terminate_instance(old_insts[0].instance_id, decrement_capacity=False)
227   -
228   - l = self.con.get_all_groups(names=[group_name])
229   - new_insts = l[0].instances
230 250
231   - self.assertEqual(len(old_insts), len(new_insts))
232   - self.assertFalse(old_insts[0].instance_id in [i.instance_id for i in new_insts])
233   -
234   - def test_list_instances(self):
235   - group_name = str(uuid.uuid4()).split('-')[0]
236   - asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5)
  251 + t = Tag(connection=self.con, key="ThisKey", value="thatValue", resource_id=group_name)
  252 + tags = [t,]
  253 + asg = boto.ec2.autoscale.group.AutoScalingGroup(connection=self.con, group_name=group_name, availability_zones=["us-east-1"], min_size=1, max_size=5, tags=tags)
237 254 self.con.create_auto_scaling_group(asg)
238 255 l = self.con.get_all_groups(names=[group_name])
239   -
240   - c = 10
241   - asg.set_capacity(c)
242   -
243   - l = self.con.get_all_autoscaling_instances()
244   -
245   - self.assertEqual(len(l), c)
  256 + back_tag = l[0].tags[0]
  257 + self.assertEqual(back_tag.key, t.key)
  258 + self.assertEqual(back_tag.value, t.value)
  259 + self.assertEqual(back_tag.resource_id, t.resource_id)
11 pyhantom/out_data_types.py
@@ -167,6 +167,17 @@ def set_from_intype(self, asg, arn):
167 167 self.Status = "Healthy"
168 168 self.SuspendedProcesses = AWSListType('SuspendedProcesses')
169 169 self.Tags = AWSListType('Tags')
  170 +
  171 + if asg.Tags:
  172 + for tag in asg.Tags:
  173 + td = TagDescription('Tag')
  174 + td.Key = tag.Key
  175 + td.PropagateAtLaunch = tag.PropagateAtLaunch
  176 + td.ResourceId = tag.ResourceId
  177 + td.ResourceType = tag.ResourceType
  178 + td.Value = tag.Value
  179 + self.Tags.type_list.append(td)
  180 +
170 181 self.VPCZoneIdentifier = asg.VPCZoneIdentifier
171 182
172 183 if self.DesiredCapacity is None:

0 comments on commit 523c0ae

Please sign in to comment.
Something went wrong with that request. Please try again.