Correcting issues raised by @abadger.
This commit is contained in:
parent
689a7524bf
commit
fd55a30757
1 changed files with 10 additions and 12 deletions
|
@ -119,7 +119,9 @@ options:
|
||||||
default: 'present'
|
default: 'present'
|
||||||
choices: [ "running", "stopped", "absent", "present" ]
|
choices: [ "running", "stopped", "absent", "present" ]
|
||||||
|
|
||||||
requirements: [ "profitbricks" ]
|
requirements:
|
||||||
|
- "profitbricks"
|
||||||
|
- "python >= 2.6"
|
||||||
author: Matt Baldwin (baldwin@stackpointcloud.com)
|
author: Matt Baldwin (baldwin@stackpointcloud.com)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -178,8 +180,6 @@ EXAMPLES = '''
|
||||||
import re
|
import re
|
||||||
import uuid
|
import uuid
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
HAS_PB_SDK = True
|
HAS_PB_SDK = True
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ def _create_machine(module, profitbricks, datacenter, name):
|
||||||
image = module.params.get('image')
|
image = module.params.get('image')
|
||||||
assign_public_ip = module.boolean(module.params.get('assign_public_ip'))
|
assign_public_ip = module.boolean(module.params.get('assign_public_ip'))
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Generate name, but grab first 10 chars so we don't
|
# Generate name, but grab first 10 chars so we don't
|
||||||
|
@ -298,8 +298,6 @@ def _create_machine(module, profitbricks, datacenter, name):
|
||||||
wait_timeout, "create_virtual_machine")
|
wait_timeout, "create_virtual_machine")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# return (json.dumps(server_response))
|
|
||||||
return (server_response)
|
return (server_response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="failed to create the new server: %s" % str(e))
|
module.fail_json(msg="failed to create the new server: %s" % str(e))
|
||||||
|
@ -307,7 +305,7 @@ def _create_machine(module, profitbricks, datacenter, name):
|
||||||
def _remove_machine(module, profitbricks, datacenter, name):
|
def _remove_machine(module, profitbricks, datacenter, name):
|
||||||
remove_boot_volume = module.params.get('remove_boot_volume')
|
remove_boot_volume = module.params.get('remove_boot_volume')
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
# User provided the actual UUID instead of the name.
|
# User provided the actual UUID instead of the name.
|
||||||
|
@ -349,7 +347,7 @@ def _startstop_machine(module, profitbricks, datacenter, name):
|
||||||
def _create_datacenter(module, profitbricks):
|
def _create_datacenter(module, profitbricks):
|
||||||
datacenter = module.params.get('datacenter')
|
datacenter = module.params.get('datacenter')
|
||||||
location = module.params.get('location')
|
location = module.params.get('location')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
|
|
||||||
i = Datacenter(
|
i = Datacenter(
|
||||||
name=datacenter,
|
name=datacenter,
|
||||||
|
@ -381,7 +379,7 @@ def create_virtual_machine(module, profitbricks):
|
||||||
auto_increment = module.params.get('auto_increment')
|
auto_increment = module.params.get('auto_increment')
|
||||||
count = module.params.get('count')
|
count = module.params.get('count')
|
||||||
lan = module.params.get('lan')
|
lan = module.params.get('lan')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
failed = True
|
failed = True
|
||||||
datacenter_found = False
|
datacenter_found = False
|
||||||
|
|
||||||
|
@ -502,7 +500,7 @@ def startstop_machine(module, profitbricks, state):
|
||||||
module.fail_json(msg='instance_ids should be a list of virtual machine ids or names, aborting')
|
module.fail_json(msg='instance_ids should be a list of virtual machine ids or names, aborting')
|
||||||
|
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
datacenter = module.params.get('datacenter')
|
datacenter = module.params.get('datacenter')
|
||||||
|
@ -574,7 +572,7 @@ def main():
|
||||||
location=dict(choices=LOCATIONS, default='us/las'),
|
location=dict(choices=LOCATIONS, default='us/las'),
|
||||||
assign_public_ip=dict(type='bool', default=False),
|
assign_public_ip=dict(type='bool', default=False),
|
||||||
wait=dict(type='bool', default=True),
|
wait=dict(type='bool', default=True),
|
||||||
wait_timeout=dict(default=600),
|
wait_timeout=dict(type='int', default=600),
|
||||||
remove_boot_volume=dict(type='bool', default=True),
|
remove_boot_volume=dict(type='bool', default=True),
|
||||||
state=dict(default='present'),
|
state=dict(default='present'),
|
||||||
)
|
)
|
||||||
|
@ -586,7 +584,7 @@ def main():
|
||||||
subscription_user = module.params.get('subscription_user')
|
subscription_user = module.params.get('subscription_user')
|
||||||
subscription_password = module.params.get('subscription_password')
|
subscription_password = module.params.get('subscription_password')
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = module.params.get('wait_timeout')
|
||||||
|
|
||||||
profitbricks = ProfitBricksService(
|
profitbricks = ProfitBricksService(
|
||||||
username=subscription_user,
|
username=subscription_user,
|
||||||
|
|
Loading…
Add table
Reference in a new issue