summaryrefslogtreecommitdiff
path: root/openstackclient/image/v1
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/image/v1')
-rw-r--r--openstackclient/image/v1/image.py65
1 files changed, 54 insertions, 11 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 0382501e..c18f3fc7 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -35,6 +35,7 @@ from glanceclient.common import utils as gc_utils
from openstackclient.api import utils as api_utils
from openstackclient.common import parseractions
from openstackclient.common import utils
+from openstackclient.i18n import _ # noqa
DEFAULT_CONTAINER_FORMAT = 'bare'
@@ -93,11 +94,6 @@ class CreateImage(show.ShowOne):
"(default: %s)" % DEFAULT_DISK_FORMAT,
)
parser.add_argument(
- "--owner",
- metavar="<project>",
- help="Image owner project name or ID",
- )
- parser.add_argument(
"--size",
metavar="<size>",
help="Image size, in bytes (only used with --location and"
@@ -178,12 +174,32 @@ class CreateImage(show.ShowOne):
help="Set a property on this image "
"(repeat option to set multiple properties)",
)
+ # NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
+ # 2.x release. Do not remove before Jan 2017
+ # and a 3.x release.
+ project_group = parser.add_mutually_exclusive_group()
+ project_group.add_argument(
+ "--project",
+ metavar="<project>",
+ help="Set an alternate project on this image (name or ID)",
+ )
+ project_group.add_argument(
+ "--owner",
+ metavar="<project>",
+ help=argparse.SUPPRESS,
+ )
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
+ if getattr(parsed_args, 'owner', None) is not None:
+ self.log.warning(_(
+ 'The --owner option is deprecated, '
+ 'please use --project instead.'
+ ))
+
# Build an attribute dict from the parsed args, only include
# attributes that were actually set on the command line
kwargs = {}
@@ -198,6 +214,12 @@ class CreateImage(show.ShowOne):
# Only include a value in kwargs for attributes that are
# actually present on the command line
kwargs[attr] = val
+
+ # Special case project option back to API attribute name 'owner'
+ val = getattr(parsed_args, 'project', None)
+ if val:
+ kwargs['owner'] = val
+
# Handle exclusive booleans with care
# Avoid including attributes in kwargs if an option is not
# present on the command line. These exclusive booleans are not
@@ -383,7 +405,7 @@ class ListImage(lister.Lister):
'Status',
'Visibility',
'Protected',
- 'Owner',
+ 'Project',
'Properties',
)
else:
@@ -477,11 +499,6 @@ class SetImage(command.Command):
help="New image name",
)
parser.add_argument(
- "--owner",
- metavar="<project>",
- help="New image owner project (name or ID)",
- )
- parser.add_argument(
"--min-disk",
metavar="<disk-gb>",
type=int,
@@ -590,12 +607,32 @@ class SetImage(command.Command):
metavar="<checksum>",
help="Image hash used for verification",
)
+ # NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
+ # 2.x release. Do not remove before Jan 2017
+ # and a 3.x release.
+ project_group = parser.add_mutually_exclusive_group()
+ project_group.add_argument(
+ "--project",
+ metavar="<project>",
+ help="Set an alternate project on this image (name or ID)",
+ )
+ project_group.add_argument(
+ "--owner",
+ metavar="<project>",
+ help=argparse.SUPPRESS,
+ )
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
+ if getattr(parsed_args, 'owner', None) is not None:
+ self.log.warning(_(
+ 'The --owner option is deprecated, '
+ 'please use --project instead.'
+ ))
+
kwargs = {}
copy_attrs = ('name', 'owner', 'min_disk', 'min_ram', 'properties',
'container_format', 'disk_format', 'size', 'store',
@@ -607,6 +644,12 @@ class SetImage(command.Command):
# Only include a value in kwargs for attributes that are
# actually present on the command line
kwargs[attr] = val
+
+ # Special case project option back to API attribute name 'owner'
+ val = getattr(parsed_args, 'project', None)
+ if val:
+ kwargs['owner'] = val
+
# Handle exclusive booleans with care
# Avoid including attributes in kwargs if an option is not
# present on the command line. These exclusive booleans are not