def main(reactor):
    parser = ArgumentParser(description="Trigger convergence on all/some groups")
    parser.add_argument("-c", dest="config", required=True, help="Config file containing identity and cassandra info")

    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument("-g", nargs="+", dest="group", help="Group(s) to trigger. Should be in tenantId:groupId form")
    group.add_argument("-t", nargs="+", dest="tenant_id", help="TenantID(s) whose group's to trigger")
    group.add_argument(
        "--conf-conv-tenants",
        action="store_true",
        help=("Convergence triggered on tenants configured as " '"convergence-tenants" setting config file'),
    )
    group.add_argument(
        "--conf-non-conv-tenants",
        action="store_true",
        dest="disabled_tenants",
        help=("Convergence triggered on all tenants except ones in " '"non-convergence-tenants" setting in conf file'),
    )
    group.add_argument("--all", action="store_true", help="Convergence will be triggered on all groups")

    parser.add_argument("-l", dest="limit", type=int, default=10, help="Concurrency limit. Defaults to 10")
    parser.add_argument("--no-error-group", action="store_true", help="Do not converge ERROR groups")

    parsed = parser.parse_args()
    conf = json.load(open(parsed.config))

    cass_client = connect_cass_servers(reactor, conf["cassandra"])
    authenticator = generate_authenticator(reactor, conf["identity"])
    store = CassScalingGroupCollection(cass_client, reactor, 1000)

    groups = yield get_groups(parsed, store, conf)
    yield trigger_convergence_groups(authenticator, conf["region"], groups, parsed.limit, parsed.no_error_group)
    yield cass_client.disconnect()
Example #2
0
def main(reactor):
    parser = ArgumentParser(
        description="Trigger convergence on all/some groups")
    parser.add_argument(
        "-c", dest="config", required=True,
        help="Config file containing identity and cassandra info")
    parser.add_argument(
        "-g", nargs="+", dest="group",
        help=("Group(s) to trigger. Should be in tenantId:groupId form. "
              "If not provided convergence will be triggerred on all groups "
              "in CASS"))
    parser.add_argument("-l", dest="limit", type=int, default=10,
                        help="Concurrency limit. Defaults to 10")

    parsed = parser.parse_args()
    conf = json.load(open(parsed.config))

    cass_client = connect_cass_servers(reactor, conf["cassandra"])
    authenticator = generate_authenticator(reactor, conf["identity"])
    store = CassScalingGroupCollection(cass_client, reactor, 1000)
    if parsed.group:
        groups = [g.split(":") for g in parsed.group]
        groups = [{"tenantId": tid, "groupId": gid} for tid, gid in groups]
    else:
        groups = yield store.get_all_groups()

    yield trigger_convergence_groups(authenticator, conf["region"], groups,
                                     parsed.limit)
    yield cass_client.disconnect()
Example #3
0
def main(reactor):
    parser = ArgumentParser(
        description="Trigger convergence on all/some groups")
    parser.add_argument(
        "-c", dest="config", required=True,
        help="Config file containing identity and cassandra info")
    parser.add_argument(
        "--steps", action="store_true",
        help=("Return steps that would be taken if convergence was triggered "
              "with desired set to current actual. No convergence triggered"))
    parser.add_argument(
        "--set-desired-to-actual", action="store_true", dest="set_desired",
        help="Set group's desired to current actual number of servers")
    parser.add_argument(
        "--pause", action="store_true", dest="pause_group",
        help="Pause given groups")

    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "-g", nargs="+", dest="group",
        help="Group(s) to trigger. Should be in tenantId:groupId form")
    group.add_argument(
        "-t", nargs="+", dest="tenant_id",
        help="TenantID(s) whose group's to trigger")
    group.add_argument(
        "--conf-conv-tenants", action="store_true",
        help=("Convergence triggered on tenants configured as "
              "\"convergence-tenants\" setting config file"))
    group.add_argument(
        "--conf-non-conv-tenants", action="store_true",
        dest="disabled_tenants",
        help=("Convergence triggered on all tenants except ones in "
              "\"non-convergence-tenants\" setting in conf file"))
    group.add_argument("--all", action="store_true",
                       help="Convergence will be triggered on all groups")

    parser.add_argument("-l", dest="limit", type=int, default=10,
                        help="Concurrency limit. Defaults to 10")

    parsed = parser.parse_args()
    conf = json.load(open(parsed.config))

    set_config_data(conf)
    cass_client = connect_cass_servers(reactor, conf["cassandra"])
    authenticator = generate_authenticator(reactor, conf["identity"])
    store = CassScalingGroupCollection(cass_client, reactor, 1000)

    groups = yield get_groups(parsed, store, conf)
    if parsed.steps:
        steps = yield groups_steps(groups, reactor, store, cass_client,
                                   authenticator, conf)
        pprint(steps)
    elif parsed.set_desired:
        yield set_desired_to_actual(groups, reactor, store, cass_client,
                                    authenticator, conf)
    elif parsed.pause_group:
        yield pause_groups(cass_client, groups)
    else:
        error_groups = yield trigger_convergence_groups(
            authenticator, conf["region"], groups, parsed.limit)
        if error_groups:
            print("Following groups errored")
            pprint(error_groups)
    yield cass_client.disconnect()
Example #4
0
def main(reactor):
    parser = ArgumentParser(
        description="Trigger convergence on all/some groups")
    parser.add_argument(
        "-c",
        dest="config",
        required=True,
        help="Config file containing identity and cassandra info")
    parser.add_argument(
        "--steps",
        action="store_true",
        help=("Return steps that would be taken if convergence was triggered "
              "with desired set to current actual. No convergence triggered"))

    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "-g",
        nargs="+",
        dest="group",
        help="Group(s) to trigger. Should be in tenantId:groupId form")
    group.add_argument("-t",
                       nargs="+",
                       dest="tenant_id",
                       help="TenantID(s) whose group's to trigger")
    group.add_argument("--conf-conv-tenants",
                       action="store_true",
                       help=("Convergence triggered on tenants configured as "
                             "\"convergence-tenants\" setting config file"))
    group.add_argument(
        "--conf-non-conv-tenants",
        action="store_true",
        dest="disabled_tenants",
        help=("Convergence triggered on all tenants except ones in "
              "\"non-convergence-tenants\" setting in conf file"))
    group.add_argument("--all",
                       action="store_true",
                       help="Convergence will be triggered on all groups")

    parser.add_argument("-l",
                        dest="limit",
                        type=int,
                        default=10,
                        help="Concurrency limit. Defaults to 10")
    parser.add_argument("--no-error-group",
                        action="store_true",
                        help="Do not converge ERROR groups")

    parsed = parser.parse_args()
    conf = json.load(open(parsed.config))

    cass_client = connect_cass_servers(reactor, conf["cassandra"])
    authenticator = generate_authenticator(reactor, conf["identity"])
    store = CassScalingGroupCollection(cass_client, reactor, 1000)

    groups = yield get_groups(parsed, store, conf)
    if parsed.steps:
        steps = yield groups_steps(groups, reactor, store, cass_client,
                                   authenticator, conf)
        print(*steps, sep='\n')
    else:
        yield trigger_convergence_groups(authenticator, conf["region"], groups,
                                         parsed.limit, parsed.no_error_group)
    yield cass_client.disconnect()