Last active
January 19, 2017 16:40
-
-
Save nareshov/29795c8a4b434bb5c06b2d1eea9f058f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/salt/modules/boto_rds.py b/salt/modules/boto_rds.py | |
index 776e65a..30d6569 100644 | |
--- a/salt/modules/boto_rds.py | |
+++ b/salt/modules/boto_rds.py | |
@@ -326,8 +326,6 @@ def create_read_replica(name, source_name, db_instance_class=None, | |
salt myminion boto_rds.create_read_replica replicaname source_name | |
''' | |
- if not backup_retention_period: | |
- raise SaltInvocationError('backup_retention_period is required') | |
res = __salt__['boto_rds.exists'](source_name, tags, region, key, keyid, profile) | |
if not res.get('exists'): | |
return {'exists': bool(res), 'message': | |
diff --git a/salt/states/boto_rds.py b/salt/states/boto_rds.py | |
index 6475624..ff3d425 100644 | |
--- a/salt/states/boto_rds.py | |
+++ b/salt/states/boto_rds.py | |
@@ -382,7 +382,8 @@ def replica_present(name, source, db_instance_class=None, | |
} | |
replica_exists = __salt__['boto_rds.exists'](name, tags, region, key, | |
keyid, profile) | |
- if not replica_exists: | |
+ if not replica_exists or 'error' in replica_exists \ | |
+ and 'DBInstanceNotFound' in replica_exists['error']['message']: | |
if __opts__['test']: | |
ret['comment'] = 'RDS read replica {0} is set to be created '.format(name) | |
ret['result'] = None | |
@@ -490,25 +491,21 @@ def subnet_group_present(name, description, subnet_ids=None, subnet_names=None, | |
exists = __salt__['boto_rds.subnet_group_exists'](name=name, tags=tags, region=region, key=key, | |
keyid=keyid, profile=profile) | |
- if not exists: | |
+ if not exists or 'error' in exists \ | |
+ and 'DBSubnetGroupNotFoundFault' in exists['error']['message']: | |
if __opts__['test']: | |
ret['comment'] = 'Subnet group {0} is set to be created.'.format(name) | |
ret['result'] = None | |
return ret | |
- if not r.get('created'): | |
- ret['result'] = False | |
- ret['comment'] = 'Failed to create {0} subnet group.'.format(r['error']['message']) | |
- return ret | |
- created = __salt__['boto_rds.create_subnet_group'](name=name, | |
+ r = __salt__['boto_rds.create_subnet_group'](name=name, | |
description=description, | |
subnet_ids=subnet_ids, | |
tags=tags, region=region, | |
key=key, keyid=keyid, | |
profile=profile) | |
- | |
- if not created: | |
+ if not r.get('created'): | |
ret['result'] = False | |
- ret['comment'] = 'Failed to create {0} subnet group.'.format(name) | |
+ ret['comment'] = 'Failed to create {0} subnet group.'.format(r['error']['message']) | |
return ret | |
ret['changes']['old'] = None | |
ret['changes']['new'] = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment