Remove an existing datasource from the running jboss instance.

    jboss_config
        Configuration dictionary with properties specified above.
    name
        Datasource name
    profile
        The profile (JBoss domain mode only)

    CLI Example:

    .. code-block:: bash

        salt '*' jboss7.remove_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_datasource_name

def remove_datasource(jboss_config, name, profile=None):
    '''
    Remove an existing datasource from the running jboss instance.

    jboss_config
        Configuration dictionary with properties specified above.
    name
        Datasource name
    profile
        The profile (JBoss domain mode only)

    CLI Example:

    .. code-block:: bash

        salt '*' jboss7.remove_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_datasource_name
       '''
    log.debug("======================== MODULE FUNCTION: jboss7.remove_datasource, name=%s, profile=%s", name, profile)

    operation = '/subsystem=datasources/data-source={name}:remove'.format(name=name)
    if profile is not None:
        operation = '/profile="{profile}"'.format(profile=profile) + operation

    return __salt__['jboss7_cli.run_operation'](jboss_config, operation, fail_on_error=False)