Set variable types, defined choices, and cleaned up whitespace.

pull/18777/head
Ethan Devenport 8 years ago committed by Matt Clay
parent f9e0830b44
commit 403c1ddf7b

@ -580,15 +580,16 @@ def main():
datacenter=dict(),
name=dict(),
image=dict(),
cores=dict(default=2),
ram=dict(default=2048),
cpu_family=dict(default='AMD_OPTERON'),
volume_size=dict(default=10),
disk_type=dict(default='HDD'),
cores=dict(type='int', default=2),
ram=dict(type='int', default=2048),
cpu_family=dict(choices=['AMD_OPTERON', 'INTEL_XEON'],
default='AMD_OPTERON'),
volume_size=dict(type='int', default=10),
disk_type=dict(choices=['HDD', 'SSD'], default='HDD'),
image_password=dict(default=None),
ssh_keys=dict(type='list', default=[]),
bus=dict(default='VIRTIO'),
lan=dict(default=1),
lan=dict(type='int', default=1),
count=dict(type='int', default=1),
auto_increment=dict(type='bool', default=True),
instance_ids=dict(type='list', default=[]),

@ -170,6 +170,7 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
promise['requestId']
) + '" to complete.')
def _create_volume(module, profitbricks, datacenter, name):
size = module.params.get('size')
bus = module.params.get('bus')
@ -204,12 +205,14 @@ def _create_volume(module, profitbricks, datacenter, name):
return volume_response
def _delete_volume(module, profitbricks, datacenter, volume):
try:
profitbricks.delete_volume(datacenter, volume)
except Exception as e:
module.fail_json(msg="failed to remove the volume: %s" % str(e))
def create_volume(module, profitbricks):
"""
Creates a volume.
@ -282,6 +285,7 @@ def create_volume(module, profitbricks):
return results
def delete_volume(module, profitbricks):
"""
Removes a volume.
@ -324,6 +328,7 @@ def delete_volume(module, profitbricks):
return changed
def _attach_volume(module, profitbricks, datacenter, volume):
"""
Attaches a volume.
@ -352,18 +357,19 @@ def _attach_volume(module, profitbricks, datacenter, volume):
except Exception as e:
module.fail_json(msg='failed to attach volume: %s' % str(e))
def main():
module = AnsibleModule(
argument_spec=dict(
datacenter=dict(),
server=dict(),
name=dict(),
size=dict(default=10),
size=dict(type='int', default=10),
bus=dict(default='VIRTIO'),
image=dict(),
image_password=dict(default=None),
ssh_keys=dict(type='list', default=[]),
disk_type=dict(default='HDD'),
disk_type=dict(choices=['HDD', 'SSD'], default='HDD'),
licence_type=dict(default='UNKNOWN'),
count=dict(type='int', default=1),
auto_increment=dict(type='bool', default=True),

Loading…
Cancel
Save