diff --git a/zunclient/api_versions.py b/zunclient/api_versions.py index 5a12c43e..30788015 100644 --- a/zunclient/api_versions.py +++ b/zunclient/api_versions.py @@ -30,7 +30,7 @@ if not LOG.handlers: HEADER_NAME = "OpenStack-API-Version" SERVICE_TYPE = "container" -DEFAULT_API_VERSION = '1.9' +DEFAULT_API_VERSION = '1.11' _SUBSTITUTIONS = {} diff --git a/zunclient/common/utils.py b/zunclient/common/utils.py index 0aa5cd0e..c9382564 100644 --- a/zunclient/common/utils.py +++ b/zunclient/common/utils.py @@ -198,6 +198,33 @@ def parse_command(command): return " ".join(output) +def parse_mounts(mounts): + err_msg = ("Invalid mounts argument '%s'. mounts arguments must be of " + "the form --mount source=,destination=.") + parsed_mounts = [] + for mount in mounts: + mount_info = {"source": "", "destination": ""} + for mnt in mount.split(","): + try: + k, v = mnt.split("=", 1) + k = k.strip() + v = v.strip() + except ValueError: + raise apiexec.CommandError(err_msg % mnt) + if k in mount_info: + if mount_info[k]: + raise apiexec.CommandError(err_msg % mnt) + mount_info[k] = v + else: + raise apiexec.CommandError(err_msg % mnt) + + if not mount_info['source'] or not mount_info['destination']: + raise apiexec.CommandError(err_msg % mnt) + + parsed_mounts.append(mount_info) + return parsed_mounts + + def parse_nets(ns): err_msg = ("Invalid nets argument '%s'. nets arguments must be of " "the form --nets