modify_db_parameter_group

123 views
Skip to first unread message

Christopher Jacobsen

unread,
Apr 4, 2014, 3:12:01 PM4/4/14
to boto-...@googlegroups.com
Hi,

I have been seaching all over the net to try and figure this out, I am trying to modify a parameter in one of my parameter groups and continue to get the following error:

['name=innodb_flush_log_at_trx_commit', 'value=0', 'method=immediate']
Traceback (most recent call last):
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 177, in <module>
    main()
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 151, in main
    my_aws.create_param_group()
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 106, in create_param_group
    self.conn.modify_db_parameter_group(self.param_name, param_list)
  File "/usr/local/lib/python2.6/dist-packages/boto/rds2/layer1.py", line 2897, in modify_db_parameter_group
    path='/', params=params)
  File "/usr/local/lib/python2.6/dist-packages/boto/rds2/layer1.py", line 3774, in _make_request
    body=json_body)
boto.exception.JSONResponseError: JSONResponseError: 400 Bad Request
{u'RequestId': u'13753d00-bc2c-11e3-8551-11e332858630', u'Error': {u'Message': u'boolean must follow xsd1.1 definition', u'Code': u'MalformedInput', u'Type': u'Sender'}}

According to the documentation, I am supposed to pass in a list and name, value and method are required. I have tried passing a list, dict, a list inside a dict, with name=param, value=......etc.

I am hoping some one has an example I can follow, I successfully did it using boto.rds but I wanted to use boto.rds2

My code:


param_list.append('name=%s' % cnfparams[0].strip())
param_list.append('value=%s' % cnfparams[1].strip())
param_list.append('method=immediate')
print param_list
self.conn.modify_db_parameter_group(self.param_name, param_list)


Adrian Klaver

unread,
Apr 4, 2014, 4:55:43 PM4/4/14
to boto-...@googlegroups.com
When it doubt look at the source.

For rds2:

/usr/lib/python2.7/site-packages/boto/rds2/layer1.py

params = {'DBParameterGroupName': db_parameter_group_name, }
self.build_complex_list_params(
params, parameters,
'Parameters.member',
('ParameterName', 'ParameterValue', 'Description',
'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable',
'MinimumEngineVersion', 'ApplyMethod'))
return self._make_request(
action='ModifyDBParameterGroup',
verb='POST',
path='/', params=params)



For build_complex_list_params:

/usr/lib/python2.7/site-packages/boto/connection.py

def build_complex_list_params(self, params, items, label, names):
"""Serialize a list of structures.

For example::

items = [('foo', 'bar', 'baz'), ('foo2', 'bar2', 'baz2')]
label = 'ParamName.member'
names = ('One', 'Two', 'Three')
self.build_complex_list_params(params, items, label, names)

would result in the params dict being updated with these params::

ParamName.member.1.One = foo
ParamName.member.1.Two = bar
ParamName.member.1.Three = baz

ParamName.member.2.One = foo2
ParamName.member.2.Two = bar2
ParamName.member.2.Three = baz2

:type params: dict
:param params: The params dict. The complex list params
will be added to this dict.

:type items: list of tuples
:param items: The list to serialize.

:type label: string
:param label: The prefix to apply to the parameter.

:type names: tuple of strings
:param names: The names associated with each tuple element.

"""

So your code should look something like this I believe:

self.conn.modify_db_parameter_group(self.param_name, [('name1', 'val1',
'method1'), ('name2', 'val1', 'method2')])



--
Adrian Klaver
adrian...@aklaver.com

Christopher Jacobsen

unread,
Apr 8, 2014, 12:07:36 PM4/8/14
to boto-...@googlegroups.com
Thank you for your response, I Tried passing in a tupple inside a list. I found out that the documentation is wrong and that it actually requires all the fields to be passed, so what I am doing is getting all the params for the parameter and replacing the value with my custom value. I did verify that the value I am replacing is valid. I am then passing that back into the modify_db_parameter_group function. Below is my code and the result of my code.

param_tup = (cnfparams[0].strip(),cnfparams[1].strip(),each_param['Description'],each_param['Source'],each_param['ApplyType'],each_param['DataType'],each_param['AllowedValues'],each_param['IsModifiable'],each_param['MinimumEngineVersion'],)
for k,v in each_param.iteritems():
if k == 'ApplyMethod' and each_param['ApplyType'] == 'dynamic':
param_tupple = param_tup + ('immediate',)
elif k == 'ApplyMethod' and each_param['ApplyType'] == 'static':
param_tupple = param_tup + ('pending-reboot',)
print [param_tupple]
self.conn.modify_db_parameter_group(self.param_name,[param_tupple])

[('innodb_flush_log_at_trx_commit', '0', u'Determines Innodb transaction durability', u'engine-default', u'dynamic', u'integer', u'0-2', True, None, 'immediate')]
('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod')
Traceback (most recent call last):
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 163, in <module>
    main()
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 137, in main
    my_aws.create_param_group()
  File "/home/cjacobsen/aws_rds_magic/amazon_rds.py", line 109, in create_param_group
    self.conn.modify_db_parameter_group(self.param_name,[param_tupple])
  File "/usr/local/lib/python2.6/dist-packages/boto/rds2/layer1.py", line 2897, in modify_db_parameter_group
    path='/', params=params)
  File "/usr/local/lib/python2.6/dist-packages/boto/rds2/layer1.py", line 3774, in _make_request
    body=json_body)
boto.exception.JSONResponseError: JSONResponseError: 400 Bad Request
{u'RequestId': u'aeb4a444-bf36-11e3-b4ea-7b098ebe9a2f', u'Error': {u'Message': u'boolean must follow xsd1.1 definition', u'Code': u'MalformedInput', u'Type': u'Sender'}}

Christopher Jacobsen

unread,
Apr 8, 2014, 12:18:16 PM4/8/14
to boto-...@googlegroups.com
OK, after doing some more research, I found that the boolean that I submit for "IsModifiable" has to be lower case. Thank you for your help Adrian
Reply all
Reply to author
Forward
0 new messages