Beispiel #1
0
def list_filesystems():
    """List filesystems"""
    try:
        data = client().filesystems.get()
        for x in data:
            click.echo(
                click.style(x["id"], fg="white", bold=True) +
                click.style(" (" + x["path"] + ")", fg="green")
            )
            click.echo(
                click.style(" * Type: ", fg="yellow") +
                x["fstype"].capitalize()
            )
            click.echo(
                click.style(" * Size: ", fg="yellow") +
                str_fsize(x["size"])
            )
            click.echo(
                click.style(" * Encrypted: ", fg="yellow") +
                ("Yes" if x["crypt"] else "No")
            )
            click.echo(
                click.style(" * Mounted: ", fg="yellow") +
                ("At " + x["mountpoint"] if x["mountpoint"] else "No")
            )
    except Exception as e:
        raise CLIException(str(e))
Beispiel #2
0
def list_interfaces():
    """List system network interfaces"""
    try:
        data = client().networks.get_interfaces()
        for x in data:
            click.echo(
                click.style(x["id"], fg="white", bold=True) +
                click.style(" (" + x["itype"].capitalize() + ")", fg="green")
            )
            click.echo(
                click.style(" * Rx/Tx: ", fg="yellow") +
                "{0} / {1}".format(str_fsize(x["rx"]), str_fsize(x["tx"]))
            )
            click.echo(
                click.style(" * Connected: ", fg="yellow") +
                ("Yes" if x["up"] else "No")
            )
            if x["ip"]:
                click.echo(
                    click.style(" * Address(es): ", fg="yellow") +
                    ", ".join([y["addr"]+"/"+y["netmask"] for y in x["ip"]])
                )
    except Exception as e:
        raise CLIException(str(e))
Beispiel #3
0
def list_filesystems():
    """List filesystems"""
    try:
        data = client().filesystems.get()
        for x in data:
            click.echo(
                click.style(x["id"], fg="white", bold=True) +
                click.style(" (" + x["path"] + ")", fg="green"))
            click.echo(
                click.style(" * Type: ", fg="yellow") +
                x["fstype"].capitalize())
            click.echo(
                click.style(" * Size: ", fg="yellow") + str_fsize(x["size"]))
            click.echo(
                click.style(" * Encrypted: ", fg="yellow") +
                ("Yes" if x["crypt"] else "No"))
            click.echo(
                click.style(" * Mounted: ", fg="yellow") +
                ("At " + x["mountpoint"] if x["mountpoint"] else "No"))
    except Exception as e:
        raise CLIException(str(e))