Commit 716a15a5 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

Merge branch 'release-0.13'

parents 2632294b f61c5d60
Copyright 2011-2013 GRNET S.A. All rights reserved.
Copyright 2011-2014 GRNET S.A. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
......
Changelog for 0.12.10
- Bugfix: --diagnostics works
- Bugfix: Alow unicode image names (#5110)
- Bugfix: Fix HTTP headers in image members add (#5115)
Changelog for 0.12.9
- Bugfix: --unpublish didn't work in kamaki image modify
Changelog for 0.12.8
- Fix image property-del bug (made it a required argument of image modify) [#4940]
- Sync kamaki documentation for image property updates [#4940]
Changelog for 0.12.7
- Restore user_info, user_term for bw compatibility in AstakosClient [#4880]
Changelog for 0.12.6
- Restore get_service_endpoints for AstakosClient
Changelog for hotfix version 0.12.5
- Fix bug in readall (wrong behavior in non-regular files) [#4871]
Changelog for hotfix version 0.12.4
- Fix bug when registering image with upload but no metafile [#4864]
- Minor typos
CHANGELOG for hotfix version 0.12.3
- Import the whole astakosclient package
- Minor typos in help message
CHANGELOG for hotfix version 0.12.2
- Always use "details" call in neworks/subnets list
- Restore server console, remove --vnc option from server info
- Fix server create --networks|--no-networks
- Use --status in * wait commands
- Fix typos in documentation
CHANGELOG for hotfix version 0.12.1
- Various minor typos
- Rename comand group "kamaki project membership" --> "kamaki membership"
- Add docs for astakos-related commands:
user, quota, resources, project, membership
- Correct/simplify network arguments in server create (#4563)
CHANGELOG for version 0.12
Bug Fixes:
- In file list, the path or prefix was converted to boolean value. Fixed.
- Thread options did not work [#4616]
- Various minor typos
Changes:
1. Make astakosclient a mantatory requirement for kamaki [#4312]
2. Make post_user_catalogs obsolete, but keep for one more version [#4337]
3. Rename user commands for cached account requests as /user session [#4340]
4. Remove max_theads from config, move control to threaded commands [#4617]
5. Modify all commands [#4583]
New scheme for ALL <object> <verb> [object id] [--arguments]
e.g., file modidy --metadata-add=revier='Mr. Reviewer' /pithos/myfile.txt
6. Deprecate (with note) server stats/console/addr (move to server info)
7. A vanilla kamaki call now shows only the available commands instead of
loading a shell [#4612]
8. Add self.poolsize at kamaki.clients.Client
9. Add ip attach/detach (shortcuts for port create/delete)
Features:
1. Cache user catalog calls [#4337]
2. Implement separate methods for uuid2usernames and v.v. [#4337]
3. Move all methods from snf-astakos.py to astakos.py, with some renaimings
astakos_quotas/uuid/username/authenticate --> user_quotas/uuid2username/username2uuid/info
astakos_... --> admin_...
e.g.,
astakos_services --> admin_service, astakos_commission --> admin_commission
4. Implement OpenStack Network API 2.0, with synnefo/cyclades extentions. New:
network info/list/create/delete/set
subnet info/list/create/set
port info/list/create/delete/set
5. Create a kamaki-shell for kamaki shell [#4612]
.. _Changelog:
Unified Changelog file for Kamaki versions >= 0.13
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _Changelog-0.13:
v0.13
=====
Released: Tue Nov 18 11:13:58 EET 2014
Features
--------
* Name and Type filters in endpoint list
* In image register, meta gets same sharing as image
* Allow image register to auto-resolve remote path from local file
* Merge ClientError and AstakosClientException --> AstakosClientError
* Restore kamaki file publish/unpublish
* Accept username or UUID in kamaki file --account/--to-account
* History has now a buffer limit
* Slice notation in history show
* Datetime support in DateArgument
* Resources can be reassigned to projects
* Update account API commands to reflect changes in synnefo 0.16
* Implement a get_endpoint_url method and use it
* Rename kamaki.clients.Client.base_url --> endpoint_url, keep BW compatibility
* Remove deprecated --hard argument in "kamaki server reboot"
* Modify upload and download command semantics, to be more intuitive
* Implement more console types (vnc-ws and vnc-wss)
* Support secure HTTP connections with SSL [grnet/kamaki#54]
Support
-------
* Adjust project commands to project_API changes
* Add "dateutils" to dependencies
* Rename packages, classes and objects to conform to pep8 standards
* Use the term "project_id" instead of "project" everywhere in kamaki.clients
* Update library documentation with examples [grnet/kamaki#49]
Bug Fixes
---------
* Register image with upload but no metafile
* Minor typos and updates in command help messages
* All URL-related params are now URL-encoded
* In file list, show all directories as directories
* Do not let file-* cmds to create containers
* Fix unicode-related bugs in error reporting
* Modify HTTP logs and console output to escape control characters
[grnet/kamaki#32]
* Fix bug of incorrectly suppressed errors in "kamaki network create"
[grnet/kamaki#56]
* Set a default logger to LoggedAstakosClient [grnet/kamaki#58]
* Show the correct name when switching kamaki users
[grnet/kamaki#66]
* Fix Python 2.6 compatibility concerning HTTPS arguments
[grnet/kamaki#73]
* Fix Python 2.6 compatibility concerning encode parameters
* Rename "raise_ssl_errors" to "ignore_ssl" in HTTPConnection class
[grnet/kamaki#74]
* Warn or raise errors when the configuration file is inaccessible
[grnet/kamaki#71]
* Handle non-ascii characters when managing configuration options
[grnet/kamaki#76]
* Handle SSL unicode bug with grace [grnet/kamaki#67]
* Check server status before changing it [grnet/kamaki#57]
* Fix format of "create_volume" return values
* Support old history files [grnet/kamaki#80]
include README.rst COPYRIGHT Changelog
include README.md COPYRIGHT Changelog
recursive-include docs *
prune docs/_build
......@@ -13,8 +13,6 @@ kamaki 0.12
e.g., kamaki server create --name=NAME --image-id=IMAGE_ID --flavor-id=FLAVOR_ID
kamaki image register --name=NAME --location=IMAGE_LOCATION
3. kamaki.clients.astakos.AstakosClient is now imported from python astakosclient.AstakosClient
Config file
-----------
......
./kamaki
========
Overview
--------
./kamaki is a multipurpose, interactive command-line tool, and also a
client development library for managing OpenStack clouds.
As a development library, it implements the OpenStack APIs, along with the
custom extensions introduced by [Synnefo](http://www.synnefo.org).
./kamaki is open source and released under a 2-clause BSD License.
Project Page
------------
Please see the [official Synnefo site](http://www.synnefo.org) and the
[Synnefo documentation](http://www.synnefo.org) for more information.
Copyright and license
=====================
Copyright (C) 2011-2014 GRNET S.A. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and
documentation are those of the authors and should not be
interpreted as representing official policies, either expressed
or implied, of GRNET S.A.
README
=======
./kamaki is a multipurpose, interactive command-line tool and also a client
development API for managing clouds.
As a development API, it is an initial implementation of the Synnefo API
( http://www.synnefo.org cloud management software extends OpenStack ), while
preserving compatibility with the OpenStack API.
......@@ -66,6 +66,12 @@ project (Astakos)
terminate Terminate a project (special privileges needed)
application Application management commands
reinstate Reinstate a terminated project (special privileges needed)
join Join a project
dismiss Dismiss your denied application
deny Deny an application (special privileges needed)
enroll Enroll a user to a project
cancel Cancel your application
approve Approve an application (special privileges needed)
membership (Astakos)
--------------------
......@@ -73,8 +79,6 @@ membership (Astakos)
.. code-block:: text
info Details on a membership
enroll Enroll somebody to a project you manage
join Join a project
list List all memberships
accept Accept a membership for a project you manage
leave Leave a project you have membership to
......@@ -88,7 +92,6 @@ quota (Account/Astakos)
.. code-block:: text
list Get user quotas
info Get quota for a service (cyclades, pithos, astakos)
resource (Astakos)
------------------
......@@ -211,7 +214,7 @@ server (Compute/Cyclades)
start Start an existing virtual server
shutdown Shutdown an active virtual server
delete Delete a virtual server
console Create a VMC console and show connection information
console Create a VNC console and show connection information
wait Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
Showcase: Create a server
......@@ -365,7 +368,7 @@ Showcase: Connect a network to a VM
11688 (An Ubuntu server)
* Try network-connect (to get help) *
[network]: connect
[network]: connect
Syntax error
usage: connect <network id> --device-id <DEVICE_ID> [-s] [-h] [-i] [--config CONFIG]
......@@ -380,7 +383,7 @@ Showcase: Connect a network to a VM
-v,--verbose: More info at response
* Connect VM with id 11687 to network with id 1409
[network]: connect 11687 --device-id=1409 --wait
[network]: connect 1409 --device-id=11687 --wait
Creating port between network 1409 and server 11687
New port: 8
......@@ -402,12 +405,12 @@ Showcase: Connect a network to a VM
updated : 2012-11-23T17:18:25.095225+00:00
* Get connectivity details on VM with id 11687 *
[network]: /server info 11687 --nics
[network]: /server info 11687 --nics
nic-11687-1
ipv4 : 192.168.1.1
ipv6 : None
mac_address: aa:0f:c2:0b:0e:85
network_id : 1409
ipv4 : 192.168.1.1
ipv6 : None
mac_address : aa:0f:c2:0b:0e:85
network_id : 1409
firewallProfile: DISABLED
nic-11687-0
ipv4 : 83.212.106.111
......@@ -417,6 +420,57 @@ Showcase: Connect a network to a VM
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
volume (Block Storage)
----------------------
.. code-block:: text
info Get details about a volume
list List volumes
create Create a new volume
modify Modify a volumes' properties
reassign Reassign volume to a different project
type Get volume type details
types List volume types
delete Delete a volume
Showcase: Create a volume
^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: console
$ kamaki volume create --server-id=11687 --name='Small Volume' --size=2
id: v0lum31d
name: Small Volume
size: 2
...
$ kamaki volume list
v0lum31d Small Volume
snapshot (Block Storage)
------------------------
.. code-block:: text
info Get details about a snapshot
list List snapshots
create Create a new snapshot
modify Modify a snapshots' properties
delete Delete a snapshot
Showcase: Create a snapshot
^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: console
$ kamaki snapshot create --volume-id=v0lum31d --name='Small Snapshot'
id: sn4p5h071d
name: Small Snapshot
...
$ kamaki snapshot list
sn4p5h071d Small Snapshot
...
container (Storage/Pithos+)
---------------------------
......@@ -492,7 +546,7 @@ Showcase: Upload and download a file
[file]: /container create mycont2
* List accessible containers *
* List accessible containers *
[file]: /container list
1. mycont1 (0B, 0 objects)
2. mycont2 (0B, 0 objects)
......
......@@ -123,13 +123,13 @@ master_doc = 'index'
# General information about the project.
project = u'Kamaki'
copyright = u'2013, GRNET'
copyright = u'2014, GRNET'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.12'
version = '0.13'
# The full version, including alpha/beta/rc tags.
try:
......
Adding Commands
===============
Kamaki commands are implemented as python classes, decorated with a special
decorator called *command*. This decorator is a method of *kamaki.cli* that
adds a new command in a *CommandTree* structure. A *CommandTree* (package
*kamaki.cli.commant_tree*) is a data structure used by kamaki to manage command
namespaces.
Kamaki commands are implemented as python classes, which wear a decorator
called *command*. The decorator lives in *kamaki.cli* and its purpose is to
update the *CommandTree* structure. The *CommandTree* class (
*kamaki.cli.cmdtree*) manages command namespaces for kamaki.
For demonstration purposes, the following set of kamaki commands will be
implemented in this document::
mygrp1 list all //show a list
mygrp1 list details [--match=<>] //show list of details
mygrp2 list all [regular expression] [-l] //list all subjects
mygrp2 info <id> [name] //get information for subject with id
mygrp1 list all //show a list
mygrp1 list details [--match=<>] //show list of details
mygrp2 list all [regular expression] [-l] //list all subjects
mygrp2 info <id> [--filter] //information on a subject
There are two command groups to implement i.e., *mygrp1* and *mygrp2*,
.. note:: By convention, the names of the groups describe subjects e.g.,
"server", "network", "container", etc.
Here we get two command groups to implement i.e., *mygrp1* and *mygrp2*,
containing two commands each (*list_all*, *list_details* and *list_all*, *info*
respectively). To avoid ambiguities, command names are prefixed with the
command group they belong to, e.g., *mygrp1_list_all* and *mygrp2_list_all*.
The underscore is used to separate command namespaces.
respectively). The underscore is used to separate command namespaces and should
be considered as a special character in this context.
The first command (*mygrp1_list_all*) has the simplest possible syntax: no
parameters, no runtime arguments. The second accepts an optional runtime argument with a value. The third features an optional parameter and an optional
runtime flag argument. The last is an example of a command with an obligatory
and an optional parameter.
parameters, no runtime arguments. The second one defines one optional runtime
argument with a value. The third features an optional parameter and an optional
runtime flag argument. The last one is an example of a command with an
obligatory and an optional parameter.
Examples of the expected behavior in one-command mode:
Some examples:
.. code-block:: console
......@@ -51,11 +53,12 @@ Examples of the expected behavior in one-command mode:
The CommandTree structure
-------------------------
CommandTree manages a command by its namespace. Each command is stored in
a tree path, where each node is a name. A leaf is the end term of a namespace and contains a pointer to the command class to be executed.
CommandTree manages commands and their namespaces. Each command is stored in
a tree, where each node is a name. A leaf is the rightmost term of a namespace
and contains a pointer to the executable command class.
Here is an example from the actual kamaki command structure, where the commands
*file upload*, *file list* and *file info* are represented as shown bellow::
Here is an example from the actual kamaki command structure, featuring the
commands *file upload*, *file list* and *file info* ::
- file
''''''''|- info
......@@ -76,11 +79,10 @@ Now, let's load the showcase example on CommandTrees::
Each command group should be stored on a different CommandTree.
For that reason, command specification modules should contain a list of CommandTree objects, named *_commands*. This mechanism allows any interface
For that reason, command specification modules should contain a list of
CommandTree objects, named *_commands*. This mechanism allows any interface
application to load the list of commands from the *_commands* array.
The first name of the command path and a description (name, description) are needed to initializeg a CommandTree:
.. code-block:: python
_mygrp1_commands = CommandTree('mygrp', 'mygrp1 description')
......@@ -88,14 +90,16 @@ The first name of the command path and a description (name, description) are nee
_commands = [_mygrp1_commands, _mygrp2_commands]
.. note:: The name and the description, will later appear in automatically
created help messages
The command decorator
---------------------
All commands are specified by subclasses of *kamaki.cli.commands._command_init*
All commands are specified by subclasses of *kamaki.cli.cmds.CommandInit*
These classes are called "command specifications".
The *command* decorator mines all the information needed to build a namespace
The *command* decorator mines all the information needed to build namespaces
from a command specification::
class code ---> command() --> updated CommandTree structure
......@@ -141,9 +145,8 @@ groups.
Set command description
-----------------------
The description of each command is the first line of the class commend. The
following declaration of *mygrp2-info* command has a "*get information for
subject with id*" description.
The first line of the class commend is used as the command short description.
The rest is used as the detailed description.
.. code-block:: python
......@@ -178,21 +181,20 @@ a command specification class with a command and no code:
Declare run-time argument
-------------------------
A special argument mechanism allows the definition of run-time arguments. This
mechanism is based on argparse and is designed to simplify argument definitions
when specifying commands.
The argument mechanism is based on the standard argparse module.
Some basic argument types are defined at the
`argument module <code.html#module-kamaki.cli.argument>`_, but it is not
a bad idea to extent these classes in order to achieve specialized type
checking and syntax control. Still, in most cases, the argument types of the
argument package are enough for most cases.
checking and syntax control with respect to the semantics of each command.
Still, in most cases, the argument types of the argument package are enough for
most cases.
To declare a run-time argument on a specific command, the specification class
should contain a dict called *arguments* , where Argument objects are stored.
Each argument object is a run-time argument. Syntax checking happens at client
level, while the type checking is implemented in the Argument code (e.g.,
IntArgument checks if the value is an int).
Each argument object is a run-time argument. Syntax checking happens at the
command specification level, while the type checking is implemented in the
Argument subclasses.
.. code-block:: python
......@@ -227,17 +229,18 @@ or more usually and elegantly:
Accessing run-time arguments
----------------------------
To access run-time arguments, users can use the *_command_init* interface,
which implements *__item__* accessors to handle run-time argument values. In
other words, one may get the value of an argument with *self[<argument>]*.
To access run-time arguments, command classes extend the *CommandInit*
interface, which implements *__item__* accessors to handle run-time argument
values. In other words, one may get the runtime value of an argument by calling
*self[<argument>]*.
.. code-block:: python
from kamaki.cli.argument import ValueArgument
from kamaki.cli.commands import _command_init
from kamaki.cli.commands import CommandInit
@command(_mygrp1_commands)
class mygrp1_list_details(_command_init):
class mygrp1_list_details(CommandInit):
"""List of details"""
arguments = dict(
......@@ -250,6 +253,31 @@ other words, one may get the value of an argument with *self[<argument>]*.
assert self['match'] == self.arguments['match'].value
...
Non-positional required arguments
---------------------------------
By convention, kamaki uses positional arguments for identifiers and
non-positional arguments for everything else. By default, non-positional
arguments are optional. A non-positional argument can explicitly set to be
required at command specification level:
.. code-block:: python
...
@command(_mygrp1_commands)
class mygrp1_list_details(CommandInit):
"""List of details"""
arguments = dict(
match=ValueArgument(
'Filter output to match string', ('-m', --match'))
)
required = (match, )
A tupple means "all required", while a list notation means "at least one".
The main method and command parameters
--------------------------------------
......@@ -297,19 +325,18 @@ The above lines contain the following information:
* Runtime arguments (line 13): [-l]
* Runtime arguments help (line 13): detailed list
.. tip:: It is suggested to code the main functionality in a member method
called *_run*. This allows the separation between syntax and logic. For
example, an external library may need to call a command without caring
.. tip:: By convention, the main functionality is implemented in a member
method called *_run*. This allows the separation between syntax and logic.
For example, an external library may need to call a command without caring
about its command line behavior.
Letting kamaki know
-------------------
Kamaki will load a command specification *only* if it is set as a configurable
option. To demonstrate this, let the command specifications coded above be
stored in a file named *grps.py*.
Assume that the command specifications presented so far be stored in a file
named *grps.py*.
The developer should move the file *grps.py* to *kamaki/cli/commands*, the
The developer should move the file *grps.py* to *kamaki/cli/cmds*, the
default place for command specifications
These lines should be contained in the kamaki configuration file for a new
......@@ -343,8 +370,8 @@ Summary: create a command set
# File: grps.py
from kamaki.cli.commands import _command_init
from kamaki.cli.command_tree import CommandTree
from kamaki.cli.cmds import CommandInit
from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.argument import ValueArgument, FlagArgument
...
......@@ -361,14 +388,14 @@ Summary: create a command set
@command(_mygrp1_commands)
class mygrp1_list(_command_init):
class mygrp1_list(CommandInit):
"""List mygrp1 objects.
There are two versions: short and detailed
"""
@command(_mygrp1_commands)
class mygrp1_list_all(_command_init):
class mygrp1_list_all(CommandInit):
"""show a list"""