Add --owner to image create
This adds --owner to `image create`. This is backwards compatable with v1. Change-Id: I9e79cf880c91a1386419db729818d23dfe632179 Depends-On: I8d572a070bbb04dccdd051b8e0ad199c5754746e
This commit is contained in:
parent
8a1fb85dba
commit
5ad59968ac
@ -57,8 +57,6 @@ Create/upload an image
|
||||
|
||||
Image owner project name or ID
|
||||
|
||||
*Image version 1 only.*
|
||||
|
||||
.. option:: --size <size>
|
||||
|
||||
Image size, in bytes (only used with --location and --copy-from)
|
||||
|
@ -112,7 +112,7 @@ class CreateImage(show.ShowOne):
|
||||
"""Create/upload an image"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".CreateImage")
|
||||
deadopts = ('owner', 'size', 'location', 'copy-from', 'checksum', 'store')
|
||||
deadopts = ('size', 'location', 'copy-from', 'checksum', 'store')
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateImage, self).get_parser(prog_name)
|
||||
@ -120,7 +120,6 @@ class CreateImage(show.ShowOne):
|
||||
# TODO(bunting): There are additional arguments that v1 supported
|
||||
# that v2 either doesn't support or supports weirdly.
|
||||
# --checksum - could be faked clientside perhaps?
|
||||
# --owner - could be set as an update after the put?
|
||||
# --location - maybe location add?
|
||||
# --size - passing image size is actually broken in python-glanceclient
|
||||
# --copy-from - does not exist in v2
|
||||
@ -149,6 +148,11 @@ class CreateImage(show.ShowOne):
|
||||
help="Image disk format "
|
||||
"(default: %s)" % DEFAULT_DISK_FORMAT,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--owner",
|
||||
metavar="<owner>",
|
||||
help="Image owner project name or ID",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--min-disk",
|
||||
metavar="<disk-gb>",
|
||||
@ -229,7 +233,7 @@ class CreateImage(show.ShowOne):
|
||||
copy_attrs = ('name', 'id',
|
||||
'container_format', 'disk_format',
|
||||
'min_disk', 'min_ram',
|
||||
'tags')
|
||||
'tags', 'owner')
|
||||
for attr in copy_attrs:
|
||||
if attr in parsed_args:
|
||||
val = getattr(parsed_args, attr, None)
|
||||
|
@ -112,6 +112,7 @@ class TestImageCreate(TestImage):
|
||||
'--disk-format', 'fs',
|
||||
'--min-disk', '10',
|
||||
'--min-ram', '4',
|
||||
'--owner', '123456',
|
||||
'--protected',
|
||||
'--private',
|
||||
image_fakes.image_name,
|
||||
@ -121,6 +122,7 @@ class TestImageCreate(TestImage):
|
||||
('disk_format', 'fs'),
|
||||
('min_disk', 10),
|
||||
('min_ram', 4),
|
||||
('owner', '123456'),
|
||||
('protected', True),
|
||||
('unprotected', False),
|
||||
('public', False),
|
||||
@ -139,6 +141,7 @@ class TestImageCreate(TestImage):
|
||||
disk_format='fs',
|
||||
min_disk=10,
|
||||
min_ram=4,
|
||||
owner='123456',
|
||||
protected=True,
|
||||
visibility='private',
|
||||
)
|
||||
@ -213,11 +216,10 @@ class TestImageCreate(TestImage):
|
||||
def test_image_create_dead_options(self):
|
||||
|
||||
arglist = [
|
||||
'--owner', 'nobody',
|
||||
'--store', 'somewhere',
|
||||
image_fakes.image_name,
|
||||
]
|
||||
verifylist = [
|
||||
('owner', 'nobody'),
|
||||
('name', image_fakes.image_name),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
Loading…
x
Reference in New Issue
Block a user