Пример #1
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp
    action_ref = cfg.CONF.action_ref
    purge_incomplete = cfg.CONF.purge_incomplete

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    try:
        purge_executions(logger=LOG,
                         timestamp=timestamp,
                         action_ref=action_ref,
                         purge_incomplete=purge_incomplete)
    except Exception as e:
        LOG.exception(str(e))
        return FAILURE_EXIT_CODE
    finally:
        common_teardown()

    return SUCCESS_EXIT_CODE
Пример #2
0
def setup(argv):
    common_setup(
        config=config,
        setup_db=False,
        register_mq_exchanges=False,
        register_internal_trigger_types=False,
    )
Пример #3
0
def main(argv):
    _register_cli_opts()

    # Parse CLI args, set up logging
    common_setup(config=config, setup_db=False, register_mq_exchanges=False,
                 register_internal_trigger_types=False)

    packs = cfg.CONF.pack
    verify_ssl = cfg.CONF.verify_ssl
    force = cfg.CONF.force
    use_python3 = cfg.CONF.use_python3

    proxy_config = get_and_set_proxy_config()

    for pack in packs:
        LOG.info('Installing pack "%s"' % (pack))
        result = download_pack(pack=pack, verify_ssl=verify_ssl, force=force,
                               proxy_config=proxy_config, force_permissions=True,
                               use_python3=use_python3)

        # Raw pack name excluding the version
        pack_name = result[1]
        success = result[2][0]

        if success:
            LOG.info('Successfully installed pack "%s"' % (pack_name))
        else:
            error = result[2][1]
            LOG.error('Failed to installed pack "%s": %s' % (pack_name, error))
            sys.exit(2)

    return 0
Пример #4
0
def main(argv):
    _register_cli_opts()

    # Parse CLI args, set up logging
    common_setup(config=config, setup_db=False, register_mq_exchanges=False,
                 register_internal_trigger_types=False)

    packs = cfg.CONF.pack
    verify_ssl = cfg.CONF.verify_ssl
    force = cfg.CONF.force

    proxy_config = get_and_set_proxy_config()

    for pack in packs:
        LOG.info('Installing pack "%s"' % (pack))
        result = download_pack(pack=pack, verify_ssl=verify_ssl, force=force,
                               proxy_config=proxy_config, force_permissions=True)

        # Raw pack name excluding the version
        pack_name = result[1]
        success = result[2][0]

        if success:
            LOG.info('Successfully installed pack "%s"' % (pack_name))
        else:
            error = result[2][1]
            LOG.error('Failed to installed pack "%s": %s' % (pack_name, error))
            sys.exit(2)

    return 0
Пример #5
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp
    action_ref = cfg.CONF.action_ref
    purge_incomplete = cfg.CONF.purge_incomplete

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    try:
        purge_executions(logger=LOG, timestamp=timestamp, action_ref=action_ref,
                         purge_incomplete=purge_incomplete)
    except Exception as e:
        LOG.exception(str(e))
        return FAILURE_EXIT_CODE
    finally:
        common_teardown()

    return SUCCESS_EXIT_CODE
Пример #6
0
def main(argv):
    _register_cli_opts()

    # Parse CLI args, set up logging
    common_setup(config=config,
                 setup_db=False,
                 register_mq_exchanges=False,
                 register_internal_trigger_types=False)

    packs = cfg.CONF.pack
    update = cfg.CONF.update
    use_python3 = cfg.CONF.python3

    proxy_config = get_and_set_proxy_config()

    for pack in packs:
        # Setup pack virtual environment
        LOG.info('Setting up virtualenv for pack "%s"' % (pack))
        setup_pack_virtualenv(pack_name=pack,
                              update=update,
                              logger=LOG,
                              proxy_config=proxy_config,
                              use_python3=use_python3,
                              no_download=True)
        LOG.info('Successfully set up virtualenv for pack "%s"' % (pack))

    return 0
Пример #7
0
def setup(argv):
    common_setup(
        config=config,
        setup_db=True,
        register_mq_exchanges=True,
        register_internal_trigger_types=True,
        ignore_register_config_opts_errors=True,
    )
Пример #8
0
def main(argv):
    _register_cli_opts()

    # Parse CLI args, set up logging
    common_setup(config=config,
                 setup_db=False,
                 register_mq_exchanges=False,
                 register_internal_trigger_types=False)

    packs = cfg.CONF.pack
    verify_ssl = cfg.CONF.verify_ssl
    force = cfg.CONF.force
    use_python3 = cfg.CONF.use_python3

    proxy_config = get_and_set_proxy_config()

    for pack in packs:
        # 1. Download the pack
        LOG.info('Installing pack "%s"' % (pack))
        result = download_pack(pack=pack,
                               verify_ssl=verify_ssl,
                               force=force,
                               proxy_config=proxy_config,
                               force_permissions=True,
                               use_python3=use_python3)

        # Raw pack name excluding the version
        pack_name = result[1]
        success = result[2][0]

        if success:
            LOG.info('Successfully installed pack "%s"' % (pack_name))
        else:
            error = result[2][1]
            LOG.error('Failed to install pack "%s": %s' % (pack_name, error))
            sys.exit(2)

        # 2. Setup pack virtual environment
        LOG.info('Setting up virtualenv for pack "%s"' % (pack_name))
        setup_pack_virtualenv(pack_name=pack_name,
                              update=False,
                              logger=LOG,
                              proxy_config=proxy_config,
                              use_python3=use_python3,
                              no_download=True)
        LOG.info('Successfully set up virtualenv for pack "%s"' % (pack_name))

    return 0
