Commit 8741c407 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Create an image compute cmd group, make it work

- image compute group contains all Compute Image API commands, as oposed to
Plankton API commands.

- definition of a kamaki cli command slightly changed: a command with
subcommands can have a class without being a command itself, as long as it has
subcommands! Thus a subcommand group can be defined with docs and everything.

- image public is not image list (docs not updated yet)
parent 47ccc132
......@@ -118,7 +118,7 @@ To see the command groups, use -h or --help like in example 1.3.1. In the same w
config : Configuration commands
flavor : Compute/Cyclades API flavor commands
history: Command history
image : Compute/Cyclades or Plankton API image commands
image : Plankton Image API commands
network: Compute/Cyclades API network commands
server : Compute/Cyclades API server commands
store : Pithos+ storage commands
......@@ -254,7 +254,7 @@ class Shell(Cmd):
except IndexError:
print('Syntax: %s %s' % (' '.join(clist[upto:]), cls.syntax))
if cmd.subcommands:
self._register_method(help_method, 'help_%s' %
......@@ -70,7 +70,7 @@ class Command(object):
def is_command(self):
return self.cmd_class is not None
return self.cmd_class is not None and len(self.subcommands) == 0
def has_description(self):
......@@ -153,7 +153,7 @@ class CommandTree(object):
self._all_commands[path] = new_cmd
cmd = new_cmd
if cmd_class is not None:
if cmd_class:
if description is not None: = description
......@@ -46,9 +46,8 @@ from os.path import exists
server_cmds = CommandTree('server', 'Compute/Cyclades API server commands')
flavor_cmds = CommandTree('flavor', 'Compute/Cyclades API flavor commands')
image_cmds = CommandTree('image', 'Cyclades/Plankton API image commands')
network_cmds = CommandTree('network', 'Compute/Cyclades API network commands')
_commands = [server_cmds, flavor_cmds, image_cmds, network_cmds]
_commands = [server_cmds, flavor_cmds, network_cmds]
about_authentication = '\nUser Authentication:\
......@@ -41,9 +41,7 @@ from kamaki.cli.commands.cyclades_cli import _init_cyclades
from kamaki.cli.commands import _command_init, errors
image_cmds = CommandTree(
'Compute/Cyclades or Glance API image commands')
image_cmds = CommandTree('image', 'Plankton Image API commands')
_commands = [image_cmds]
......@@ -174,6 +172,7 @@ class image_register(_init_image):
if not location.startswith('pithos://'):
account = self.config.get('store', 'account') \
or self.config.get('global', 'account')
assert account, 'No user account provided'
if account[-1] == '/':
account = account[:-1]
container = self.config.get('store', 'container') \
......@@ -282,7 +281,12 @@ class image_setmembers(_init_image):
class image_list(_init_cyclades):
class image_compute(_init_cyclades):
"""Compute Image API commands"""
class image_compute_list(_init_cyclades):
"""List images"""
arguments = dict(
......@@ -315,7 +319,7 @@ class image_list(_init_cyclades):
class image_info(_init_cyclades):
class image_compute_info(_init_cyclades):
"""Get detailed information on an image"""
......@@ -333,7 +337,7 @@ class image_info(_init_cyclades):
class image_delete(_init_cyclades):
class image_compute_delete(_init_cyclades):
"""Delete an image (WARNING: image file is also removed)"""
......@@ -348,7 +352,7 @@ class image_delete(_init_cyclades):
class image_properties(_init_cyclades):
class image_compute_properties(_init_cyclades):
"""Get properties related to OS installation in an image"""
......@@ -382,7 +386,7 @@ class image_addproperty(_init_cyclades):
class image_setproperty(_init_cyclades):
class image_compute_setproperty(_init_cyclades):
"""Update an existing property in an image"""
......@@ -400,7 +404,7 @@ class image_setproperty(_init_cyclades):
class image_delproperty(_init_cyclades):
class image_compute_delproperty(_init_cyclades):
"""Delete a property of an image"""
......@@ -1021,7 +1021,7 @@ class store_upload(_store_container_command):
poolsize=IntArgument('set pool size', '--with-pool-size'),
'do not show progress bar',
('N', '--no-progress-bar'),
('-N', '--no-progress-bar'),
overwrite=FlagArgument('Force (over)write', ('-f', '--force'))
......@@ -41,6 +41,17 @@ class ImageClient(Client):
def __init__(self, base_url, token):
super(ImageClient, self).__init__(base_url, token)
def test(self):
:param image_id: (str)
:param member: (str) user to allow access to current user's images
path = path4url('images')
data = dict(stuff='stuff')
r = self.put(path, json=data, async_headers={'x-image-meta-name': 'lalakis'})
def list_public(self, detail=False, filters={}, order=''):
:param detail: (bool)
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