Pep8 fixes for digital_ocean_*

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/24368/head
Abhijeet Kasurde 8 years ago committed by Matt Clay
parent 9c5b55232c
commit 2425143cf2

@ -211,12 +211,14 @@ from ansible.module_utils.basic import AnsibleModule
class TimeoutError(Exception):
def __init__(self, msg, id_):
super(TimeoutError, self).__init__(msg)
self.id = id_
class JsonfyMixIn(object):
def to_json(self):
return self.__dict__
@ -276,8 +278,8 @@ class Droplet(JsonfyMixIn):
backups_enabled_lower = str(backups_enabled).lower()
ipv6_lower = str(ipv6).lower()
json = cls.manager.new_droplet(name, size_id, image_id, region_id,
ssh_key_ids=ssh_key_ids, virtio=virtio, private_networking=private_networking_lower,
backups_enabled=backups_enabled_lower, user_data=user_data, ipv6=ipv6_lower)
ssh_key_ids=ssh_key_ids, virtio=virtio, private_networking=private_networking_lower,
backups_enabled=backups_enabled_lower, user_data=user_data, ipv6=ipv6_lower)
droplet = cls(json)
return droplet
@ -432,35 +434,35 @@ def core(module):
def main():
module = AnsibleModule(
argument_spec = dict(
command = dict(choices=['droplet', 'ssh'], default='droplet'),
state = dict(choices=['active', 'present', 'absent', 'deleted'], default='present'),
api_token = dict(aliases=['API_TOKEN'], no_log=True),
name = dict(type='str'),
size_id = dict(),
image_id = dict(),
region_id = dict(),
ssh_key_ids = dict(type='list'),
virtio = dict(type='bool', default='yes'),
private_networking = dict(type='bool', default='no'),
backups_enabled = dict(type='bool', default='no'),
id = dict(aliases=['droplet_id'], type='int'),
unique_name = dict(type='bool', default='no'),
user_data = dict(default=None),
ipv6 = dict(type='bool', default='no'),
wait = dict(type='bool', default=True),
wait_timeout = dict(default=300, type='int'),
ssh_pub_key = dict(type='str'),
argument_spec=dict(
command=dict(choices=['droplet', 'ssh'], default='droplet'),
state=dict(choices=['active', 'present', 'absent', 'deleted'], default='present'),
api_token=dict(aliases=['API_TOKEN'], no_log=True),
name=dict(type='str'),
size_id=dict(),
image_id=dict(),
region_id=dict(),
ssh_key_ids=dict(type='list'),
virtio=dict(type='bool', default='yes'),
private_networking=dict(type='bool', default='no'),
backups_enabled=dict(type='bool', default='no'),
id=dict(aliases=['droplet_id'], type='int'),
unique_name=dict(type='bool', default='no'),
user_data=dict(default=None),
ipv6=dict(type='bool', default='no'),
wait=dict(type='bool', default=True),
wait_timeout=dict(default=300, type='int'),
ssh_pub_key=dict(type='str'),
),
required_together = (
required_together=(
['size_id', 'image_id', 'region_id'],
),
mutually_exclusive = (
mutually_exclusive=(
['size_id', 'ssh_pub_key'],
['image_id', 'ssh_pub_key'],
['region_id', 'ssh_pub_key'],
),
required_one_of = (
required_one_of=(
['id', 'name'],
),
)

@ -190,7 +190,7 @@ class DOBlockStorage(object):
os.environ['DO_API_TOKEN'] or os.environ['DO_API_KEY']
self.module = module
self.rest = Rest(module, {'Authorization': 'Bearer {}'.format(api_token),
'Content-type': 'application/json'})
'Content-type': 'application/json'})
def get_key_or_fail(self, k):
v = self.module.params[k]
@ -325,15 +325,15 @@ def handle_request(module):
def main():
module = AnsibleModule(
argument_spec=dict(
state = dict(choices=['present', 'absent'], required=True),
command = dict(choices=['create', 'attach'], required=True),
api_token = dict(aliases=['API_TOKEN'], no_log=True),
block_size = dict(type='int'),
volume_name = dict(type='str', required=True),
description = dict(type='str'),
region = dict(type='str', required=True),
droplet_id = dict(type='int'),
timeout = dict(type='int', default=10),
state=dict(choices=['present', 'absent'], required=True),
command=dict(choices=['create', 'attach'], required=True),
api_token=dict(aliases=['API_TOKEN'], no_log=True),
block_size=dict(type='int'),
volume_name=dict(type='str', required=True),
description=dict(type='str'),
region=dict(type='str', required=True),
droplet_id=dict(type='int'),
timeout=dict(type='int', default=10),
),
)
try:

@ -99,6 +99,7 @@ from ansible.module_utils.basic import AnsibleModule
class JsonfyMixIn(object):
def to_json(self):
return self.__dict__
@ -226,14 +227,14 @@ def core(module):
def main():
module = AnsibleModule(
argument_spec = dict(
state = dict(choices=['present', 'absent'], default='present'),
api_token = dict(aliases=['API_TOKEN'], no_log=True),
name = dict(type='str'),
id = dict(aliases=['droplet_id'], type='int'),
ip = dict(type='str'),
argument_spec=dict(
state=dict(choices=['present', 'absent'], default='present'),
api_token=dict(aliases=['API_TOKEN'], no_log=True),
name=dict(type='str'),
id=dict(aliases=['droplet_id'], type='int'),
ip=dict(type='str'),
),
required_one_of = (
required_one_of=(
['id', 'name'],
),
)

@ -86,6 +86,7 @@ from ansible.module_utils.basic import AnsibleModule
class JsonfyMixIn(object):
def to_json(self):
return self.__dict__
@ -161,15 +162,15 @@ def core(module):
def main():
module = AnsibleModule(
argument_spec = dict(
state = dict(choices=['present', 'absent'], default='present'),
client_id = dict(aliases=['CLIENT_ID'], no_log=True),
api_key = dict(aliases=['API_KEY'], no_log=True),
name = dict(type='str'),
id = dict(aliases=['droplet_id'], type='int'),
ssh_pub_key = dict(type='str'),
argument_spec=dict(
state=dict(choices=['present', 'absent'], default='present'),
client_id=dict(aliases=['CLIENT_ID'], no_log=True),
api_key=dict(aliases=['API_KEY'], no_log=True),
name=dict(type='str'),
id=dict(aliases=['droplet_id'], type='int'),
ssh_pub_key=dict(type='str'),
),
required_one_of = (
required_one_of=(
['id', 'name'],
),
)

@ -253,10 +253,6 @@ lib/ansible/modules/cloud/cloudstack/cs_vmsnapshot.py
lib/ansible/modules/cloud/cloudstack/cs_volume.py
lib/ansible/modules/cloud/cloudstack/cs_zone.py
lib/ansible/modules/cloud/cloudstack/cs_zone_facts.py
lib/ansible/modules/cloud/digital_ocean/digital_ocean.py
lib/ansible/modules/cloud/digital_ocean/digital_ocean_block_storage.py
lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py
lib/ansible/modules/cloud/digital_ocean/digital_ocean_sshkey.py
lib/ansible/modules/cloud/docker/_docker.py
lib/ansible/modules/cloud/docker/docker_container.py
lib/ansible/modules/cloud/docker/docker_image.py

Loading…
Cancel
Save