Merge pull request #718 from bcoca/rds_refactor_fixes

minor fixes on new rds refactor
This commit is contained in:
Brian Coca 2015-01-28 12:49:20 -05:00
commit 82afff31a9

View file

@ -251,7 +251,7 @@ EXAMPLES = '''
# Basic mysql provisioning example # Basic mysql provisioning example
- rds: - rds:
command: create command: create
instance_name: new_database instance_name: new-database
db_engine: MySQL db_engine: MySQL
size: 10 size: 10
instance_type: db.m1.small instance_type: db.m1.small
@ -264,7 +264,7 @@ EXAMPLES = '''
# Create a read-only replica and wait for it to become available # Create a read-only replica and wait for it to become available
- rds: - rds:
command: replicate command: replicate
instance_name: new_database_replica instance_name: new-database-replica
source_instance: new_database source_instance: new_database
wait: yes wait: yes
wait_timeout: 600 wait_timeout: 600
@ -272,20 +272,20 @@ EXAMPLES = '''
# Delete an instance, but create a snapshot before doing so # Delete an instance, but create a snapshot before doing so
- rds: - rds:
command: delete command: delete
instance_name: new_database instance_name: new-database
snapshot: new_database_snapshot snapshot: new_database_snapshot
# Get facts about an instance # Get facts about an instance
- rds: - rds:
command: facts command: facts
instance_name: new_database instance_name: new-database
register: new_database_facts register: new_database_facts
# Rename an instance and wait for the change to take effect # Rename an instance and wait for the change to take effect
- rds: - rds:
command: modify command: modify
instance_name: new_database instance_name: new-database
new_instance_name: renamed_database new_instance_name: renamed-database
wait: yes wait: yes
''' '''
@ -392,7 +392,7 @@ class RDSConnection:
def promote_read_replica(self, instance_name, **params): def promote_read_replica(self, instance_name, **params):
try: try:
result = self.connection.promote_read_replica(instance_name, **params) result = self.connection.promote_read_replica(instance_name, **params)
return RDSInstance(result) return RDSDBInstance(result)
except boto.exception.BotoServerError, e: except boto.exception.BotoServerError, e:
raise RDSException(e) raise RDSException(e)
@ -652,7 +652,7 @@ def create_db_instance(module, conn):
module.params.get('username'), module.params.get('password'), **params) module.params.get('username'), module.params.get('password'), **params)
changed = True changed = True
except RDSException, e: except RDSException, e:
module.fail_json(msg=e.message) module.fail_json(msg="failed to create instance: %s" % e.message)
if module.params.get('wait'): if module.params.get('wait'):
resource = await_resource(conn, result, 'available', module) resource = await_resource(conn, result, 'available', module)
@ -679,7 +679,7 @@ def replicate_db_instance(module, conn):
result = conn.create_db_instance_read_replica(instance_name, source_instance, **params) result = conn.create_db_instance_read_replica(instance_name, source_instance, **params)
changed = True changed = True
except RDSException, e: except RDSException, e:
module.fail_json(msg=e.message) module.fail_json(msg="failed to create replica instance: %s " % e.message)
if module.params.get('wait'): if module.params.get('wait'):
resource = await_resource(conn, result, 'available', module) resource = await_resource(conn, result, 'available', module)
@ -715,7 +715,7 @@ def delete_db_instance_or_snapshot(module, conn):
else: else:
result = conn.delete_db_snapshot(snapshot) result = conn.delete_db_snapshot(snapshot)
except RDSException, e: except RDSException, e:
module.fail_json(msg=e.message) module.fail_json(msg="failed to delete instance: %s" % e.message)
# If we're not waiting for a delete to complete then we're all done # If we're not waiting for a delete to complete then we're all done
# so just return # so just return