Fix cloudformation module for import of non-module_utils file
This commit is contained in:
parent
59fa35446b
commit
035be94271
2 changed files with 7 additions and 6 deletions
|
@ -242,9 +242,8 @@ stack_outputs:
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import sys
|
|
||||||
import traceback
|
import traceback
|
||||||
|
from hashlib import sha1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import boto3
|
import boto3
|
||||||
|
@ -253,11 +252,12 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_BOTO3 = False
|
HAS_BOTO3 = False
|
||||||
|
|
||||||
|
import ansible.module_utils.ec2
|
||||||
# import a class, otherwise we'll use a fully qualified path
|
# import a class, otherwise we'll use a fully qualified path
|
||||||
from ansible.module_utils.ec2 import AWSRetry
|
from ansible.module_utils.ec2 import AWSRetry
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.utils.hashing import secure_hash_s
|
from ansible.module_utils._text import to_bytes
|
||||||
import ansible.module_utils.ec2
|
|
||||||
|
|
||||||
def boto_exception(err):
|
def boto_exception(err):
|
||||||
'''generic error message handler'''
|
'''generic error message handler'''
|
||||||
|
@ -329,7 +329,9 @@ def create_changeset(module, stack_params, cfn):
|
||||||
try:
|
try:
|
||||||
if not 'ChangeSetName' in stack_params:
|
if not 'ChangeSetName' in stack_params:
|
||||||
# Determine ChangeSetName using hash of parameters.
|
# Determine ChangeSetName using hash of parameters.
|
||||||
changeset_name = 'Ansible-' + stack_params['StackName'] + '-' + secure_hash_s(json.dumps(stack_params, sort_keys=True))
|
json_params = json.dumps(stack_params, sort_keys=True)
|
||||||
|
|
||||||
|
changeset_name = 'Ansible-' + stack_params['StackName'] + '-' + sha1(to_bytes(json_params, errors='surrogate_or_strict')).hexdigest()
|
||||||
stack_params['ChangeSetName'] = changeset_name
|
stack_params['ChangeSetName'] = changeset_name
|
||||||
# Determine if this changeset already exists
|
# Determine if this changeset already exists
|
||||||
pending_changesets = list_changesets(cfn, stack_params['StackName'])
|
pending_changesets = list_changesets(cfn, stack_params['StackName'])
|
||||||
|
|
|
@ -3,7 +3,6 @@ lib/ansible/module_utils/avi.py
|
||||||
lib/ansible/module_utils/azure_rm_common.py
|
lib/ansible/module_utils/azure_rm_common.py
|
||||||
lib/ansible/module_utils/ovirt.py
|
lib/ansible/module_utils/ovirt.py
|
||||||
lib/ansible/module_utils/six/__init__.py
|
lib/ansible/module_utils/six/__init__.py
|
||||||
lib/ansible/modules/cloud/amazon/cloudformation.py
|
|
||||||
lib/ansible/modules/cloud/amazon/cloudtrail.py
|
lib/ansible/modules/cloud/amazon/cloudtrail.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py
|
lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py
|
lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py
|
||||||
|
|
Loading…
Reference in a new issue