

def update_datasource(jboss_config, name, new_properties, profile=None):
    '\n    Update an existing datasource in running jboss instance.\n    If the property doesn\'t exist if will be created, if it does, it will be updated with the new value\n\n    jboss_config\n        Configuration dictionary with properties specified above.\n    name\n        Datasource name\n    new_properties\n        A dictionary of datasource properties to be updated. For example:\n          - driver-name: mysql\n          - connection-url: \'jdbc:mysql://localhost:3306/sampleDatabase\'\n          - jndi-name: \'java:jboss/datasources/sampleDS\'\n          - user-name: sampleuser\n          - password: secret\n          - min-pool-size: 3\n          - use-java-context: True\n    profile\n        The profile name (JBoss domain mode only)\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt \'*\' jboss7.update_datasource \'{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}\' \'my_datasource\' \'{"driver-name": "mysql", "connection-url": "jdbc:mysql://localhost:3306/sampleDatabase", "jndi-name": "java:jboss/datasources/sampleDS", "user-name": "sampleuser", "password": "secret", "min-pool-size": 3, "use-java-context": True}\'\n\n    '
    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, changed_properties)
        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

dataset/ETHPy150Open saltstack/salt/salt/modules/jboss7.py update_datasource/VarMisuse@104/646 `profile`->`changed_properties`