exoscale: pep8 and python3 fixes (#21821)

* exoscale: pep8 fixes

* exo_dns_record: remove from pep8 test legacy

* exoscale: fix python3 support
This commit is contained in:
René Moser 2017-02-25 10:32:39 +01:00 committed by GitHub
parent 2ca5719168
commit d26c57f938
4 changed files with 59 additions and 41 deletions

View file

@ -184,8 +184,12 @@ exo_dns_domain:
sample: false
'''
# import exoscale common
from ansible.module_utils.exoscale import *
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.exoscale import (
ExoDns,
exo_dns_argument_spec,
exo_dns_required_together
)
class ExoDnsDomain(ExoDns):
@ -252,8 +256,6 @@ def main():
module.exit_json(**result)
# import module snippets
from ansible.module_utils.basic import *
if __name__ == '__main__':
main()

View file

@ -244,8 +244,30 @@ exo_dns_record:
sample: "2016-08-12T15:24:23.989Z"
'''
# import exoscale common
from ansible.module_utils.exoscale import *
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.exoscale import (
ExoDns,
exo_dns_argument_spec,
exo_dns_required_together
)
EXO_RECORD_TYPES = [
'A',
'ALIAS',
'CNAME',
'MX',
'SPF',
'URL',
'TXT',
'NS',
'SRV',
'NAPTR',
'PTR',
'AAAA',
'SSHFP',
'HINFO',
'POOL'
]
class ExoDnsRecord(ExoDns):
@ -267,7 +289,6 @@ class ExoDnsRecord(ExoDns):
if self.multiple and self.record_type != 'A':
self.module.fail_json("Multiple is only usable with record_type A")
def _create_record(self, record):
self.result['changed'] = True
data = {
@ -357,7 +378,7 @@ def main():
argument_spec = exo_dns_argument_spec()
argument_spec.update(dict(
name=dict(default=""),
record_type=dict(choices=['A', 'ALIAS', 'CNAME', 'MX', 'SPF', 'URL', 'TXT', 'NS', 'SRV', 'NAPTR', 'PTR', 'AAAA', 'SSHFP', 'HINFO', 'POOL'], aliases=['rtype', 'type'], default='A'),
record_type=dict(choices=EXO_RECORD_TYPES, aliases=['rtype', 'type'], default='A'),
content=dict(aliases=['value', 'address']),
multiple=(dict(type='bool', default=False)),
ttl=dict(type='int', default=3600),
@ -388,8 +409,6 @@ def main():
result = exo_dns_record.get_result(resource)
module.exit_json(**result)
# import module snippets
from ansible.module_utils.basic import *
if __name__ == '__main__':
main()