Deprecated _ec2_ami_search now verifies SSL certificates
This commit is contained in:
parent
cf25888e2d
commit
01f8a99509
1 changed files with 18 additions and 6 deletions
|
@ -65,6 +65,15 @@ options:
|
|||
required: false
|
||||
default: paravirtual
|
||||
choices: ["paravirtual", "hvm"]
|
||||
validate_certs:
|
||||
description:
|
||||
- If C(no), SSL certificates will not be validated. This should only
|
||||
be set to C(no) used on personally controlled sites using self-signed
|
||||
certificates. Prior to 1.9.3 the code defaulted to C(no).
|
||||
required: false
|
||||
default: 'yes'
|
||||
choices: ['yes', 'no']
|
||||
version_added: '1.9.3'
|
||||
|
||||
author: Lorin Hochstein
|
||||
'''
|
||||
|
@ -102,11 +111,12 @@ AWS_REGIONS = ['ap-northeast-1',
|
|||
|
||||
def get_url(module, url):
|
||||
""" Get url and return response """
|
||||
try:
|
||||
r = urllib2.urlopen(url)
|
||||
except (urllib2.HTTPError, urllib2.URLError), e:
|
||||
code = getattr(e, 'code', -1)
|
||||
module.fail_json(msg="Request failed: %s" % str(e), status_code=code)
|
||||
|
||||
r, info = fetch_url(module, url)
|
||||
if info['status'] != 200:
|
||||
# Backwards compat
|
||||
info['status_code'] = info['status']
|
||||
module.fail_json(**info)
|
||||
return r
|
||||
|
||||
|
||||
|
@ -182,7 +192,8 @@ def main():
|
|||
choices=['i386', 'amd64']),
|
||||
region=dict(required=False, default='us-east-1', choices=AWS_REGIONS),
|
||||
virt=dict(required=False, default='paravirtual',
|
||||
choices=['paravirtual', 'hvm'])
|
||||
choices=['paravirtual', 'hvm']),
|
||||
validate_certs = dict(required=False, default=True, type='bool'),
|
||||
)
|
||||
module = AnsibleModule(argument_spec=arg_spec)
|
||||
distro = module.params['distro']
|
||||
|
@ -196,6 +207,7 @@ def main():
|
|||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.urls import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue