def update_datasource(jboss_config, name, new_properties, profile=None):
 log.debug('======================== MODULE FUNCTION: jboss7.update_datasource, name=%s, profile=%s', name, profile)
 ds_result = __read_datasource(jboss_config, name, profile)
 current_properties = ds_result['result']
 diff = dictdiffer.DictDiffer(new_properties, current_properties)
 changed_properties = diff.changed()
 ret = {'success': True, 'comment': ''}
 if (len(changed_properties) > 0):
  ds_resource_description = __get_datasource_resource_description(jboss_config, name, profile)
  ds_attributes = ds_resource_description['attributes']
  for key in changed_properties:
   update_result = __update_datasource_property(jboss_config, name, key, new_properties[key], ds_attributes, profile)
   if (not update_result['success']):
    ret['result'] = False
    ret['comment'] = (ret['comment'] + 'Could not update datasource property {0} with value {1},\n stdout: {2}\n'.format(key, new_properties[key], update_result['stdout']))
 return ret

def update_datasource ( jboss_config , name , new_properties , profile = None ) : log . debug ( '======================== MODULE FUNCTION: jboss7.update_datasource, name=%s, profile=%s' , name , profile ) ds_result = __read_datasource ( jboss_config , name , profile ) current_properties = ds_result [ 'result' ] diff = dictdiffer . DictDiffer ( new_properties , current_properties ) changed_properties = diff . changed ( ) ret = { 'success' : True , 'comment' : '' } if ( len ( changed_properties ) > 0 ) : ds_resource_description = __get_datasource_resource_description ( jboss_config , name , profile ) ds_attributes = ds_resource_description [ 'attributes' ] for key in changed_properties : update_result = __update_datasource_property ( jboss_config , name , key , new_properties [ key ] , ds_attributes , profile ) if ( not update_result [ 'success' ] ) : ret [ 'result' ] = False ret [ 'comment' ] = ( ret [ 'comment' ] + 'Could not update datasource property {0} with value {1},\n stdout: {2}\n' . format ( key , new_properties [ key ] , update_result [ 'stdout' ] ) ) return ret
update a datasource .