Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Commit

Permalink
Fix bug with storing aws_resource_id when using external resource flag (
Browse files Browse the repository at this point in the history
#103)

* Fix bug with storing aws_resource_id when using external resource flag

* adding to plugin yaml version
  • Loading branch information
mabuaisha authored and EarthmanT committed Dec 19, 2017
1 parent 6395919 commit d79bece
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.2.0.1:
- Fix bug with empty runtime properties for node when ``use_external_resource``
is set True

1.2.0:
- VPC Peering.

1.0.1:
- Add ECS support (Cluster, Service, Task Definition) + Blueprint Example.
- Fix several bugs with ELBv2.
Expand Down
14 changes: 13 additions & 1 deletion cloudify_awssdk/common/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
~~~~~~~~~~~~~~~~~
AWS decorators
'''
# Cloudify
# Cloudify imports
from cloudify.exceptions import (OperationRetry, NonRecoverableError)

# Local imports
from cloudify_awssdk.common import utils
from cloudify_awssdk.common.constants import (
EXTERNAL_RESOURCE_ARN as EXT_RES_ARN,
Expand Down Expand Up @@ -96,6 +98,8 @@ def wrapper_inner(**kwargs):
resource_id=utils.get_resource_id(
node=ctx.node,
instance=ctx.instance)) if class_decl else None

resource_config = None
if not ignore_properties:
# Normalize resource_config property
resource_config = props.get('resource_config') or dict()
Expand All @@ -115,6 +119,7 @@ def wrapper_inner(**kwargs):
and runtime_instance_properties.get('resource_config'):
kwargs['resource_config'] =\
runtime_instance_properties['resource_config']
resource_config = kwargs['resource_config']

# Check if using external
if ctx.node.properties.get('use_external_resource', False):
Expand All @@ -123,6 +128,13 @@ def wrapper_inner(**kwargs):
ctx.logger.info('%s ID# "%s" is user-provided.'
% (resource_type, resource_id))
if not kwargs.get('force_operation', False):
# If ``force_operation`` is not set then we need to make
# sure that runtime properties for node instance are
# setting correctly
# Set ``resource_config`` and ``EXT_RES_ID``
ctx.instance.runtime_properties[
'resource_config'] = resource_config
ctx.instance.runtime_properties[EXT_RES_ID] = resource_id
return
ctx.logger.warn('%s ID# "%s" has force_operation set.'
% (resource_type, resource_id))
Expand Down
2 changes: 1 addition & 1 deletion cloudify_awssdk/common/tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def test_with_mock(*args, **kwargs):
{'aws_resource_arn': 'res_id',
'aws_resource_id': 'aws_id',
'a': 'b',
'resource_config': {}})
'resource_config': {'c': 'd'}})

mock_func.assert_not_called()

Expand Down
4 changes: 2 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ plugins:

awssdk:
executor: central_deployment_agent
source: https://github.com//cloudify-incubator/cloudify-awssdk-plugin/archive/1.2.0.zip
source: https://github.com//cloudify-incubator/cloudify-awssdk-plugin/archive/1.2.0.1.zip
package_name: cloudify-awssdk-plugin
package_version: '1.2.0'
package_version: '1.2.0.1'

data_types:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name='cloudify-awssdk-plugin',
version='1.2.0',
version='1.2.0.1',
license='LICENSE',
packages=find_packages(exclude=['tests*']),
description='A Cloudify plugin for AWS',
Expand Down

0 comments on commit d79bece

Please sign in to comment.