Mitch Garnaat

Fixing some ugly code.

...@@ -29,7 +29,7 @@ class AWSClient(object): ...@@ -29,7 +29,7 @@ class AWSClient(object):
29 self._service_name = service_name 29 self._service_name = service_name
30 self._region_name = region_name 30 self._region_name = region_name
31 self._profile_name = profile_name 31 self._profile_name = profile_name
32 - self._client = self._create_client() 32 + self.client = self._create_client()
33 33
34 @property 34 @property
35 def service_name(self): 35 def service_name(self):
...@@ -80,12 +80,12 @@ class AWSClient(object): ...@@ -80,12 +80,12 @@ class AWSClient(object):
80 LOG.debug(kwargs) 80 LOG.debug(kwargs)
81 if query: 81 if query:
82 query = jmespath.compile(query) 82 query = jmespath.compile(query)
83 - if self._client.can_paginate(op_name): 83 + if self.client.can_paginate(op_name):
84 - paginator = self._client.get_paginator(op_name) 84 + paginator = self.client.get_paginator(op_name)
85 results = paginator.paginate(**kwargs) 85 results = paginator.paginate(**kwargs)
86 data = results.build_full_result() 86 data = results.build_full_result()
87 else: 87 else:
88 - op = getattr(self._client, op_name) 88 + op = getattr(self.client, op_name)
89 data = op(**kwargs) 89 data = op(**kwargs)
90 if query: 90 if query:
91 data = query.search(data) 91 data = query.search(data)
...@@ -99,7 +99,7 @@ def save_recordings(recording_path): ...@@ -99,7 +99,7 @@ def save_recordings(recording_path):
99 for key in _client_cache: 99 for key in _client_cache:
100 client = _client_cache[key] 100 client = _client_cache[key]
101 full_path = os.path.join(recording_path, '{}.json'.format(key)) 101 full_path = os.path.join(recording_path, '{}.json'.format(key))
102 - client._client.meta.placebo.save(full_path) 102 + client.client.meta.placebo.save(full_path)
103 103
104 104
105 def create_client(service_name, context): 105 def create_client(service_name, context):
...@@ -116,9 +116,9 @@ def create_client(service_name, context): ...@@ -116,9 +116,9 @@ def create_client(service_name, context):
116 placebo_cfg['recording_path'], 116 placebo_cfg['recording_path'],
117 '{}.json'.format(client_key)) 117 '{}.json'.format(client_key))
118 if os.path.exists(full_path): 118 if os.path.exists(full_path):
119 - client._client.meta.placebo.load(full_path) 119 + client.client.meta.placebo.load(full_path)
120 - client._client.meta.placebo.start() 120 + client.client.meta.placebo.start()
121 elif placebo_cfg['mode'] == 'record': 121 elif placebo_cfg['mode'] == 'record':
122 - client._client.meta.placebo.record() 122 + client.client.meta.placebo.record()
123 _client_cache[client_key] = client 123 _client_cache[client_key] = client
124 return _client_cache[client_key] 124 return _client_cache[client_key]
......
...@@ -315,14 +315,14 @@ class Function(object): ...@@ -315,14 +315,14 @@ class Function(object):
315 # First find the SHA256 of $LATEST 315 # First find the SHA256 of $LATEST
316 if not version: 316 if not version:
317 versions = self.list_versions() 317 versions = self.list_versions()
318 - for version in versions: 318 + for v in versions:
319 - if version['Version'] == '$LATEST': 319 + if v['Version'] == '$LATEST':
320 - latest_sha256 = version['CodeSha256'] 320 + latest_sha256 = v['CodeSha256']
321 break 321 break
322 - for version in versions: 322 + for v in versions:
323 - if version['Version'] != '$LATEST': 323 + if v['Version'] != '$LATEST':
324 - if version['CodeSha256'] == latest_sha256: 324 + if v['CodeSha256'] == latest_sha256:
325 - version = version['Version'] 325 + version = v['Version']
326 break 326 break
327 try: 327 try:
328 LOG.info('creating alias %s=%s', name, version) 328 LOG.info('creating alias %s=%s', name, version)
......