Commit f084bdc8 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Update docs up to examples/imageregister

Refs: #4692
parent 432cea25
This diff is collapsed.
......@@ -551,7 +551,7 @@ class server_modify(_init_cyclades, _optional_output_cmd):
if self['metadata_to_set']:
self.client.update_server_metadata(
server_id, **self['metadata_to_set'])
for key in self['metadata_to_delete']:
for key in (self['metadata_to_delete'] or []):
errors.cyclades.metadata(
self.client.delete_server_metadata)(server_id, key=key)
if self['with_output']:
......
......@@ -42,7 +42,6 @@ from kamaki.cli.command_tree import CommandTree
from kamaki.cli.utils import filter_dicts_by_dict
from kamaki.clients.image import ImageClient
from kamaki.clients.pithos import PithosClient
from kamaki.clients.astakos import AstakosClient
from kamaki.clients import ClientError
from kamaki.cli.argument import (
FlagArgument, ValueArgument, RepeatableArgument, KeyValueArgument,
......@@ -347,25 +346,23 @@ class image_modify(_init_image, _optional_output_cmd):
@errors.plankton.connection
@errors.plankton.id
def _run(self, image_id):
for mid in self['member_ID_to_add']:
for mid in (self['member_ID_to_add'] or []):
self.client.add_member(image_id, mid)
for mid in self['member_ID_to_remove']:
for mid in (self['member_ID_to_remove'] or []):
self.client.remove_member(image_id, mid)
if len([term for term in self.required if (
self[term] and not term.startswith('member_ID'))]) > 1:
meta = self.client.get_meta(image_id)
for k, v in self['property_to_set'].items():
meta['properties'][k.upper()] = v
for k in self['property_to_del']:
meta['properties'][k.upper()] = None
self._optional_output(self.client.update_image(
image_id,
name=self['image_name'],
disk_format=self['disk_format'],
container_format=self['container_format'],
status=self['status'],
public=self['publish'] or self['unpublish'] or None,
**meta['properties']))
meta = self.client.get_meta(image_id)
for k, v in self['property_to_set'].items():
meta['properties'][k.upper()] = v
for k in (self['property_to_del'] or []):
meta['properties'][k.upper()] = None
self._optional_output(self.client.update_image(
image_id,
name=self['image_name'],
disk_format=self['disk_format'],
container_format=self['container_format'],
status=self['status'],
public=self['publish'] or self['unpublish'] or None,
**meta['properties']))
if self['with_output']:
self._optional_output(self.get_image_details(image_id))
......@@ -754,7 +751,7 @@ class imagecompute_modify(_init_cyclades, _optional_output_cmd):
if self['property_to_add']:
self.client.update_image_metadata(
image_id, **self['property_to_add'])
for key in self['property_to_del']:
for key in (self['property_to_del'] or []):
self.client.delete_image_metadata(image_id, key)
if self['with_output']:
self._optional_output(self.client.get_image_details(image_id))
......
......@@ -1338,14 +1338,15 @@ class container_modify(_pithos_account, _optional_json):
'Set a versioning scheme (%s)' % ', '.join(
VersioningArgument.schemes), '--versioning')
)
required = ['metadata_to_add', 'metadata_to_delete', 'sizelimit']
required = [
'metadata_to_add', 'metadata_to_delete', 'sizelimit', 'versioning']
@errors.generic.all
@errors.pithos.connection
@errors.pithos.container
def _run(self, container):
metadata = self['metadata_to_add']
for k in self['metadata_to_delete']:
for k in (self['metadata_to_delete'] or []):
metadata[k] = ''
if metadata:
self.client.set_container_meta(metadata)
......@@ -1650,8 +1651,8 @@ class group_create(_pithos_group, _optional_json):
def main(self, groupname):
super(self.__class__, self)._run()
users = self['user_uuid'] + self._usernames2uuids(
self['username']).values()
users = (self['user_uuid'] or []) + self._usernames2uuids(
self['username'] or []).values()
if users:
self._run(groupname, *users)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment