mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-07 08:54:01 -07:00
Get hipchat, sns, and typetalk notification modules compiling on py3 (#2782)
This commit is contained in:
parent
4999bb28cd
commit
7a8b080506
4 changed files with 54 additions and 29 deletions
|
@ -61,7 +61,7 @@ options:
|
|||
required: false
|
||||
aws_secret_key:
|
||||
description:
|
||||
- AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
|
||||
- AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
|
||||
required: false
|
||||
default: None
|
||||
aliases: ['ec2_secret_key', 'secret_key']
|
||||
|
@ -77,7 +77,8 @@ options:
|
|||
required: false
|
||||
aliases: ['aws_region', 'ec2_region']
|
||||
|
||||
requirements: [ "boto" ]
|
||||
requirements:
|
||||
- "boto"
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
|
@ -97,10 +98,14 @@ EXAMPLES = """
|
|||
topic: "deploy"
|
||||
"""
|
||||
|
||||
import sys
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.ec2 import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ec2 import ec2_argument_spec, connect_to_aws, get_aws_connection_info
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
try:
|
||||
import boto
|
||||
|
@ -156,7 +161,8 @@ def main():
|
|||
module.fail_json(msg="region must be specified")
|
||||
try:
|
||||
connection = connect_to_aws(boto.sns, region, **aws_connect_params)
|
||||
except boto.exception.NoAuthHandlerFound, e:
|
||||
except boto.exception.NoAuthHandlerFound:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# .publish() takes full ARN topic id, but I'm lazy and type shortnames
|
||||
|
@ -185,9 +191,11 @@ def main():
|
|||
try:
|
||||
connection.publish(topic=arn_topic, subject=subject,
|
||||
message_structure='json', message=json_msg)
|
||||
except boto.exception.BotoServerError, e:
|
||||
except boto.exception.BotoServerError:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
module.exit_json(msg="OK")
|
||||
|
||||
main()
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue