Revision 7ae842c2

b/docs/commands.rst
299 299
    copy          :  Copy an object
300 300
    create        :  Create a container
301 301
    delete        :  Delete a container [or an object]
302
    delgroup      :  Delete a user group on an account
303
    delmeta       :  Delete an existing metadatum of account [, container [or object]]
302
    delgroup      :  Delete a user group
303
    delmeta       :  Delete an existing metadatum for an account [, container [or object]]
304 304
    delpermissions:  Delete all sharing permissions
305 305
    download      :  Download a file
306
    group         :  Get user groups details for account
306
    group         :  Get user groups details
307 307
    hashmap       :  Get the hashmap of an object
308 308
    info          :  Get information for account [, container [or object]]
309 309
    list          :  List containers, object trees or objects in a directory
......
316 316
    publish       :  Publish an object
317 317
    purge         :  Purge a container
318 318
    quota         :  Get  quota for account [or container]
319
    setgroup      :  Create/update a new user group on account
319
    setgroup      :  Create/update a new user group
320 320
    setmeta       :  Set a new metadatum for account [, container [or object]]
321 321
    setpermissions:  Set sharing permissions
322 322
    setquota      :  Set new quota (in KB) for account [or container]
b/docs/developers/clients-api.rst
16 16
.. code-block:: python
17 17
    :emphasize-lines: 1
18 18

  
19
    Example 1.1: Instantiate a Cyclades client
19
    Example 1.1: Instantiate Cyclades and Pithos client
20 20

  
21 21

  
22 22
    from kamaki.clients.cyclades import CycladesClient
......
27 27

  
28 28
.. note:: *cyclades* and *pithos* clients inherit all methods of *compute* and *storage* clients respectively. Separate compute or storage objects should be used only when implementing applications for strict OS Compute or OS Storage services.
29 29

  
30
.. note:: *account* variable is usually acquired by the following astakos call
31

  
32
    .. code-block:: python
33

  
34
        from kamaki.clients.astakos import AstakosClient
35
        astakos = AstakosClient(astakos_base_url, token)
36
        account = astakos.term('uuid')
37

  
30 38
Use client methods
31 39
------------------
32 40

  
b/docs/setup.rst
18 18

  
19 19
    $ kamaki set token myt0k3n==
20 20

  
21
To use the storage service, a user should also provide the corresponding user-name:
22

  
23
.. code-block:: console
24
    :emphasize-lines: 1
25

  
26
    Example 1.2: Set user name to user@domain.com
27

  
28
    $ kamaki set store.account user@domain.com
29

  
30 21
Optional features
31 22
-----------------
32 23

  
......
73 64

  
74 65
will invoke *kamaki store list* with the specified options, but the initial global.account and global.token values will be restored to initial values afterwards.
75 66

  
67
.. note:: on-the-fly calls to store require users to explicetely provide the account uuid corresponding to this token. The account is actually the uuid field at the response of the following call::
68

  
69
    $kamaki astakos authenticate aT0k3n==
70

  
76 71
Editing options
77 72
^^^^^^^^^^^^^^^
78 73

  
......
101 96

  
102 97
.. code-block:: console
103 98

  
104
    $ kamaki config set account myusername@mydomain.com
99
    $ kamaki config set token myT0k3N==
105 100

  
106
In the above example, if the kamaki configuration file does not exist, it will be created with all the default values plus the *global.account* option set to *myusername@mydomain.com* value.
101
In the above example, if the kamaki configuration file does not exist, it will be created with all the default values plus the *global.token* option set to *myT0k3n==* value.
107 102

  
108 103
The configuration file is formatted so that it can be parsed by the python ConfigParser module. It consists of command sections that are denoted with brackets. Every section contains variables with values. For example::
109 104

  
110 105
    [store]
111 106
    url=https://okeanos.grnet.gr/pithos
112
    account=myaccount@mydomain.com
107
    token=my0th3rT0k3n==
113 108

  
114
two configuration options are created: *store.url* and *store.account*. These values will be loaded at every future kamaki execution.
109
two configuration options are created: *store.url* and *store.token*. These values will be loaded at every future kamaki execution.
115 110

  
116 111
Available options
117 112
^^^^^^^^^^^^^^^^^
118 113

  
119
The [global] group is treated by kamaki as a generic group for arbitrary options, and it is used as a super-group for vital Kamaki options, namely account, token, url, cli. This feature does not work for types of configuration options. For example if global.account option is set and store.account option is not set, store services will use the global.account option instead. In case of conflict, the most specific options override the global ones.
114
The [global] group is treated by kamaki as a generic group for arbitrary options, and it is used as a super-group for vital Kamaki options, namely token, url, cli. In case of conflict, the most specific options overrides the global ones.
120 115

  
121 116
* global.colors <on|off>
122 117
    enable / disable colors in command line based uis. Requires ansicolors, otherwise it is ignored
