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