Пример #1
0
"""
The node management command actions and options.
"""
from utilities.storage import Storage
from utilities.optparser import OptParser, Option
from commands.node.parser import GLOBAL_OPT, GLOBAL_OPTS

PROG = "om pool"

OPT = Storage({
    "access":
    Option("--access",
           default="rwo",
           action="store",
           dest="access",
           help="The access mode of the volume. rwo, roo, rwx, rox."),
    "blk":
    Option("--blk",
           default=False,
           action="store_true",
           dest="blk",
           help="Create a block volume instead of a formatted volume."),
    "name":
    Option("--name",
           action="store",
           dest="name",
           help="The name of the object."),
    "namespace":
    Option(
        "--namespace",
        action="store",
Пример #2
0
try:
    import requests
except ImportError:
    raise ex.InitError("the requests module must be installed")

try:
    requests.packages.urllib3.disable_warnings()
except AttributeError:
    pass
verify = False

PROG = "om array"
OPT = Storage({
    "help": Option(
        "-h", "--help", action="store_true", dest="parm_help",
        help="show this help message and exit"),
    "array": Option(
        "-a", "--array", action="store", dest="array_name",
        help="The name of the array, as defined in the node or cluster configuration."),
    "name": Option(
        "--name", action="store", dest="name",
        help="The object name"),
    "size": Option(
        "--size", action="store", dest="size",
        help="The disk size, expressed as a size expression like 1g, 100mib, ..."),
    "tags": Option(
        "--tag", action="append", dest="tags",
        help="An object tag. Can be set multiple times."),
    "blocksize": Option(
        "--blocksize", type=int, action="store", dest="blocksize",
Пример #3
0
import core.exceptions as ex
from utilities.converters import convert_size
from core.node import Node
from env import Env
from utilities.optparser import OptParser, Option
from utilities.naming import factory, split_path
from utilities.lazy import lazy
from utilities.storage import Storage
from utilities.proc import justcall, which

PROG = "om array"
OPT = Storage({
    "help":
    Option("-h",
           "--help",
           action="store_true",
           dest="parm_help",
           help="show this help message and exit"),
    "array":
    Option(
        "-a",
        "--array",
        action="store",
        dest="array_name",
        help=
        "The name of the array, as defined in the node or cluster configuration."
    ),
    "pool":
    Option("--pool",
           action="store",
           dest="pool",
Пример #4
0
except ImportError:
    raise ex.InitError("the requests module must be installed")

try:
    requests.packages.urllib3.disable_warnings()
except AttributeError:
    pass

VERIFY = False

PROG = "om array"
OPT = Storage({
    "help":
    Option("-h",
           "--help",
           default=None,
           action="store_true",
           dest="parm_help",
           help="show this help message and exit"),
    "array":
    Option(
        "-a",
        "--array",
        default=None,
        action="store",
        dest="array_name",
        help=
        "The name of the array, as defined in node or cluster configuration."),
    "name":
    Option("--name",
           default=None,
           action="store",
Пример #5
0
from utilities.optparser import Option
from utilities.storage import Storage

OPT = Storage({
    "add": Option(
        "--add", default=None,
        action="store",
        help="A list member to add to the value pointed by :opt:`--param`. "
             "If :opt:`--index` is set, insert the new element at the "
             "specified position in the list."),
    "backlog": Option(
        "--backlog", default=None,
        action="store", dest="backlog",
        help="A size expression limiting the volume of data fetched "
             "from the log file tail. Default is 10k."),
    "color": Option(
        "--color", default="auto",
        action="store", dest="color",
        help="Colorize output. Possible values are:\n\n"
             "* auto: guess based on tty presence\n"
             "* always|yes: always colorize\n"
             "* never|no: never colorize"),
    "config": Option(
        "--config", default=None,
        action="store", dest="parm_config",
        help="The configuration to use as template when creating or "
             "installing a service. The value can be ``-`` or ``/dev/stdin`` "
             "to read the json-formatted configuration from stdin, or a file "
             "path, or uri pointing to a ini-formatted configuration, or a "
             "service selector expression (ATTENTION with cloning existing live "
             "services that include more than containers, volumes and backend "
Пример #6
0
The user management command actions and options
"""
import commands.mgr.parser as mp
from utilities.optparser import OptParser, Option
from utilities.storage import Storage
from core.objects.svc import ACTION_ASYNC

PROG = "om usr"

OPT = Storage()
OPT.update(mp.OPT)
OPT.update({
    "key":
    Option("--key",
           default=None,
           action="store",
           dest="key",
           help="The secret key name."),
    "value_from":
    Option(
        "--from",
        default=None,
        action="store",
        dest="value_from",
        help=
        "Read the secret value from a file or a directory. If set to '-' or '/dev/stdin', the value is read from stdin, and the --key is mandatory. If set to a file path, the key name is the file basename. If set to a directory, one key per file is added, and the keyname is the relative path, the --key value being used as the relative path prefix."
    ),
    "password":
    Option("--password",
           default=None,
           action="store",
Пример #7
0
def list(**kwargs):
    cdata = load_context()
    for name in cdata.get("contexts", {}):
        print(name)

def show(name=None, **kwargs):
    cdata = load_context()
    if name is None:
        print(json.dumps(cdata.get("contexts", {}), indent=4))
    else:
        print(json.dumps(cdata.get("contexts", {}).get(name, {}), indent=4))

PROG = "om ctx"
OPT = Storage({
    "help": Option(
        "-h", "--help", action="store_true", dest="parm_help",
        help="show this help message and exit"),
    "user": Option(
        "--user", action="store", dest="user",
        help="User name."),
    "cluster": Option(
        "--cluster", action="store", dest="cluster",
        help="Cluster name."),
    "namespace": Option(
        "--namespace", action="store", dest="namespace",
        help="Namespace name or glob pattern."),
    "name": Option(
        "--name", action="store", dest="name",
        help="The name of the object to create or delete."),
    "certificate_authority": Option(
        "--certificate-authority", action="store", dest="certificate_authority",
Пример #8
0
The service management command actions and options
"""
import commands.mgr.parser as mp
from core.objects.svc import ACTION_ASYNC
from utilities.optparser import OptParser, Option
from utilities.storage import Storage

PROG = "om svc"

OPT = Storage()
OPT.update(mp.OPT)
OPT.update({
    "account":
    Option("--account",
           default=False,
           action="store_true",
           dest="account",
           help="If set the unavailabity period is accounted in the service "
           "availability ratio maintained by the collector."),
    "attach":
    Option("--attach",
           default=False,
           action="store_true",
           dest="attach",
           help="Attach the modulesets specified in a compliance run."),
    "author":
    Option("--author",
           default=None,
           action="store",
           dest="author",
           help="The acker name to log when acknowledging action log errors"),
    "begin":
Пример #9
0
"""
The node management command actions and options.
"""
from utilities.storage import Storage
from utilities.optparser import OptParser, Option
from commands.node.parser import GLOBAL_OPT, GLOBAL_OPTS

PROG = "om network"

OPT = Storage({
    "name": Option(
        "--name", action="store", dest="name",
        help="The name of the object."),
    "verbose": Option(
        "--verbose", default=False,
        action="store_true", dest="verbose",
        help="Include more information to some print commands output. "
             "For example, add the ``next run`` column in the output of "
             ":cmd:`om node print schedule`."),
})
OPT.update(GLOBAL_OPT)

ACTIONS = {
    "Network actions": {
        "ls": {
            "msg": "List the available networks.",
        },
        "setup": {
            "msg": "Create bridges, assign host address, update host routes to node backend networks. This action is executed on node configuration changes. Useful for troubleshoot.",
        },
        "show": {
Пример #10
0
"""
The node management command actions and options.
"""
from utilities.storage import Storage
from utilities.optparser import OptParser, Option
from commands.node.parser import GLOBAL_OPT, GLOBAL_OPTS

PROG = "om daemon"

OPT = Storage({
    "foreground":
    Option("-f",
           "--foreground",
           default=False,
           action="store_true",
           dest="foreground",
           help="Run the deamon in foreground mode."),
    "id":
    Option("--id",
           default=0,
           action="store",
           dest="id",
           help="Specify an id to act on."),
    "name":
    Option("--name",
           action="store",
           dest="name",
           help="The name of the object."),
    "secret":
    Option("--secret",
           default=None,
Пример #11
0
except ImportError:
    raise ex.InitError("the requests module must be installed")

try:
    requests.packages.urllib3.disable_warnings()
except AttributeError:
    pass

VERIFY = False

PROG = "om array"
OPT = Storage({
    "help":
    Option("-h",
           "--help",
           default=None,
           action="store_true",
           dest="parm_help",
           help="show this help message and exit"),
    "array":
    Option(
        "-a",
        "--array",
        default=None,
        action="store",
        dest="array_name",
        help=
        "The name of the array, as defined in node or cluster configuration."),
    "name":
    Option("--name",
           default=None,
           action="store",