123 118

  
124
* global.account <account name>
125
    the username or user email that is user to connect to the cloud service. It can be omitted if provided as a service-specific option
126

  
127 119
* global.token <user authentication token>
128 120

  
129 121
* store.cli <UI command specifications for store>
......
132 124
* store.url <OOS storage or Pithos+ service url>
133 125
    the url of the OOS storage or Pithos+ service. Set to Okeanos.grnet.gr Pithos+ storage service by default. Users should set a different value if they need to use a different storage service.
134 126

  
135
* store.account <account name>
136
    if set, it overrides possible global.account option for store level commands.
137

  
138 127
* store.token <token>
139 128
    it set, it overrides possible global.token option for store level commands
140 129

  
b/docs/usage.rst
19 19

  
20 20
    $ kamaki set token myt0k3n==
21 21

  
22
To use the storage service, a user should also provide the corresponding user-name:
23

  
24
.. code-block:: console
25
    :emphasize-lines: 1
26

  
27
    Example 1.2: Set user name to user@domain.com
28

  
29
    $ kamaki set account store.user@domain.com
30

  
31 22
Shell vs one-command
32 23
--------------------
33 24
Kamaki users can access synnefo services through either the interactive shell or the one-command behaviors. In practice, both systems rely on the same command set implementations and API clients, with identical responses and error messages. Still, there are some differences.
b/kamaki/cli/commands/errors.py
438 438
                        cont = '%s or %s' % (self.container, dst_cont)\
439 439
                        if dst_cont else self.container
440 440
                        raiseCLIError(ce,
441
                            'Is container %s in account %s ?' % (
442
                                cont,
443
                                self.account),
441
                            'Is container %s in current account?' % (cont),
444 442
                            details=this.container_howto)
445 443
                raise
446 444
        return _raise
......
467 465
                if (ce.status == 404 or ce.status == 500)\
468 466
                and 'object' in err_msg and 'not' in err_msg:
469 467
                    raiseCLIError(ce,
470
                        'No object %s in %s\'s container %s'\
471
                        % (self.path, self.account, self.container),
468
                        'No object %s in container %s'\
469
                        % (self.path, self.container),
472 470
                        details=this.container_howto)
473 471
                raise
474 472
        return _raise
b/kamaki/cli/commands/pithos_cli.py
80 80
            '  to get the service url: /config get store.url',
81 81
            '  to set the service url: /config set store.url <url>',
82 82
            ' ',
83
            '  to get user account:     /config get store.account',
84
            '           or              /config get account',
85
            '  to set the user account: /config set store.account <account>',
86
            ' ',
87 83
            '  to get authentication token: /config get token',
88 84
            '  to set authentication token: /config set token <token>'
89 85
            ])
......
203 199

  
204 200
    def _set_account(self):
205 201
        astakos = AstakosClient(self.config.get('astakos', 'url'), self.token)
206
        self.account = astakos.term('uuid')
202
        self.account = self['account'] or astakos.term('uuid')
203

  
204
        """Backwards compatibility"""
205
        self.account = self.account\
206
            or self.config.get('store', 'account')\
207
            or self.config.get('global', 'account')
207 208

  
208 209

  
209 210
class _store_account_command(_pithos_init):
......
323 324
class store_list(_store_container_command):
324 325
    """List containers, object trees or objects in a directory
325 326
    Use with:
326
    1 no parameters : containers in set account
327
    1 no parameters : containers in current account
327 328
    2. one parameter (container) or --container : contents of container
328 329
    3. <container>:<prefix> or --container=<container> <prefix>: objects in
329 330
    .   container starting with prefix
b/kamaki/clients/astakos.py
76 76

  
77 77
    def term(self, key, token=None):
78 78
        """Get (cached) term, from user credentials"""
79
        return self.info(token)[key]
79
        return self.info(token).get(key, None)
b/kamaki/clients/tests/pithos.py
60 60

  
61 61
        """Prepare an object to be shared - also its container"""
62 62
        self.client.container = self.c1
63
        self.client.object_post('test',
63
        self.client.object_post(
64
            'test',
64 65
            update=True,
65 66
            permissions={'read': [self.client.account]})
66 67

  

Also available in: Unified diff