Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #581 #583

Merged
merged 3 commits into from Oct 8, 2016
Merged

Fixes #581 #583

merged 3 commits into from Oct 8, 2016

Conversation

magnusboman
Copy link
Contributor

No description provided.

Copy link
Member

@markpeek markpeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. I'd like to see it reworked a little based on this feedback.

@@ -137,7 +137,7 @@ class DBInstance(AWSObject):
'DBSecurityGroups': (list, False),
'DBSnapshotIdentifier': (basestring, False),
'DBSubnetGroupName': (basestring, False),
'Engine': (validate_engine, True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of validate_engine can still be used here instead of adding additional code in validate but change required to False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if Engine isn't specified, wouldn't validate_engine fail?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. The property checks (type or validate functions) are only called if the property is specified in the class instantiation. And then the class validate function is called later on to do validation across all of the properties.

@@ -221,6 +228,10 @@ def validate(self):
raise ValueError("AllocatedStorage must be no less than "
"1/10th the provisioned Iops")

engine = self.properties.get('Engine', None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With validate_engine used above this isn't needed.

'Either Engine or DBSnapshotIdentifier is required '
'AWS::RDS::DBInstance.'
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Engine can be optional when specifying DBSnapshotIdentifier, perhaps this could be coded:

        if 'DBSnapshotIdentifier' not in self.properties:
            if 'Engine' not in self.properties:
                raise ValueError(
                    'Resource Engine required in type %s' % self.resource_type)```

@markpeek markpeek merged commit 19177ff into cloudtools:master Oct 8, 2016
@markpeek
Copy link
Member

markpeek commented Oct 8, 2016

Thank you for the PR and the additional rework.

amosshapira pushed a commit to amosshapira/troposphere that referenced this pull request Oct 24, 2016
…loudtools#583)

* Fixes cloudtools#581
* Update to verify engine later in the process
* Update patch according to recommendations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Next Release
Completed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants