Exemplo n.º 1
0
def _print_server(cs, args):
    # By default when searching via name we will do a
    # findall(name=blah) and due a REST /details which is not the same
    # as a .get() and doesn't get the information about flavors and
    # images. This fix it as we redo the call with the id which does a
    # .get() to get all informations.
    server = _find_server(cs, args.server)

    networks = server.networks
    info = server._info.copy()
    # print(info)
    for network_label, address_list in networks.items():
        info["%s network" % network_label] = ", ".join(address_list)

    info.pop("links", None)
    info.pop("sourceAddresses", None)

    utils.print_dict(info)
Exemplo n.º 2
0
def do_create(cs, args):
    """Create a new loadbalancer."""
    boot_args, boot_kwargs = _create(cs, args)

    # extra_boot_kwargs = utils.get_resource_manager_extra_kwargs(do_boot, args)
    # boot_kwargs.update(extra_boot_kwargs)

    loadbalancer = cs.loadbalancers.create(*boot_args, **boot_kwargs)

    # Keep any information (like adminPass) returned by create
    info = loadbalancer._info
    loadbalancer = cs.loadbalancers.get(info["id"])
    info.update(loadbalancer._info)

    # info.pop('links', None)
    info.pop("sourceAddresses", None)

    utils.print_dict(info)

    if args.poll:
        _poll_for_status(cs.loadbalancers.get, info["id"], "building", ["active"])
Exemplo n.º 3
0
def do_credentials(cs, _args):
    """Show user credentials returned from auth."""
    ensure_service_catalog_present(cs)
    catalog = cs.client.service_catalog.catalog
    utils.print_dict(catalog["access"]["user"], "User Credentials", wrap=int(_args.wrap))
    utils.print_dict(catalog["access"]["token"], "Token", wrap=int(_args.wrap))
Exemplo n.º 4
0
def do_endpoints(cs, _args):
    """Discover endpoints that get returned from the authenticate services."""
    ensure_service_catalog_present(cs)
    catalog = cs.client.service_catalog.catalog
    for e in catalog["access"]["serviceCatalog"]:
        utils.print_dict(e["endpoints"][0], e["name"])