Пример #9
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    # Purge models.
    purge_trigger_instances(timestamp=timestamp)

    common_teardown()
Пример #10
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    # Purge models.
    purge_trigger_instances(timestamp=timestamp)

    common_teardown()
Пример #11
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    try:
        tester = RuleTester(rule_file_path=cfg.CONF.rule,
                            rule_ref=cfg.CONF.rule_ref,
                            trigger_instance_file_path=cfg.CONF.trigger_instance,
                            trigger_instance_id=cfg.CONF.trigger_instance_id)
        matches = tester.evaluate()
    finally:
        common_teardown()

    if matches:
        LOG.info('=== RULE MATCHES ===')
        sys.exit(0)
    else:
        LOG.info('=== RULE DOES NOT MATCH ===')
        sys.exit(1)
Пример #12
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    try:
        tester = RuleTester(rule_file_path=cfg.CONF.rule,
                            rule_ref=cfg.CONF.rule_ref,
                            trigger_instance_file_path=cfg.CONF.trigger_instance,
                            trigger_instance_id=cfg.CONF.trigger_instance_id)
        matches = tester.evaluate()
    finally:
        common_teardown()

    if matches:
        LOG.info('=== RULE MATCHES ===')
        sys.exit(0)
    else:
        LOG.info('=== RULE DOES NOT MATCH ===')
        sys.exit(1)
Пример #13
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp
    action_ref = cfg.CONF.action_ref
    purge_incomplete = cfg.CONF.purge_incomplete

    if not timestamp:
        LOG.error("Please supply a timestamp for purging models. Aborting.")
        return 1
    else:
        timestamp = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    # Purge models.
    purge_executions(timestamp=timestamp, action_ref=action_ref, purge_incomplete=purge_incomplete)

    common_teardown()
Пример #14
0
def main(argv):
    _register_cli_opts()

    # Parse CLI args, set up logging
    common_setup(config=config, setup_db=False, register_mq_exchanges=False,
                 register_internal_trigger_types=False)

    packs = cfg.CONF.pack
    update = cfg.CONF.update
    use_python3 = cfg.CONF.python3

    proxy_config = get_and_set_proxy_config()

    for pack in packs:
        # Setup pack virtual environment
        LOG.info('Setting up virtualenv for pack "%s"' % (pack))
        setup_pack_virtualenv(pack_name=pack, update=update, logger=LOG,
                              proxy_config=proxy_config, use_python3=use_python3,
                              no_download=True)
        LOG.info('Successfully set up virtualenv for pack "%s"' % (pack))

    return 0
Пример #15
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    # Purge models.
    try:
        purge_trigger_instances(logger=LOG, timestamp=timestamp)
    except Exception as e:
        LOG.exception(six.text_type(e))
        return FAILURE_EXIT_CODE
    finally:
        common_teardown()

    return SUCCESS_EXIT_CODE
Пример #16
0
def main():
    _register_cli_opts()
    common_setup(config=config, setup_db=True, register_mq_exchanges=False)

    # Get config values
    timestamp = cfg.CONF.timestamp

    if not timestamp:
        LOG.error('Please supply a timestamp for purging models. Aborting.')
        return 1
    else:
        timestamp = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
        timestamp = timestamp.replace(tzinfo=pytz.UTC)

    # Purge models.
    try:
        purge_trigger_instances(logger=LOG, timestamp=timestamp)
    except Exception as e:
        LOG.exception(six.text_type(e))
        return FAILURE_EXIT_CODE
    finally:
        common_teardown()

    return SUCCESS_EXIT_CODE
Пример #17
0
def setup(argv):
    common_setup(config=config, setup_db=True, register_mq_exchanges=True)
def main():
    common_setup(config=config, setup_db=False, register_mq_exchanges=False)
    setup_pack_virtualenv(cfg.CONF.pack, logger=LOG)
    common_teardown()
Пример #19
0
def setup(argv):
    common_setup(config=config, setup_db=True, register_mq_exchanges=True,
                 register_internal_trigger_types=True)
Пример #20
0
def setup(argv):
    common_setup(config=config, setup_db=True, register_mq_exchanges=True)
Пример #21
0
def setup():
    common_setup(config=config, setup_db=False, register_mq_exchanges=False)
Пример #22
0
def setup():
    common_setup(config=config, setup_db=False, register_mq_exchanges=False)