Revision f084bdc8 kamaki/cli/commands/image.py
b/kamaki/cli/commands/image.py | ||
---|---|---|
42 | 42 |
from kamaki.cli.utils import filter_dicts_by_dict |
43 | 43 |
from kamaki.clients.image import ImageClient |
44 | 44 |
from kamaki.clients.pithos import PithosClient |
45 |
from kamaki.clients.astakos import AstakosClient |
|
46 | 45 |
from kamaki.clients import ClientError |
47 | 46 |
from kamaki.cli.argument import ( |
48 | 47 |
FlagArgument, ValueArgument, RepeatableArgument, KeyValueArgument, |
... | ... | |
347 | 346 |
@errors.plankton.connection |
348 | 347 |
@errors.plankton.id |
349 | 348 |
def _run(self, image_id): |
350 |
for mid in self['member_ID_to_add']:
|
|
349 |
for mid in (self['member_ID_to_add'] or []):
|
|
351 | 350 |
self.client.add_member(image_id, mid) |
352 |
for mid in self['member_ID_to_remove']:
|
|
351 |
for mid in (self['member_ID_to_remove'] or []):
|
|
353 | 352 |
self.client.remove_member(image_id, mid) |
354 |
if len([term for term in self.required if ( |
|
355 |
self[term] and not term.startswith('member_ID'))]) > 1: |
|
356 |
meta = self.client.get_meta(image_id) |
|
357 |
for k, v in self['property_to_set'].items(): |
|
358 |
meta['properties'][k.upper()] = v |
|
359 |
for k in self['property_to_del']: |
|
360 |
meta['properties'][k.upper()] = None |
|
361 |
self._optional_output(self.client.update_image( |
|
362 |
image_id, |
|
363 |
name=self['image_name'], |
|
364 |
disk_format=self['disk_format'], |
|
365 |
container_format=self['container_format'], |
|
366 |
status=self['status'], |
|
367 |
public=self['publish'] or self['unpublish'] or None, |
|
368 |
**meta['properties'])) |
|
353 |
meta = self.client.get_meta(image_id) |
|
354 |
for k, v in self['property_to_set'].items(): |
|
355 |
meta['properties'][k.upper()] = v |
|
356 |
for k in (self['property_to_del'] or []): |
|
357 |
meta['properties'][k.upper()] = None |
|
358 |
self._optional_output(self.client.update_image( |
|
359 |
image_id, |
|
360 |
name=self['image_name'], |
|
361 |
disk_format=self['disk_format'], |
|
362 |
container_format=self['container_format'], |
|
363 |
status=self['status'], |
|
364 |
public=self['publish'] or self['unpublish'] or None, |
|
365 |
**meta['properties'])) |
|
369 | 366 |
if self['with_output']: |
370 | 367 |
self._optional_output(self.get_image_details(image_id)) |
371 | 368 |
|
... | ... | |
754 | 751 |
if self['property_to_add']: |
755 | 752 |
self.client.update_image_metadata( |
756 | 753 |
image_id, **self['property_to_add']) |
757 |
for key in self['property_to_del']:
|
|
754 |
for key in (self['property_to_del'] or []):
|
|
758 | 755 |
self.client.delete_image_metadata(image_id, key) |
759 | 756 |
if self['with_output']: |
760 | 757 |
self._optional_output(self.client.get_image_details(image_id)) |
Also available in: Unified diff