diff --git a/cloudify_aws/common/decorators.py b/cloudify_aws/common/decorators.py index ab5c2872b..250f11016 100644 --- a/cloudify_aws/common/decorators.py +++ b/cloudify_aws/common/decorators.py @@ -338,12 +338,12 @@ def _aws_resource(function, resource_config = kwargs['resource_config'] resource_id = utils.get_resource_id(node=ctx.node, instance=ctx.instance) # Check if using external + iface = kwargs.get('iface') if props.get('use_external_resource') and \ 'cloudify.nodes.aws.ec2.Image' in ctx.node.type_hierarchy and \ operation_name == 'create': pass - iface = kwargs.get('iface') - if ctx.node.properties.get('use_external_resource', False): + elif ctx.node.properties.get('use_external_resource', False): ctx.logger.info('{t} ID# {i} is user-provided.'.format( t=resource_type, i=resource_id)) if not kwargs.get('force_operation', False) and \ diff --git a/cloudify_aws/ec2/resources/image.py b/cloudify_aws/ec2/resources/image.py index 778c5223a..6f279d2a4 100644 --- a/cloudify_aws/ec2/resources/image.py +++ b/cloudify_aws/ec2/resources/image.py @@ -42,7 +42,7 @@ def __init__(self, ctx_node, resource_id=None, client=None, logger=None): self.type_name = RESOURCE_TYPE image_filters = ctx_node.properties["resource_config"].get( "kwargs", {}).get("Filters") - self.describe_image_filters = None + self._describe_image_filters = None if resource_id: self.prepare_describe_image_filter({IMAGE_IDS: [resource_id]}) elif image_filters: @@ -52,6 +52,7 @@ def __init__(self, ctx_node, resource_id=None, client=None, logger=None): def properties(self): """Gets the properties of an external resource""" params = self.describe_image_filters + self.logger.info('Params: {}'.format(params)) if not params: return try: @@ -96,6 +97,10 @@ def delete(self, params=None): self.logger.debug('Deregistering ImageId %s' % params.get('ImageId')) self.client.deregister_image(**params) + @property + def describe_image_filters(self): + return self._describe_image_filters + def prepare_describe_image_filter(self, params): dry_run = params.get(DRY_RUN, False) image_ids = params.get(IMAGE_IDS, []) @@ -103,7 +108,7 @@ def prepare_describe_image_filter(self, params): executable_users = params.get(EXECUTABLE_USERS, []) filters = params.get(FILTERS, []) if any([dry_run, image_ids, owners, executable_users, filters]): - self.describe_image_filters = { + self._describe_image_filters = { DRY_RUN: dry_run, IMAGE_IDS: image_ids, OWNERS: owners,