in gg_group_setup/group.py [0:0]
def update(self, **kwargs):
if len(kwargs.keys()) == 0:
logging.warning("No new configuration to update.")
return
config = self.get_config()
if 'core' in kwargs:
for key, val in kwargs['core']:
config['core'][key] = val
kwargs.pop('core')
if 'lambda_functions' in kwargs:
for key in kwargs['lambda_functions']:
config['lambda_functions'][key] = kwargs['lambda_functions'][
key]
kwargs.pop('lambda_functions')
if 'devices' in kwargs:
for key in kwargs['devices']:
config['devices'][key] = kwargs['devices'][key]
kwargs.pop('devices')
if 'core_def' in kwargs:
for key, val in kwargs['core_def']:
config['core_def'][key] = val
kwargs.pop('core_def')
if 'device_def' in kwargs:
for key, val in kwargs['device_def']:
config['device_def'][key] = val
kwargs.pop('device_def')
if 'group' in kwargs:
for key, val in kwargs['group']:
logging.info('Updating group key:{0} and value:{0}'.format(
key, val))
config['group'][key] = val
kwargs.pop('group')
if 'misc' in kwargs:
for key, val in kwargs['misc']:
config['misc'][key] = val
kwargs.pop('misc')
if len(kwargs) > 0:
# treat the rest of the kwargs as simple property value assignments
for key in kwargs.keys():
logging.info("Update config key:{0}".format(key))
config[key] = kwargs[key]
self.write_config(config)