Modifying rds params with False or 0 param values doesn't cause a change #264

Closed
winhamwr opened this Issue Jul 18, 2011 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

winhamwr commented Jul 18, 2011

Trying to do the following causes a 400:

import boto
conn = boto.connect_rds('access', 'secret', debug=2)
db = boto.get_all_dbinstances()
db.modify(backup_retention_period=0, apply_immediately=True)
send: 'GET /?AWSAccessKeyId=ACCESSKEY&Action=ModifyDBInstance&DBInstanceIdentifier=MYDB&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-07-18T18%3A32%3A00Z&Version=2009-10-16&Signature=SIG HTTP/1.1\r\nHost: rds.amazonaws.com\r\nAccept-Encoding: identity\r\nConte
nt-Length: 0\r\nUser-Agent: Boto/2.0 (linux2)\r\n\r\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: x-amzn-RequestId: 39fd4a86-b16c-11e0-951b-dfc50e2855f7
header: Content-Type: text/xml
header: Content-Length: 291
header: Date: Mon, 18 Jul 2011 18:31:59 GMT


BotoServerError: BotoServerError: 400 Bad Request
<ErrorResponse xmlns="http://rds.amazonaws.com/admin/2009-10-16/">
  <Error>
    <Type>Sender</Type>
    <Code>InvalidParameterCombination</Code>
    <Message>No modifications were requested</Message>
  </Error>
  <RequestId>39fd4a86-b16c-11e0-951b-dfc50e2855f7</RequestId>
</ErrorResponse>

Looking through the code, I'm kind of sad it's taken me this long to debug.

In both boto.rds.RDSConnection.create_dbinstance and modify_dbinstance, there's a check like this:

if backup_retention_period:
            params['BackupRetentionPeriod'] = backup_retention_period

0 and False all evaluate to value, meaning that param is never set. This needs to be changed to "if backup_retention_period is not None:"

garnaat closed this in ea9039f Jul 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment