Пример #1
0
def get_dockyard_dict(alias_name=None):
    try:
        if not alias_name:
            alias_name = get_default_alias()
        dockyard = alias.get_alias(alias_name)
        if not dockyard:
            raise CriticalDockyardException('Dockyard alias: {alias_name} does not exist.'.format(**locals()))
        return dockyard
    except DockyardException as e:
        dockyard_address = alias.DOCKYARD_FALLBACK_ADDRESS
        print('WARNING: Could not get dockyard_address ({e}), falling back to: {dockyard_address}'.format(**locals()))
        return {'address': dockyard_address}
Пример #2
0
def get_default_alias():
    default_alias = alias.get_default()
    if default_alias:
        dockyard = alias.get_alias(default_alias)
        if not dockyard:
            raise DockyardException('Default dockyard does not exist.')
        return default_alias
    alias_list = alias.get_list()
    if not alias_list:
        raise DockyardException('There are no running dockyards.')
    if len(alias_list) > 1:
        raise CriticalDockyardException('There are multiple running dockyards and no default set.'
                                        'Please specify dockyard by -d/--dockyard or set the default.')
    return alias_list[0]['name']
Пример #3
0
def get_default_alias():
    default_alias = alias.get_default()
    if default_alias:
        dockyard = alias.get_alias(default_alias)
        if not dockyard:
            raise DockyardException('Default dockyard does not exist.')
        return default_alias
    alias_list = alias.get_list()
    if not alias_list:
        raise DockyardException('There are no running dockyards.')
    if len(alias_list) > 1:
        raise CriticalDockyardException(
            'There are multiple running dockyards and no default set.'
            'Please specify dockyard by -d/--dockyard or set the default.')
    return alias_list[0]['name']
Пример #4
0
def get_dockyard_dict(alias_name=None):
    try:
        if not alias_name:
            alias_name = get_default_alias()
        dockyard = alias.get_alias(alias_name)
        if not dockyard:
            raise CriticalDockyardException(
                'Dockyard alias: {alias_name} does not exist.'.format(
                    **locals()))
        return dockyard
    except DockyardException as e:
        dockyard_address = alias.DOCKYARD_FALLBACK_ADDRESS
        print(
            'WARNING: Could not get dockyard_address ({e}), falling back to: {dockyard_address}'
            .format(**locals()))
        return {'address': dockyard_address}
Пример #5
0
elif (args.command == "tabs"):
    if (args.action == "get"):
        tabs.get_tabs(args.es_url + "/.kibana/metadashboard/main")
    elif (args.action == "add"):
        tabs.add_tabs(input_file, args.es_url + "/.kibana/metadashboard/main", args.sources)
    elif (args.action == "rm"):
        tabs.remove_tabs(input_file, args.es_url + "/.kibana/metadashboard/main", args.sources)
    else:
        print("This action is not suported")
        parser.usage()
        exit(-1)
elif (args.command == "panels"):
    panels.get_panels(input_file, args.sources, args.has_projects)
elif (args.command == "aliases"):
    if (args.action == "get"):
        alias.get_alias(args.es_url + "/_cat/aliases?v")
    elif (args.action == "add"):
        alias.add_alias(args.es_url + "/_aliases", args.alias, args.new_index)
    elif (args.action == "replace"):
        alias.replace_alias(args.es_url + "/_aliases", args.alias, args.old_index, args.new_index)
    elif (args.action == "remove"):
        alias.remove_alias(args.es_url + "/_aliases", args.alias, args.old_index)
    else:
        print("This action is not suported")
        parser.usage()
        exit(-1)
elif (args.command == "indexes"):
    if (args.action == "get"):
        index.get_index(args.es_url + "/_cat/indices?v")
    elif (args.action == "remove"):
        index.remove_index(args.es_url, args.index)
Пример #6
0
    elif (args.action == "add"):
        tabs.add_tabs(input_file, args.es_url + "/.kibana/metadashboard/main",
                      args.sources)
    elif (args.action == "rm"):
        tabs.remove_tabs(input_file,
                         args.es_url + "/.kibana/metadashboard/main",
                         args.sources)
    else:
        print("This action is not suported")
        parser.usage()
        exit(-1)
elif (args.command == "panels"):
    panels.get_panels(input_file, args.sources, args.has_projects)
elif (args.command == "aliases"):
    if (args.action == "get"):
        alias.get_alias(args.es_url + "/_cat/aliases?v")
    elif (args.action == "add"):
        alias.add_alias(args.es_url + "/_aliases", args.alias, args.new_index)
    elif (args.action == "replace"):
        alias.replace_alias(args.es_url + "/_aliases", args.alias,
                            args.old_index, args.new_index)
    elif (args.action == "remove"):
        alias.remove_alias(args.es_url + "/_aliases", args.alias,
                           args.old_index)
    else:
        print("This action is not suported")
        parser.usage()
        exit(-1)
elif (args.command == "indexes"):
    if (args.action == "get"):
        index.get_index(args.es_url + "/_cat/indices?v")