Example #1
0
def remove(name):
    """
    Remove a connector from the cluster.

    Parameters:
        name - Name of the connector to be removed
    """
    _LOGGER.info('[' + env.host + '] Removing connector: ' + name)
    ret = remove_file(
        os.path.join(constants.REMOTE_CATALOG_DIR, name + '.properties'))
    if ret.succeeded:
        if COULD_NOT_REMOVE in ret:
            fabric.utils.error(ret)
        else:
            print('[%s] Connector removed. Restart the server for the change '
                  'to take effect' % env.host)
    else:
        fabric.utils.error('Failed to remove connector ' + name + '.\n\t' +
                           ret)

    local_path = os.path.join(constants.CONNECTORS_DIR, name + '.properties')
    try:
        os.remove(local_path)
    except OSError as e:
        if e.errno == errno.ENOENT:
            pass
        else:
            raise
Example #2
0
def remove(name):
    """
    Remove a connector from the cluster.

    Parameters:
        name - Name of the connector to be removed
    """
    _LOGGER.info('[' + env.host + '] Removing connector: ' + name)
    ret = remove_file(os.path.join(constants.REMOTE_CATALOG_DIR,
                                   name + '.properties'))
    if ret.succeeded:
        if COULD_NOT_REMOVE in ret:
            fabric.utils.error(ret)
        else:
            print('[%s] Connector removed. Restart the server for the change '
                  'to take effect' % env.host)
    else:
        fabric.utils.error('Failed to remove connector ' + name + '.\n\t' +
                           ret)

    local_path = os.path.join(constants.CONNECTORS_DIR, name + '.properties')
    try:
        os.remove(local_path)
    except OSError as e:
        if e.errno == errno.ENOENT:
            pass
        else:
            raise
Example #3
0
def dumpdata(filepath=getattr(settings, 'FIXTURE_PATH', '')):
    """ Dump initial_data.json by default DB """
    if os.path.isfile(filepath):
        os.remove(filepath)
    exclude_model_str = ' -e '.join(('south.migrationhistory', 'contenttypes',
                                     'sessions', 'admin.logentry'))
    print local("python manage.py dumpdata --all -e %s --indent=4 > %s" %
                (exclude_model_str, filepath))
Example #4
0
def coverage() -> None:
    """Code coverage report."""
    if os.path.exists(COVERAGE_REPORT_HTML_DIR):
        shutil.rmtree(COVERAGE_REPORT_HTML_DIR)

    if os.path.isfile(COVERAGE_REPORT_FILE):
        os.remove(COVERAGE_REPORT_FILE)

    # initialize_db()
    local("coverage run --source='.' -m py.test -v")

    local("coverage report --skip-covered")
    local("coverage html")
Example #5
0
def coverage() -> None:
    """Code coverage report."""
    if os.path.exists(COVERAGE_REPORT_HTML_DIR):
        shutil.rmtree(COVERAGE_REPORT_HTML_DIR)

    if os.path.isfile(COVERAGE_REPORT_FILE):
        os.remove(COVERAGE_REPORT_FILE)

    local("coverage run --source='.' manage.py {0}".format(
        get_test_command(parallel=False, fake_migrations=False,
                         keep_db=False)))

    local("coverage report --skip-covered")
    local("coverage html")
Example #6
0
    def _check_rpm_uncorrupted(rpm_path):
        # package.check_if_valid_rpm() outputs information that is not applicable
        # to this function
        # stderr is redirected to not be displayed and should be restored at the
        # end of the function to behave as expected later
        old_stderr = sys.stderr
        sys.stderr = open(os.devnull, 'w')
        try:
            package.check_if_valid_rpm(rpm_path)
        except SystemExit:
            try:
                os.remove(rpm_path)
                warn('Removed corrupted rpm at: %s' % rpm_path)
            except OSError:
                pass
            return False
        finally:
            sys.stderr = old_stderr

        return True
Example #7
0
    def _check_rpm_uncorrupted(rpm_path):
        # package.check_if_valid_rpm() outputs information that is not applicable
        # to this function
        # stderr is redirected to not be displayed and should be restored at the
        # end of the function to behave as expected later
        old_stderr = sys.stderr
        sys.stderr = open(os.devnull, 'w')
        try:
            package.check_if_valid_rpm(rpm_path)
        except SystemExit:
            try:
                os.remove(rpm_path)
                warn('Removed corrupted rpm at: %s' % rpm_path)
            except OSError:
                pass
            return False
        finally:
            sys.stderr = old_stderr

        return True
Example #8
0
def dumpdata(filepath=getattr(settings, 'FIXTURE_PATH', '')):
    """ Dump initial_data.json by default DB """
    if os.path.isfile(filepath):
        os.remove(filepath)
    exclude_model_str = ' -e '.join(('south.migrationhistory', 'contenttypes', 'sessions', 'admin.logentry'))
    print local("python manage.py dumpdata --all -e %s --indent=4 > %s" % (exclude_model_str, filepath))