Revision 904091dd
b/docs/installation.rst | ||
---|---|---|
89 | 89 |
|
90 | 90 |
$ sudo apt-get install python-mock=1.0.1 |
91 | 91 |
|
92 |
.. hint:: To activate functional tests in kamaki. enable the preconfigured |
|
93 |
*livetest* command group: |
|
94 |
|
|
95 |
.. code-block:: console |
|
96 |
|
|
97 |
$ kamaki config set livetest_cli livetest |
|
98 |
|
|
99 |
|
|
100 |
Install astakosclient (optional) |
|
101 |
"""""""""""""""""""""""""""""""" |
|
102 |
|
|
103 |
A seperate project called |
|
104 |
`astakosclient <https://pypi.python.org/pypi/astakosclient>`_ can be used for |
|
105 |
advanced user and service management. |
|
106 |
|
|
107 |
.. code-block:: console |
|
108 |
|
|
109 |
$ apt-get install python-astakosclient |
|
110 |
|
|
111 |
.. hint:: To activate astakosclient commands in kamaki, enable the |
|
112 |
preconfigured *astakos* command group: |
|
113 |
|
|
114 |
.. code-block:: console |
|
115 |
|
|
116 |
$ kamaki config set astakos_cli astakos |
|
117 |
|
|
92 | 118 |
.. _installing-from-pypi-ref: |
93 | 119 |
|
94 | 120 |
Installing from pypi |
... | ... | |
127 | 153 |
|
128 | 154 |
$ pip install kamaki |
129 | 155 |
|
130 |
Install ansicolors (optional)
|
|
131 |
"""""""""""""""""""""""""""""
|
|
156 |
Install ansicolors |
|
157 |
"""""""""""""""""" |
|
132 | 158 |
|
133 | 159 |
The **ansicolors** package is not required for running kamaki, but it is |
134 | 160 |
recommended as a user experience improvement. In specific, ansicolors |
... | ... | |
153 | 179 |
|
154 | 180 |
.. warning:: mock version >= 1.X |
155 | 181 |
|
182 |
.. hint:: To activate functional tests in kamaki. enable the preconfigured |
|
183 |
*livetest* command group: |
|
184 |
|
|
185 |
.. code-block:: console |
|
186 |
|
|
187 |
$ kamaki config set livetest_cli livetest |
|
188 |
|
|
189 |
Install astakosclient |
|
190 |
""""""""""""""""""""" |
|
191 |
|
|
192 |
A seperate project called |
|
193 |
`astakosclient <https://pypi.python.org/pypi/astakosclient>`_ can be used for |
|
194 |
advanced user and service management. |
|
195 |
|
|
196 |
.. code-block:: console |
|
197 |
|
|
198 |
$ pip install astakosclient |
|
199 |
|
|
200 |
.. hint:: To activate astakosclient commands in kamaki, enable the |
|
201 |
preconfigured *astakos* command group: |
|
202 |
|
|
203 |
.. code-block:: console |
|
204 |
|
|
205 |
$ kamaki config set astakos_cli astakos |
|
206 |
|
|
156 | 207 |
Mac OS X |
157 | 208 |
-------- |
158 | 209 |
|
b/docs/setup.rst | ||
---|---|---|
11 | 11 |
Existing kamaki users should consult the |
12 | 12 |
`migration guide <#migrating-from-kamaki-0-8-x-to-0-9>`_ first. |
13 | 13 |
|
14 |
Kamaki has to be configured to use a specific Synnefo deployment. |
|
15 |
|
|
16 |
Since Synnefo version 0.14, each deployment offers a single authentication |
|
17 |
url, which has to be set as the default url for kamaki (Example 1.1). |
|
14 |
Kamaki has to be configured to use a specific Synnefo deployment url and a user |
|
15 |
token. |
|
18 | 16 |
|
19 | 17 |
.. code-block:: console |
20 |
:emphasize-lines: 1, 2 |
|
21 |
|
|
22 |
Example 1.1: Set https://astakos.example.com/astakos/identity/v2.0/ as the |
|
23 |
default single authentication url |
|
24 | 18 |
|
25 |
$ kamaki config set remote.default.url https://astakos.example.com/astakos/identity/v2.0/ |
|
26 |
|
|
27 |
Kamaki also needs a user authentication token (Example 1.2). |
|
28 |
|
|
29 |
.. code-block:: console |
|
30 |
:emphasize-lines: 1 |
|
31 |
|
|
32 |
Example 1.2: Set user token to myt0k3n== |
|
33 |
|
|
19 |
$ kamaki config set remote.default.url <cloud-authentication-URL> |
|
34 | 20 |
$ kamaki config set remote.default.token myt0k3n== |
35 | 21 |
|
22 |
Since Synnefo version 0.14, a synnefo cloud remote UI offers a single |
|
23 |
authentication URL, which can to be set as the default URL for kamaki. All |
|
24 |
service-specific URLs are now retrieved and handled automatically. Users of |
|
25 |
synnefo clouds >= 0.14 are advised against using any service-specific URLs. |
|
26 |
|
|
36 | 27 |
Migrating from kamaki 0.8.X to 0.9 |
37 | 28 |
---------------------------------- |
38 | 29 |
|
... | ... | |
46 | 37 |
Existing kamaki users should convert their configuration files to v3. To do |
47 | 38 |
that, kamaki 0.9 inspects the configuration file and suggests a list of config |
48 | 39 |
file transformations, which are performed automatically on user permission. |
49 |
This mechanism is invoked when the first API-releated kamaki command is fired.
|
|
50 |
We suggest the command of the example 2.1.
|
|
40 |
This mechanism is invoked when the first API-related kamaki command is fired. |
|
41 |
We suggest the `user authenticate` command, as shown on example 2.1.
|
|
51 | 42 |
|
52 | 43 |
.. code-block:: console |
53 | 44 |
:emphasize-lines: 1 |
54 | 45 |
|
55 |
Example 2.1: Try to authenticate user but convert config file instead
|
|
46 |
Example 2.1: Convert config file while authenticating user "exampleuser"
|
|
56 | 47 |
|
57 | 48 |
$ kamaki user authenticate |
58 | 49 |
Config file format version >= 3.0 is required |
... | ... | |
76 | 67 |
Overwrite file /home/exampleuser/.kamakirc ? [Y, y] |
77 | 68 |
|
78 | 69 |
At this point, we should examine the kamaki output. Most options are renamed to |
79 |
be accessible by the new kamaki.
|
|
70 |
be understood by the new kamaki.
|
|
80 | 71 |
|
81 | 72 |
Let's take a look at the discarded options: |
82 | 73 |
|
83 |
* global.account and user.account are not used anymore. The same is true for |
|
84 |
store.account and pithos.account which were ways to explicitly set a user |
|
85 |
account name to a pithos call. After the latest Synnefo evolutions, these |
|
86 |
features are meaningless and therefore omitted. |
|
74 |
* `global.account` and `user.account` are not used anymore. |
|
75 |
The same is true for the synonyms `store.account` and `pithos.account`. |
|
76 |
These options were used to explicitly set a user account or uuid to a |
|
77 |
pithos call. In the latest Synnefo version (>= 0.14), these features are |
|
78 |
meaningless and therefore omitted. |
|
87 | 79 |
|
88 |
* global.data_log option has never been a valid kamaki config option. In this |
|
89 |
example, the user accidentally mixed the terms "log_data" (which is a valid |
|
90 |
kamaki config option) with "data_log". To fix this, the user should set the |
|
91 |
correct option after the conversion is complete (Example 2.2) |
|
80 |
* `global.data_log` option has never been a valid kamaki config option. |
|
81 |
In this example, the user accidentally misspelled the terms `log_data` |
|
82 |
(which is a valid kamaki config option) as `data_log`. To fix this, the |
|
83 |
user should set the correct option after the conversion is complete |
|
84 |
(Example 2.2). |
|
92 | 85 |
|
93 | 86 |
Users should press *y* when they are ready. Kamaki has now modified the default |
94 | 87 |
config file to conform with kamaki config file v3. Now users should rescue |
... | ... | |
101 | 94 |
|
102 | 95 |
$ kamaki config set log_data on |
103 | 96 |
|
104 |
In order to convert more files, users may run kamaki with the -c option |
|
105 |
(Example 2.3) and apply the steps described above. |
|
97 |
In order to convert more files, users may run kamaki with the -c option, which |
|
98 |
runs kamaki with a different configuration file (Example 2.3) and apply the |
|
99 |
steps described above. |
|
106 | 100 |
|
107 | 101 |
.. code-block:: console |
108 | 102 |
:emphasize-lines: 1 |
... | ... | |
111 | 105 |
|
112 | 106 |
$ kamaki -c .myfilerc user authenticate |
113 | 107 |
|
108 |
Multiple cloud remotes |
|
109 |
---------------------- |
|
110 |
|
|
111 |
The following refers to users of multiple Synnefo and/or Open Stack |
|
112 |
deployments. In the following, a Synnefo or Open Stack cloud deployment will |
|
113 |
frequently be called as a **remote** or a **cloud remote**. |
|
114 |
|
|
115 |
Kamaki supports accessing multiple cloud remotes from the same kamaki setup. |
|
116 |
Bofore kamaki 0.9, this was possible only by using multiple config files. Since |
|
117 |
0.9, kamaki supports multiple cloud remotes in the same configuration. |
|
118 |
|
|
119 |
Each cloud remote corresponds to a Synnefo (or Open Stack) cloud deployment. |
|
120 |
Since Synnefo version 0.14, each deployment offers a single point of |
|
121 |
authentication, as an **authentication URL** and **token** pair. Users can |
|
122 |
retrieve this information through the cloud UI. |
|
123 |
|
|
124 |
Once a user has retrieved one URL/token pair per cloud remote, it is time to |
|
125 |
assign a name to each cloud and let kamaki know about them. |
|
126 |
|
|
127 |
For example, let the user have access to two remote clouds with the following authentication information :: |
|
128 |
|
|
129 |
cloud alias: devel |
|
130 |
authentication URL: https://devel.example.com/astakos/identity/v2.0/ |
|
131 |
authentication token: myd3v3170k3n== |
|
132 |
|
|
133 |
cloud alias: testing |
|
134 |
autentication URL: https://testing.example.com/astakos/identity/v2.0/ |
|
135 |
authentication token: my73571ng70k3n== |
|
136 |
|
|
137 |
.. note:: the cloud alias is arbitrary and decided by the user. It is just a |
|
138 |
name to call a cloud setup in the kamaki context. |
|
139 |
|
|
140 |
The user should let kamaki know about these setups: |
|
141 |
|
|
142 |
.. code-block:: console |
|
143 |
|
|
144 |
$ kamaki config set remote.devel.url https://devel.example.com/astakos/identity/v2.0/ |
|
145 |
$ kamaki config set remote.devel.token myd3v3170k3n== |
|
146 |
$ |
|
147 |
$ kamaki config set remote.testing.url https://testing.example.com/astakos/identity/v2.0/ |
|
148 |
$ kamaki config set remote.testing.token my73571ng70k3n== |
|
149 |
$ |
|
150 |
|
|
151 |
To check if all settings are loaded, a user may list all remotes, as shown |
|
152 |
bellow: |
|
153 |
|
|
154 |
.. code-block:: console |
|
155 |
|
|
156 |
$ kamaki config get remote |
|
157 |
remote.default.url = https://example.com/astakos.identity/v2.0/ |
|
158 |
remote.default.url = myd3f4u1770k3n== |
|
159 |
remote.devel.url = https://devel.example.com/astakos/identity/v2.0/ |
|
160 |
remote.devel.token = myd3v3170k3n== |
|
161 |
remote.testing.url = https://testing.example.com/astakos/identity/v2.0/ |
|
162 |
remote.testing.token = my73571ng70k3n== |
|
163 |
$ |
|
164 |
|
|
165 |
or query kamaki for a specific cloud remote: |
|
166 |
|
|
167 |
.. code-block:: console |
|
168 |
|
|
169 |
$ kamaki config get remote.devel |
|
170 |
remote.devel.url = https://devel.example.com/astakos/identity/v2.0/ |
|
171 |
remote.devel.token = myd3v3170k3n== |
|
172 |
$ |
|
173 |
|
|
174 |
Now kamaki can use any of there remotes, with the **- - cloud** attribute. If |
|
175 |
the **- - cloud** option is ommited, kamaki will query the `default` cloud remote. |
|
176 |
|
|
177 |
One way to test this, is the `user athenticate` command: |
|
178 |
|
|
179 |
.. code-block:: console |
|
180 |
|
|
181 |
$ kamaki --cloud=devel user authenticate |
|
182 |
... |
|
183 |
user : |
|
184 |
id : 725d5de4-1bab-45ac-9e98-38a60a8c543c |
|
185 |
name : Devel User |
|
186 |
$ |
|
187 |
$ kamaki --cloud=testing user authenticate |
|
188 |
... |
|
189 |
user : |
|
190 |
id : 4ed5d527-bab1-ca54-89e9-c345c8a06a83 |
|
191 |
name : Testing User |
|
192 |
$ |
|
193 |
$ kamaki --cloud=default user authenticate |
|
194 |
... |
|
195 |
user : |
|
196 |
id : 4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473 |
|
197 |
name : Default User |
|
198 |
$ |
|
199 |
$ kamaki user authenticate |
|
200 |
... |
|
201 |
user : |
|
202 |
id : 4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473 |
|
203 |
name : Default User |
|
204 |
$ |
|
205 |
|
|
206 |
In interactive cell, the cloud remote is picked when invoking the shell, with |
|
207 |
the **- - cloud** option. |
|
208 |
|
|
114 | 209 |
Optional features |
115 | 210 |
----------------- |
116 | 211 |
|
... | ... | |
127 | 222 |
* Allow unittests to run on kamaki.clients package |
128 | 223 |
* Needs mock version 1.X or better |
129 | 224 |
|
225 |
* astakosclient |
|
226 |
* For advanced users mostly |
|
227 |
* Allows the use of a full astakos command line client |
|
228 |
|
|
130 | 229 |
Any of the above features can be installed at any time before or after kamaki installation. |
131 | 230 |
|
132 | 231 |
Configuration options |
133 | 232 |
--------------------- |
134 | 233 |
|
135 |
Kamaki comes with preset default values to all configuration options. All vital configuration options are set to use the okeanos.grnet.gr cloud services. User information is not included and should be provided either through the kamaki config command or by editing the configuration file.
|
|
234 |
There are two kinds of configuration options:
|
|
136 | 235 |
|
137 |
Kamaki configuration options are vital for correct Kamaki behavior. An incorrect option may render some command groups dysfunctional. There are two ways of managing configuration options: edit the config file or use the kamaki config command. |
|
236 |
* kamaki-related (global) |
|
237 |
interface settings and constants of the kamaki internal mechanism, e.g. |
|
238 |
colors in the output, maximum threads per connection, custom logging or |
|
239 |
history files, etc. |
|
138 | 240 |
|
139 |
Using multiple setups |
|
140 |
^^^^^^^^^^^^^^^^^^^^^ |
|
241 |
* cloud-related (remote.XXX) |
|
242 |
information needed to connect and use one or more remote clouds. There are |
|
243 |
some mandatory options (url, token) and some advanced / optional (e.g. |
|
244 |
service-specific url overrides or versions) |
|
141 | 245 |
|
142 |
Kamaki setups are stored in configuration files. By default, a Kamaki installation stores options in *.kamakirc* file located at the user home directory. |
|
246 |
Kamaki comes with preset default values to all kamaki-releated configuration |
|
247 |
options. Cloud-related information is not included in presets and should be |
|
248 |
provided. Kamaki-related options can also be modified. |
|
143 | 249 |
|
144 |
If a user needs to switch between different setups, Kamaki can explicitly load configuration files with the --config option: |
|
250 |
There are two ways of managing configuration options: edit the config file or |
|
251 |
use the kamaki config command. |
|
252 |
|
|
253 |
Using multiple configuration files |
|
254 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
255 |
|
|
256 |
Kamaki setups are stored in configuration files. By default, a Kamaki |
|
257 |
installation stores options in *.kamakirc* file located at the user home |
|
258 |
directory. |
|
259 |
|
|
260 |
|
|
261 |
If a user needs to switch between different kamaki-related setups, Kamaki can |
|
262 |
explicitly load configuration files with the **- - config** (or **- c**) |
|
263 |
option: |
|
145 | 264 |
|
146 | 265 |
.. code-block:: console |
147 | 266 |
|
148 | 267 |
$ kamaki --config <custom_config_file_path> [other options] |
149 | 268 |
|
150 |
Using many different configuration files for different cloud services is encouraged. |
|
269 |
.. note:: For access to multiple cloud remotes, users do NOT need to create |
|
270 |
multiple configuration files. Instead, we suggest using a single |
|
271 |
configuration file with multiple remote setups. More details can be found |
|
272 |
at the `multiple remotes guide <#multiple-cloud-remotes>`_. |
|
151 | 273 |
|
152 | 274 |
Modifying options at runtime |
153 | 275 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
... | ... | |
156 | 278 |
|
157 | 279 |
.. code-block:: console |
158 | 280 |
|
159 |
$ kamaki file list -o global.account=anotheraccount -o global.token=aT0k3n== |
|
160 |
|
|
161 |
will invoke *kamaki file list* with the specified options, but the initial global.account and global.token values will be restored to initial values afterwards. |
|
281 |
$ kamaki file list -o global.pithos_container=anothercontainer |
|
162 | 282 |
|
163 |
.. note:: on-the-fly calls to file 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:: |
|
164 |
|
|
165 |
$kamaki user authenticate aT0k3n== |
|
283 |
will invoke *kamaki file list* with the specified options, but the initial |
|
284 |
global.pithos_container values will not be modified. |
|
166 | 285 |
|
167 | 286 |
Editing options |
168 | 287 |
^^^^^^^^^^^^^^^ |
... | ... | |
173 | 292 |
lists all configuration options currently used by a Kamaki installation |
174 | 293 |
|
175 | 294 |
* kamaki config get <group.option> |
176 |
show the value of a specific configuration option. Options must be of the form group.option |
|
295 |
show the value of a specific configuration option. Options must be of the |
|
296 |
form *group.option*. The term *option* is equivalent to *global.option* |
|
177 | 297 |
|
178 | 298 |
* kamaki config set <group.option> <value> |
179 |
set the group.option to value |
|
299 |
set the group.option to value. If no group is given, the defaults to |
|
300 |
*global* |
|
180 | 301 |
|
181 | 302 |
* kamaki config delete <group.option> |
182 |
delete a configuration option |
|
303 |
delete a configuration option. If no group is given, the defaults to |
|
304 |
*global* |
|
183 | 305 |
|
184 | 306 |
The above commands cause option values to be permanently stored in the Kamaki configuration file. |
185 | 307 |
|
308 |
The commands above can also be used for **cloud remotes** handling, using the |
|
309 |
`remote.` prefix. The remote handling cases are similar but with slightly |
|
310 |
different semantics: |
|
311 |
|
|
312 |
* kamaki config get remote[.<cloud alias>[.option]] |
|
313 |
* remote |
|
314 |
list all cloud remotes (including `default`) and their settings |
|
315 |
* remote.<cloud alias> |
|
316 |
list settings of the cloud remote aliased as <cloud alias>. If no |
|
317 |
special is configured, use the term `remote.default` |
|
318 |
* remote.<cloud alias>.<option> |
|
319 |
show the value of the specified option. If no special alias is |
|
320 |
configured, use `remote.default.<option>` |
|
321 |
|
|
322 |
* kamaki config set remote.<cloud alias>.<option> <value> |
|
323 |
If the remote alias <cloud alias> does not exist, create it. Then, create |
|
324 |
(or update) the option <option> of this cloud remote, by setting its value |
|
325 |
to <value>. |
|
326 |
|
|
327 |
* kamaki config delete remote.<cloud alias>[.<option>] |
|
328 |
* remote.<cloud alias> |
|
329 |
delete the cloud alias <cloud alias> and all its options |
|
330 |
* remote.<cloud alias>.<option> |
|
331 |
delete the <option> and its value from the cloud remote aliased as |
|
332 |
<cloud alias> |
|
333 |
|
|
186 | 334 |
Editing the configuration file |
187 | 335 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
188 | 336 |
|
189 | 337 |
The configuration file is a simple text file that can be created by the user. |
190 | 338 |
|
191 |
A simple way to create the configuration file is to set a configuration option using the kamaki config command. For example: |
|
339 |
.. note:: users of kamaki < 0.9 can use kamaki 0.9.X to automatically convert |
|
340 |
their old configuration files to the new config file version (>= 3.0). To |
|
341 |
do this, follow `these instructions <#migrating-from-kamaki-0-8-x-to-0-9>`_ |
|
342 |
|
|
343 |
A simple way to create the configuration file is to set a configuration option |
|
344 |
using the kamaki config command. For example: |
|
192 | 345 |
|
193 | 346 |
.. code-block:: console |
194 | 347 |
|
195 |
$ kamaki config set token myT0k3N==
|
|
348 |
$ kamaki config set global.log_file /home/exampleuser/logs/kamaki.log
|
|
196 | 349 |
|
197 |
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. |
|
350 |
In the above example, if the kamaki configuration file does not exist, it will |
|
351 |
be created with all the default values plus the *global.log_file* option set to |
|
352 |
`/home/exampleuser/logs/kamaki.log` |
|
198 | 353 |
|
199 | 354 |
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:: |
200 | 355 |
|
201 |
[file] |
|
202 |
url=https://okeanos.grnet.gr/pithos |
|
203 |
token=my0th3rT0k3n== |
|
356 |
[global] |
|
357 |
log_file = /home/exampleuser/logs/kamaki.log |
|
358 |
max_threads = 7 |
|
359 |
colors = off |
|
360 |
|
|
361 |
[remote "default"] |
|
362 |
url = |
|
363 |
token = |
|
364 |
|
|
365 |
A bunch of configuration options are created and set to their default options, |
|
366 |
except the log_file option which is set to whatever the specified value. |
|
204 | 367 |
|
205 |
two configuration options are created: *file.url* and *file.token*. These values will be loaded at every future kamaki execution. |
|
368 |
The [remote "default"] section is special and is used to configure the default |
|
369 |
cloud remote. Kamaki will not be able to run without setting the url and token |
|
370 |
values to that section. |
|
371 |
|
|
372 |
More cloud remotes can be created on the side of the default remote, e.g |
|
373 |
using the examples at the `multiple remotes guide <#multiple-cloud-remotes>`_:: |
|
374 |
|
|
375 |
[remote "devel"] |
|
376 |
url = https://devel.example.com/astakos/identity/v2.0/ |
|
377 |
token = myd3v3170k3n== |
|
378 |
|
|
379 |
[remote "testing"] |
|
380 |
url = https://testing.example.com/astakos/identity/v2.0/ |
|
381 |
token = my73571ng70k3n== |
|
206 | 382 |
|
207 | 383 |
Available options |
208 | 384 |
^^^^^^^^^^^^^^^^^ |
209 | 385 |
|
210 |
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. |
|
386 |
The [global] group is treated by kamaki as a generic group for kamaki-related |
|
387 |
settings, namely command cli specifications, the thread limit, console colors, |
|
388 |
history and log files, log detail options and pithos-specific options. |
|
211 | 389 |
|
212 | 390 |
* global.colors <on|off> |
213 | 391 |
enable / disable colors in command line based uis. Requires ansicolors, otherwise it is ignored |
214 | 392 |
|
215 |
* global.token <user authentication token> |
|
216 |
|
|
217 | 393 |
* global.log_file <logfile full path> |
218 | 394 |
set a custom location for kamaki logging. Default value is ~/.kamaki.log |
219 | 395 |
|
... | ... | |
221 | 397 |
allow kamaki to log user tokens |
222 | 398 |
|
223 | 399 |
* global.log_data <on|off> |
224 |
allow kamaki to log http data (by default, it logs only method, URL and headers) |
|
225 |
|
|
226 |
* file.cli <UI command specifications for file> |
|
227 |
a special package that is used to load storage commands to kamaki UIs. Don't touch this unless if you know what you are doing. |
|
400 |
allow kamaki to log http data (by default, it logs only method, URL and |
|
401 |
headers) |
|
228 | 402 |
|
229 |
* file.url <OOS storage or Pithos+ service url> |
|
230 |
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. |
|
403 |
* global.file_cli <UI command specifications for file> |
|
404 |
a special package that is used to load storage commands to kamaki UIs. |
|
405 |
Don't touch this unless if you know what you are doing. |
|
231 | 406 |
|
232 |
* file.token <token> |
|
233 |
it set, it overrides possible global.token option for file level commands |
|
407 |
* global.cyclades_cli <UI command specifications for cyclades> |
|
408 |
a special package that is used to load cyclades commands to kamaki UIs. |
|
409 |
Don't touch this unless you know what you are doing. |
|
234 | 410 |
|
235 |
* compute.url <OOS compute or Cyclades service url> |
|
236 |
the url of the OOS compute or Cyclades service. Set to Okeanos.grnet.gr Cyclades IaaS service by default. Users should set a different value if they need to use a different IaaS service. |
|
411 |
* global.flavor_cli <UI command specifications for VM flavors> |
|
412 |
a special package that is used to load cyclades VM flavor commands to |
|
413 |
kamaki UIs. Don't touch this unless you know what you are doing. |
|
237 | 414 |
|
238 |
* cyclades.cli <UI command specifications for cyclades> |
|
239 |
a special package that is used to load cyclades commands to kamaki UIs. Don't touch this unless you know what you are doing. |
|
415 |
* global.network_cli <UI command specifications for virtual networks> |
|
416 |
a special package that is used to load cyclades virtual network commands to |
|
417 |
kamaki UIs. Don't touch this unless you know what you are doing. |
|
240 | 418 |
|
241 |
* flavor.cli <UI command specifications for VM flavors> |
|
242 |
a special package that is used to load cyclades VM flavor commands to kamaki UIs. Don't touch this unless you know what you are doing. |
|
243 |
|
|
244 |
* network.cli <UI command specifications for virtual networks> |
|
245 |
a special package that is used to load cyclades virtual network commands to kamaki UIs. Don't touch this unless you know what you are doing. |
|
246 |
|
|
247 |
* image.url <Plankton image service url> |
|
248 |
the url of the Plankton service. Set to Okeanos.grnet.gr Plankton service by default. Users should set a different value if they need to use a different service. Note that the *image compute* commands are depended on the compute.url instead. |
|
249 |
|
|
250 |
* image.cli <UI command specifications for Plankton (and Compute) image service> |
|
419 |
* global.image_cli <UI command specs for Plankton or Compute image service> |
|
251 | 420 |
a special package that is used to load image-related commands to kamaki UIs. Don't touch this unless you know what you are doing. |
252 | 421 |
|
253 |
* user.url <Astakos authentication service url> |
|
254 |
the url of the Astakos authentication service. Set to the Okeanos.grnet.gr Astakos service by default. Users should set a different value if they need to use a different service. |
|
255 |
|
|
256 |
* user.cli <UI command specifications for Astakos authentication service> |
|
257 |
a special package that is used to load astakos-related commands to kamaki UIs. Don't touch this unless you know what you are doing. |
|
422 |
* global.user_cli <UI command specs for Astakos authentication service> |
|
423 |
a special package that is used to load astakos-related commands to kamaki |
|
424 |
UIs. Don't touch this unless you know what you are doing. |
|
258 | 425 |
|
259 |
* history.file <history file path> |
|
260 |
the path of a simple file for inter-session kamaki history. Make sure kamaki is executed in a context where this file is accessible for reading and writing. Kamaki automatically creates the file if it doesn't exist |
|
426 |
* global.history_file <history file path> |
|
427 |
the path of a simple file for inter-session kamaki history. Make sure |
|
428 |
kamaki is executed in a context where this file is accessible for reading |
|
429 |
and writing. Kamaki automatically creates the file if it doesn't exist |
|
261 | 430 |
|
262 | 431 |
Additional features |
263 | 432 |
^^^^^^^^^^^^^^^^^^^ |
264 | 433 |
|
265 |
Log file location |
|
266 |
""""""""""""""""" |
|
267 |
|
|
268 |
Kamaki log file path is set by the following command:: |
|
269 |
|
|
270 |
$ kamaki config set log_file <logfile path> |
|
271 |
|
|
272 |
By default, kamaki logs at ~/.kamaki.log |
|
273 |
|
|
274 |
When initialized, kamaki attempts to open one of these locations for writing, in the order presented above and uses the first accessible for appending logs. If the log_file option is set, kamaki prepends the value of this option to the logfile list, so the custom location will be the first one kamaki will attetmpt to log at. |
|
275 |
|
|
276 |
Kamaki will not crush if the logging location is not accessible. |
|
277 |
|
|
278 |
Richer connection logs |
|
279 |
"""""""""""""""""""""" |
|
280 |
|
|
281 |
Kamaki logs down the http requests and responses in /var/log/kamaki/clients.log (make sure it is accessible). The request and response data and user authentication information is excluded from the logs be default. The former may render the logs unreadable and the later are sensitive information. Users my activate data and / or token logging my setting the global options log_data and log_token respectively:: |
|
282 |
|
|
283 |
$ kamaki config set log_data on |
|
284 |
$ kamaki config set log_token on |
|
285 |
|
|
286 |
Either or both of these options may be switched off either by setting them to ``off`` or by deleting them. |
|
287 |
|
|
288 |
$ kamaki config set log_data off |
|
289 |
$ kamaki config delete log_token |
|
290 |
|
|
291 |
Set custom thread limit |
|
292 |
""""""""""""""""""""""" |
|
293 |
|
|
294 |
Some operations (e.g. download and upload) may use threaded http connections for better performance. Kamaki.clients utilizes a sophisticated mechanism for dynamically adjusting the number of simultaneous threads running, but users may wish to enforce their own upper thread limit. In that case, the max_threads option may be set to the configuration file:: |
|
295 |
|
|
296 |
$ kamaki config set max_threads 3 |
|
297 |
|
|
298 |
If the value is not a positive integer, kamaki will ignore it and a warning message will be logged. |
|
299 |
|
|
300 | 434 |
The livetest suite |
301 | 435 |
"""""""""""""""""" |
302 | 436 |
|
303 |
Kamaki contains a live test suite for the kamaki.clients API, where "live" means that the tests are performed against active services that up and running. The live test package is named "livetest", it is accessible as kamaki.clients.livetest and it is designed to check the actual relation between kamaki and synnefo services. |
|
437 |
Kamaki contains a live test suite for the kamaki.clients API, where "live" |
|
438 |
means that the tests are performed against active services that up and running. |
|
439 |
The live test package is named "livetest", it is accessible as kamaki.clients. |
|
440 |
livetest and it is designed to check the actual relation between kamaki and |
|
441 |
synnefo services. |
|
304 | 442 |
|
305 | 443 |
The livetest suite can be activated with the following option on the configuration file:: |
306 | 444 |
|
307 |
[livetest] |
|
308 |
cli=livetest |
|
445 |
[global] |
|
446 |
livetest_cli=livetest |
|
447 |
|
|
448 |
or with this kamaki command:: |
|
309 | 449 |
|
310 |
In most tests, livetest will run as long as an Astakos identity manager service is accessible and kamaki is set up to authenticate a valid token on this server.
|
|
450 |
kamaki config set livetest_cli livetest
|
|
311 | 451 |
|
312 |
In specific, a setup file needs at least the following mandatory settings in the configuration file: |
|
452 |
In most tests, livetest will run as long as the default remote is configured |
|
453 |
correctly. Some commands, though, need some extra settings related to the cloud |
|
454 |
the test is performed against, or the example files used in kamaki. |
|
313 | 455 |
|
314 |
* If authentication information is used for default kamaki clients::
|
|
456 |
Here is a list of settings needed:
|
|
315 | 457 |
|
316 |
[user] |
|
317 |
url=<Astakos Identity Manager URL> |
|
318 |
token=<A valid user token> |
|
458 |
* for all tests:: |
|
459 |
* livetest.testremote = <the cloud alias this test will run against> |
|
319 | 460 |
|
320 |
* else if this authentication information is only for testing add this under [livetest]:: |
|
461 |
* for astakos client:: |
|
462 |
* livetest.astakos_details = <A file with an authentication output> |
|
463 |
To create this file, pipeline the output of an authentication command |
|
464 |
with the -j option for raw jason output |
|
321 | 465 |
|
322 |
user_url=<Astakos Identity Manager URL> |
|
323 |
user_token=<A valid user token> |
|
466 |
.. code-block:: console |
|
324 | 467 |
|
325 |
Each service tested in livetest might need some more options under the [livetest] label, as shown bellow:
|
|
468 |
$ kamaki user authenticate -j > astakos.details
|
|
326 | 469 |
|
327 |
* kamaki livetest astakos:: |
|
470 |
* livetest.astakos_name = <The exact "real" name of testing user> |
|
471 |
* livetest.astakos_id = <The valid unique user id of the testing user> |
|
328 | 472 |
|
329 |
astakos_email = <The valid email of testing user>
|
|
330 |
astakos_name = <The exact "real" name of testing user>
|
|
331 |
astakos_username = <The username of the testing user>
|
|
332 |
astakos_uuid = <The valid unique user id of the testing user>
|
|
473 |
* for image client:
|
|
474 |
* livetest.image_details = <A file with the image's metadata>
|
|
475 |
To create this file, pipeline the output of an image metadata command
|
|
476 |
with the -j option for raw jason output
|
|
333 | 477 |
|
334 |
* kamaki livetest pithos::
|
|
478 |
.. code-block:: console
|
|
335 | 479 |
|
336 |
astakos_uuid = <The valid unique user id of the testing user>
|
|
480 |
$ kamaki image meta <img id> -j > img.details
|
|
337 | 481 |
|
338 |
* kamaki livetest cyclades / image:: |
|
482 |
* livetest.image_id = <A valid image id used for testing> |
|
483 |
* livetest.image_local_path = <The local path of the testing image> |
|
339 | 484 |
|
340 |
image_id = <A valid image id used for testing> |
|
341 |
image_local_path = <The local path of the testing image> |
|
342 |
image_details = <A text file containing testing image details in a python dict> |
|
485 |
* for flavors (part of the compute client): |
|
486 |
* livetest.flavor_details = <A file with the flavor details> |
|
487 |
To create this file, pipeline the output of a flavor info command |
|
488 |
with the -j option for raw jason output |
|
343 | 489 |
|
344 |
- example image.details content: |
|
345 |
{ |
|
346 |
u'id': u'b3e68235-3abd-4d60-adfe-1379a4f8d3fe', |
|
347 |
u'metadata': { |
|
348 |
u'values': { |
|
349 |
u'description': u'Debian 6.0.6 (Squeeze) Base System', |
|
350 |
u'gui': u'No GUI', |
|
351 |
u'kernel': u'2.6.32', |
|
352 |
u'os': u'debian', |
|
353 |
u'osfamily': u'linux', |
|
354 |
u'root_partition': u'1', |
|
355 |
u'sortorder': u'1', |
|
356 |
u'users': u'root' |
|
357 |
} |
|
358 |
}, |
|
359 |
u'name': u'Debian Base', |
|
360 |
u'progress': u'100', |
|
361 |
u'status': u'ACTIVE', |
|
362 |
u'created': u'2012-11-19T14:54:57+00:00', |
|
363 |
u'updated': u'2012-11-19T15:29:51+00:00' |
|
364 |
} |
|
490 |
.. code-block:: console |
|
365 | 491 |
|
366 |
flavor_details = <A text file containing the testing images' flavor details in a python dict>
|
|
492 |
$ kamaki flavor info <flavor id> -j > flavor.details
|
|
367 | 493 |
|
368 |
- example flavor.details content: |
|
369 |
{ |
|
370 |
u'name': u'C1R1drbd', |
|
371 |
u'ram': 1024, |
|
372 |
u'id': 1, |
|
373 |
u'SNF:disk_template': u'drbd', |
|
374 |
u'disk': 20, |
|
375 |
u'cpu': 1 |
|
376 |
} |
|
377 | 494 |
|
378 | 495 |
After setup, kamaki can run all tests:: |
379 | 496 |
|
... | ... | |
390 | 507 |
The unit testing system |
391 | 508 |
""""""""""""""""""""""" |
392 | 509 |
|
393 |
Kamaki container a set of finegrained unit tests for the kamaki.clients package. This set is not used when kamaki is running. Instead, it is aimed to developers who debug or extent the kamaki clients library. For more information, check the `Going Agile <developers/extending-clients-api.html#going-agile>`_ entry at the `developers section <developers/extending-clients-api.html>`_. |
|
510 |
Kamaki container a set of finegrained unit tests for the kamaki.clients |
|
511 |
package. This set is not used when kamaki is running. Instead, it is aimed to |
|
512 |
developers who debug or extent the kamaki clients library. For more |
|
513 |
information, check the |
|
514 |
`Going Agile <developers/extending-clients-api.html#going-agile>`_ entry at the |
|
515 |
`developers section <developers/extending-clients-api.html>`_. |
b/docs/usage.rst | ||
---|---|---|
1 | 1 |
Usage |
2 | 2 |
===== |
3 | 3 |
|
4 |
Kamaki offers command line interfaces that implement specific command specifications. A detailed list of the command specifications can be found in `Commands <commands.html>`_ section. This guide covers the generic usage of both interfaces. |
|
4 |
Kamaki offers command line interfaces that implement specific command |
|
5 |
specifications. A detailed list of the command specifications can be found in |
|
6 |
`Commands <commands.html>`_ section. This guide covers the generic usage of |
|
7 |
both interfaces. |
|
5 | 8 |
|
6 |
What's more, kamaki offers a clients API that allows the development of external applications for synnefo. The clients API is listed in the `Clients lib <developers/code.html#the-clients-api>`_ section. |
|
9 |
What's more, kamaki offers a clients API that allows the development of |
|
10 |
external applications for synnefo. The clients API is listed in the |
|
11 |
`Clients lib <developers/code.html#the-clients-api>`_ section. |
|
7 | 12 |
|
8 | 13 |
Quick Setup |
9 | 14 |
----------- |
10 | 15 |
|
11 |
Kamaki interfaces rely on a list of configuration options. In the initial state, kamaki is configured to communicate with the Okeanos IaaS. A detailed guide for setting up kamaki can be found in the `Setup <setup.html>`_ section. |
|
16 |
Kamaki interfaces rely on a list of configuration options. A detailed guide for |
|
17 |
setting up kamaki can be found in the `Setup <setup.html>`_ section. |
|
12 | 18 |
|
13 |
It is essential for users to get a valid configuration token that works with for a synnefo-compliant Identity Manager service (okeanos.grnet.gr users go `here <https://accounts.okeanos.grnet.gr/im/>`_) and provide it to kamaki: |
|
19 |
As rule of the thump, it is enough to set the authentication URL and user token |
|
20 |
for the cloud kamaki should communicate with by default: |
|
14 | 21 |
|
15 | 22 |
.. code-block:: console |
16 | 23 |
:emphasize-lines: 1 |
17 | 24 |
|
18 |
Example 1.1: Set user token to myt0k3n==
|
|
25 |
Example 1.1: Set default authentication user and token
|
|
19 | 26 |
|
20 |
$ kamaki config set token myt0k3n== |
|
27 |
$ kamaki config set remote.default.url <authentication URL> |
|
28 |
$ kamaki config set remote.default.token myt0k3n== |
|
21 | 29 |
|
22 | 30 |
Shell vs one-command |
23 | 31 |
-------------------- |
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. |
|
32 |
Kamaki users can access synnefo services through either the interactive shell |
|
33 |
or the one-command behaviors. In practice, both systems rely on the same |
|
34 |
command set implementations and API clients, with identical responses and error |
|
35 |
messages. Still, there are some differences. |
|
25 | 36 |
|
26 | 37 |
In favor of interactive shell behavior: |
27 | 38 |
|
28 |
* tab completion for commands (mostly on (X)nix OSs)
|
|
29 |
* session history with "up" / "down" keys
|
|
39 |
* tab completion for commands (if supported by host OS)
|
|
40 |
* session history with ↑ or ↓ keys
|
|
30 | 41 |
* shorter commands with command context switching |
31 | 42 |
* re-run old commands with /history |
32 | 43 |
|
... | ... | |
87 | 98 |
Using help |
88 | 99 |
^^^^^^^^^^ |
89 | 100 |
|
90 |
Kamaki help is used to list available commands with description, syntax and corresponding optional arguments. |
|
101 |
Kamaki help is used to list available commands with description, syntax and |
|
102 |
corresponding optional arguments. |
|
91 | 103 |
|
92 |
To see the command groups, use -h or --help like in example 1.3.1. In the same way, help information for command groups and commands is printed. In the following examples, the help messages of kamaki, of a command group (server) and of a command in that group (list) are shown. |
|
104 |
To see the command groups, use -h or --help like in example 1.3.1. In the same |
|
105 |
way, help information for command groups and commands is printed. In the |
|
106 |
following examples, the help messages of kamaki, of a command group (server) |
|
107 |
and of a command in that group (list) are shown. |
|
93 | 108 |
|
94 | 109 |
.. code-block:: console |
95 | 110 |
:emphasize-lines: 1 |
... | ... | |
99 | 114 |
|
100 | 115 |
$ kamaki -h |
101 | 116 |
usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd> |
102 |
[-s] [-V] [-i] [--config CONFIG] [-o OPTIONS] [-h]
|
|
117 |
[-v] [-s] [-V] [-d] [-i] [-c CONFIG] [-o OPTIONS] [--cloud CLOUD] [-h]
|
|
103 | 118 |
|
104 | 119 |
optional arguments: |
105 | 120 |
-v, --verbose More info at response |
... | ... | |
107 | 122 |
-V, --version Print current version |
108 | 123 |
-d, --debug Include debug output |
109 | 124 |
-i, --include Include protocol headers in the output |
110 |
--config CONFIG Path to configuration file |
|
125 |
-c CONFIG, --config CONFIG |
|
126 |
Path to configuration file |
|
111 | 127 |
-o OPTIONS, --options OPTIONS |
112 | 128 |
Override a config value |
129 |
--cloud CLOUD Chose a remote cloud to connect to |
|
113 | 130 |
-h, --help Show help message |
114 | 131 |
|
115 | 132 |
Options: |
116 | 133 |
- - - - |
117 |
user: Astakos API commands |
|
118 |
config: Configuration commands |
|
119 |
flavor: Compute/Cyclades API flavor commands |
|
120 |
history: Command history |
|
121 |
image: Plankton (and Compute) Image API commands |
|
122 |
network: Compute/Cyclades API network commands |
|
123 |
server: Compute/Cyclades API server commands |
|
124 |
file: Pithos+ storage commands |
|
134 |
config : Kamaki configurations |
|
135 |
file : Pithos+/Storage API commands |
|
136 |
flavor : Cyclades/Compute API flavor commands |
|
137 |
history : Kamaki command history |
|
138 |
image : Cyclades/Plankton API image commands |
|
139 |
image compute: Cyclades/Compute API image commands |
|
140 |
network : Cyclades/Compute API network commands |
|
141 |
server : Cyclades/Compute API server commands |
|
142 |
user : Astakos API commands |
|
125 | 143 |
|
126 | 144 |
.. code-block:: console |
127 |
:emphasize-lines: 1 |
|
128 |
|
|
129 |
Example 3.1.2: Cyclades help contains all first-level commands of Cyclades command group |
|
145 |
:emphasize-lines: 1,2 |
|
130 | 146 |
|
147 |
Example 3.1.2: Cyclades help contains all first-level commands of Cyclades |
|
148 |
command group |
|
131 | 149 |
|
132 | 150 |
$ kamaki server -h |
133 |
usage: kamaki server <...> [-v] [-s] [-V] [-d] [-i] [--config CONFIG]
|
|
134 |
[-o OPTIONS] [-h] |
|
151 |
usage: kamaki server <...> [-v] [-s] [-V] [-d] [-i] [-c CONFIG]
|
|
152 |
[-o OPTIONS] [--cloud CLOUD] [-h]
|
|
135 | 153 |
|
136 | 154 |
optional arguments: |
137 | 155 |
-v, --verbose More info at response |
... | ... | |
139 | 157 |
-V, --version Print current version |
140 | 158 |
-d, --debug Include debug output |
141 | 159 |
-i, --include Include protocol headers in the output |
142 |
--config CONFIG Path to configuration file |
|
160 |
-c CONFIG, --config CONFIG |
|
161 |
Path to configuration file |
|
143 | 162 |
-o OPTIONS, --options OPTIONS |
144 | 163 |
Override a config value |
164 |
--cloud CLOUD Chose a remote cloud to connect to |
|
145 | 165 |
-h, --help Show help message |
146 | 166 |
|
147 | 167 |
Options: |
148 | 168 |
- - - - |
149 |
addr : List a server's nic address |
|
150 |
console : Get a VNC console |
|
151 |
create : Create a server |
|
152 |
delete : Delete a server |
|
153 |
firewall: Manage the server's firewall profile |
|
154 |
set: Set the server's firewall profile |
|
155 |
get: Get the server's firewall profile |
|
156 |
info : Get server details |
|
157 |
list : List servers |
|
158 |
metadata: Manage server metadata |
|
159 |
list : Get a server metadata |
|
160 |
set : Add or update server metadata |
|
161 |
delete: Delete a piece of server metadata |
|
162 |
reboot : Reboot a server |
|
163 |
rename : Update a server's name |
|
164 |
shutdown: Shutdown a server |
|
165 |
start : Start a server |
|
166 |
stats : Get server statistics |
|
169 |
addr : List the addresses of all network interfaces on a server (VM) |
|
170 |
console : Get a VNC console to access an existing server (VM) |
|
171 |
create : Create a server (aka Virtual Machine) |
|
172 |
delete : Delete a server (VM) |
|
173 |
firewall: Manage server (VM) firewall profiles for public networks |
|
174 |
info : Detailed information on a Virtual Machine |
|
175 |
list : List Virtual Machines accessible by user |
|
176 |
metadata: Manage Server metadata (key:value pairs of server attributes) |
|
177 |
reboot : Reboot a server (VM) |
|
178 |
rename : Set/update a server (VM) name |
|
179 |
shutdown: Shutdown an active server (VM) |
|
180 |
start : Start an existing server (VM) |
|
181 |
stats : Get server (VM) statistics |
|
167 | 182 |
wait : Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE] |
168 | 183 |
|
169 | 184 |
.. code-block:: console |
170 |
:emphasize-lines: 1 |
|
171 |
|
|
172 |
Example 3.1.3: Help for command "server list" with syntax, description and available user options |
|
185 |
:emphasize-lines: 1,2 |
|
173 | 186 |
|
187 |
Example 3.1.3: Help for command "server list" with syntax, description and |
|
188 |
available user options |
|
174 | 189 |
|
175 | 190 |
$ kamaki server list -h |
176 |
usage: kamaki server list [-V] [-i] [--config CONFIG] [-h] [-l] |
|
191 |
usage: kamaki server list [-v] [-s] [-V] [-d] [-i] [-c CONFIG] [-o OPTIONS] |
|
192 |
[--cloud CLOUD] [-h] [--since SINCE] [--enumerate] |
|
193 |
[-l] [--more] [-n LIMIT] [-j] |
|
177 | 194 |
|
178 |
List servers |
|
195 |
List Virtual Machines accessible by user |
|
196 |
User Authentication: |
|
197 |
* to check authentication: /user authenticate |
|
198 |
* to set authentication token: /config set remote.default.token <token> |
|
179 | 199 |
|
180 | 200 |
optional arguments: |
181 |
-v, --verbose More info at response |
|
182 |
-s, --silent Do not output anything |
|
183 |
-V, --version Print current version |
|
184 |
-d, --debug Include debug output |
|
185 |
-i, --include Include protocol headers in the output |
|
186 |
--config CONFIG Path to configuration file |
|
187 |
-o OPTIONS, --options OPTIONS |
|
188 |
Override a config value |
|
189 |
-h, --help Show help message |
|
190 |
-l show detailed output |
|
201 |
-v, --verbose More info at response |
|
202 |
-s, --silent Do not output anything |
|
203 |
-V, --version Print current version |
|
204 |
-d, --debug Include debug output |
|
205 |
-i, --include Include raw connection data in the output |
|
206 |
-c CONFIG, --config CONFIG |
|
207 |
Path to configuration file |
|
208 |
-o OPTIONS, --options OPTIONS |
|
209 |
Override a config value |
|
210 |
--cloud CLOUD Chose a remote cloud to connect to |
|
211 |
-h, --help Show help message |
|
212 |
--since SINCE show only items since date (' d/m/Y H:M:S ') |
|
213 |
--enumerate Enumerate results |
|
214 |
-l, --details show detailed output |
|
215 |
--more output results in pages (-n to set items per page, |
|
216 |
default 10) |
|
217 |
-n LIMIT, --number LIMIT |
|
218 |
limit number of listed VMs |
|
219 |
-j, --json show headers in json |
|
191 | 220 |
|
192 | 221 |
.. _using-history-ref: |
193 | 222 |
|
... | ... | |
229 | 258 |
1. kamaki server list |
230 | 259 |
3. kamaki history show --match server |
231 | 260 |
|
261 |
Debug and logging |
|
262 |
^^^^^^^^^^^^^^^^^ |
|
263 |
|
|
232 | 264 |
Debug |
233 |
^^^^^ |
|
265 |
""""" |
|
266 |
|
|
267 |
In case of errors, kamaki in debug mode shows useful debug information, like |
|
268 |
the stack trace. Kamaki in debug mode cancels suppression of warning messages. |
|
269 |
|
|
270 |
To run kamaki in debug mode use the -d or --debug option (can be combined with |
|
271 |
any other parameters or options) |
|
272 |
|
|
273 |
Logging |
|
274 |
""""""" |
|
275 |
|
|
276 |
Kamaki keeps its logs in a file specified as global.log_file and its value |
|
277 |
defaults to ${HOME}/.kamaki.log . This value may change with a config setting:: |
|
278 |
|
|
279 |
kamaki config set log_file /new/log/file/path |
|
280 |
|
|
281 |
Kamaki logs mostly the http connection requests and responses, including http |
|
282 |
methods, urls, parameters and headers. There is some special handling in two |
|
283 |
cases: |
|
284 |
|
|
285 |
* HTTP bodies are not logged by default |
|
286 |
to enable logging the full http bodies, set log_data to `on`:: |
|
287 |
|
|
288 |
kamaki config set log_data on |
|
289 |
|
|
290 |
to disable it, set it to `off`:: |
|
291 |
|
|
292 |
kamaki config set log_data off |
|
293 |
|
|
294 |
or delete it:: |
|
295 |
|
|
296 |
kamaki config delete log_data |
|
297 |
|
|
298 |
* X-Auth-Token header is not logged by default |
|
299 |
to enable logging the X-Auth-Token header, set log_token to `on`:: |
|
300 |
|
|
301 |
kamaki config set log_token on |
|
302 |
|
|
303 |
to disable it, set it to `off`:: |
|
304 |
|
|
305 |
kamaki config set log_token off |
|
234 | 306 |
|
235 |
In case of errors, kamaki in debug mode shows useful debug information, like the stack trace. Kamaki in debug mode cancels suppression of warning messages.
|
|
307 |
or delete it::
|
|
236 | 308 |
|
237 |
To run kamaki in debug mode use the -d or --debug option (can be combined with any other parameters or options)
|
|
309 |
kamaki config delete log_token
|
|
238 | 310 |
|
239 | 311 |
Verbose and Include |
240 | 312 |
""""""""""""""""""" |
241 | 313 |
|
242 |
Most kamaki commands are translated into http requests. Kamaki clients API translated the semantics to REST and handles the response. Users who need to have access to these commands can use the verbose mode that presents the HTTP Request details as well as the full server response. |
|
314 |
Most kamaki commands are translated into http requests. Kamaki clients API |
|
315 |
translated the semantics to REST and handles the response. Users who need to |
|
316 |
have access to these commands can use the verbose mode that presents the HTTP |
|
317 |
Request details as well as the full server response. |
|
243 | 318 |
|
244 | 319 |
To run kamaki in verbose mode use the -v or --verbose option |
245 | 320 |
|
246 |
Be default, kamaki in verbose mode prints down only the headers and the address information, thus hiding the data body of the request or response. To see the data body, the -i option can be used. |
|
321 |
Be default, kamaki in verbose mode prints down only the headers and the address |
|
322 |
information, thus hiding the data body of the request or response. To see the |
|
323 |
data body, the -i option can be used. |
|
247 | 324 |
|
248 | 325 |
One-command features |
249 | 326 |
^^^^^^^^^^^^^^^^^^^^ |
... | ... | |
253 | 330 |
.. code-block:: console |
254 | 331 |
:emphasize-lines: 1 |
255 | 332 |
|
256 |
Example 3.4.1: Print username for token us3rt0k3n== using grep
|
|
333 |
Example 3.4.1: List the trash container contents, containing c1_
|
|
257 | 334 |
|
258 | 335 |
|
259 |
$ kamaki user authenticate -o token=us3rt0k3n== | grep userame |
|
260 |
userame : user@synnefo.org |
|
336 |
$ kamaki file list -o global.pithos_container=trash| grep c1_ |
|
337 |
c1_1370859409.0 20KB |
|
338 |
c1_1370859414.0 9MB |
|
339 |
c1_1370859409.1 110B |
|
261 | 340 |
|
262 |
The -o argument can be used to temporarily override various (set or unset) options. In one command, all -o option sets are forgotten just after the command has been completed, and the previous settings are restored (a.k.a. the configuration file is not modified). |
|
341 |
The -o argument can be used to temporarily override various (set or unset) |
|
342 |
options. In one command, all -o option sets are forgotten just after the |
|
343 |
command has been completed, and the previous settings are restored (the |
|
344 |
configuration file is not modified). |
|
263 | 345 |
|
264 |
The user-authenticate command in example 3.4.1 runs with an explicitly provided token, which temporarily overrides the token provided in the configuration file. |
|
346 |
The file-list command in example 3.4.1 runs with an explicitly provided |
|
347 |
pithos_account, which temporarily overrides the one probably provided in the |
|
348 |
configuration file (it works even if the user has not set the optional |
|
349 |
pithos_account config option). |
|
265 | 350 |
|
266 | 351 |
Interactive shell |
267 | 352 |
----------------- |
... | ... | |
269 | 354 |
Command Contexts |
270 | 355 |
^^^^^^^^^^^^^^^^ |
271 | 356 |
|
272 |
The kamaki interactive shell implements the notion of command contexts. Each command group is also a context where the users can **enter** by typing the group name. If the context switch is successful, the kamaki shell prompt changes to present the new context ("file" in example 4.1.1). |
|
357 |
The kamaki interactive shell implements the notion of command contexts. Each |
|
358 |
command group is also a context where the users can **enter** by typing the |
|
359 |
group name. If the context switch is successful, the kamaki shell prompt |
|
360 |
changes to present the new context ("file" in example 4.1.1). |
|
273 | 361 |
|
274 | 362 |
.. code-block:: console |
275 | 363 |
:emphasize-lines: 1 |
... | ... | |
281 | 369 |
[kamaki]: file |
282 | 370 |
[file]: |
283 | 371 |
|
284 |
Type **exit** (alternatively **ctrl-D** in (X)nix systems or **ctrl-Z** in Windows) to exit a context and return to the context of origin. If already at the top context (kamaki), an exit is equivalent to exiting the program. |
|
372 |
Type **exit** (alternatively **ctrl-D** in (X)nix systems or **ctrl-Z** in |
|
373 |
Windows) to exit a context and return to the context of origin. If already at |
|
374 |
the top context (kamaki), an exit is equivalent to exiting the program. |
|
285 | 375 |
|
286 | 376 |
.. code-block:: console |
287 | 377 |
:emphasize-lines: 1 |
... | ... | |
314 | 404 |
[server]: exit |
315 | 405 |
[kamaki]: |
316 | 406 |
|
317 |
Users have the option to avoid switching between contexts: all commands can run from the **top context**. As a result, examples 4.1.3 and 4.1.4 are equivalent. |
|
407 |
Users have the option to avoid switching between contexts: all commands can run |
|
408 |
from the **top context**. As a result, examples 4.1.3 and 4.1.4 are equivalent. |
|
318 | 409 |
|
319 | 410 |
.. code-block:: console |
320 | 411 |
:emphasize-lines: 1 |
... | ... | |
335 | 426 |
|
336 | 427 |
There are two help mechanisms: a context-level and a command-level. |
337 | 428 |
|
338 |
**Context-level help** lists the available commands in a context and can also offer a short description for each command. |
|
429 |
**Context-level help** lists the available commands in a context and can also |
|
430 |
offer a short description for each command. |
|
339 | 431 |
|
340 | 432 |
Context-level help syntax:: |
341 | 433 |
|
... | ... | |
347 | 439 |
[context]: help cmd |
348 | 440 |
[context]: ?cmd |
349 | 441 |
|
350 |
The context-level help results change from context to context |
|
442 |
The context-level help results may change from context to context
|
|
351 | 443 |
|
352 | 444 |
.. code-block:: console |
353 | 445 |
:emphasize-lines: 1 |
354 | 446 |
|
355 |
Example 4.2.1: Get available commands, pick a context and get help there as well
|
|
447 |
Example 4.2.1: Get available commands and then get help in a context
|
|
356 | 448 |
|
357 | 449 |
|
358 | 450 |
[kamaki]: help |
... | ... | |
383 | 475 |
[config]: help set |
384 | 476 |
Set a configuration option (set -h for more options) |
385 | 477 |
|
386 |
In context-level, there is a distinction between kamaki-commands and interactive shell commands. The former are available in one-command mode and are related to the cloud client setup and use, while the later are context-shell functions. |
|
478 |
In context-level, there is a distinction between kamaki-commands and |
|
479 |
interactive shell commands. The former are available in one-command mode and |
|
480 |
are related to the cloud client setup and use, while the later are |
|
481 |
context-shell functions. |
|
387 | 482 |
|
388 |
**Command-level help** prints the syntax, arguments and description of a specific (terminal) command |
|
483 |
**Command-level help** prints the syntax, arguments and description of a |
|
484 |
specific (terminal) command |
|
389 | 485 |
|
390 | 486 |
Command-level help syntax:: |
391 | 487 |
|
... | ... | |
397 | 493 |
|
398 | 494 |
<arguments and possible extensions> |
399 | 495 |
|
400 |
Command-level help mechanism is exactly the same as the one used in one-command mode. For example, it is invoked by using the -h or --help parameter at any point. |
|
496 |
Command-level help mechanism is exactly the same as the one used in |
|
497 |
one-command mode. For example, it is invoked by using the -h or --help |
|
498 |
parameter at any point. |
|
401 | 499 |
|
402 | 500 |
.. code-block:: console |
403 | 501 |
:emphasize-lines: 1 |
... | ... | |
447 | 545 |
Accessing top-level commands |
448 | 546 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
449 | 547 |
|
450 |
When working in a context, it is often useful to access other contexts or top-level commands. Kamaki offers access to top-level commands by using the / prefix, as shown bellow:: |
|
548 |
When working in a context, it is often useful to access other contexts or |
|
549 |
top-level commands. Kamaki offers access to top-level commands by using the |
|
550 |
`/` prefix, as shown bellow:: |
|
451 | 551 |
|
452 | 552 |
* access a command "anothercontext cmd1 cmd2 ... cmdN" |
453 | 553 |
[context]: /anothercontext cmd1 cmd2 ... cmdN |
454 | 554 |
|
455 |
An example (4.3.1) that showcases how top-level access improves user experience is the creation of a VM. A VM is created with the command server-create. This command is called with three parameters: |
|
555 |
An example (4.3.1) that showcases how top-level access improves user experience |
|
556 |
is the creation of a VM. A VM is created with the command server-create. This |
|
557 |
command is called with three parameters: |
|
456 | 558 |
|
457 | 559 |
* the name of the new VM |
458 | 560 |
* the flavor id |
459 | 561 |
* the image id |
460 | 562 |
|
461 |
It is often the case that a user who works in the context command, needs to create a new VM, but hasn't selected a flavor or an image id, or cannot recall the id of that flavor or image. Therefore, it is necessary to list all available flavors (flavor-list) or images (image-compute-list). Both commands belong to different contexts. |
|
563 |
It is often the case that a user who works in the context command, needs to |
|
564 |
create a new VM, but hasn't selected a flavor or an image id, or cannot recall |
|
565 |
the id of that flavor or image. Therefore, it is necessary to list all |
|
566 |
available flavors (flavor-list) or images (image-compute-list). Both commands |
|
567 |
belong to different contexts. |
|
462 | 568 |
|
463 | 569 |
.. code-block:: console |
464 | 570 |
:emphasize-lines: 1 |
... | ... | |
486 | 592 |
[server]: create 'my debian' 43 6aa6eafd-dccb-67fe2bdde87e |
487 | 593 |
... |
488 | 594 |
|
489 |
An other example (4.3.2) showcases how to acquire and modify configuration settings from a different context. In this scenario, the user token expires at server side while the user is working. When that happens, the system responds with an *(401) UNAUTHORIZED* message. The user can acquire a new token (valid for the Astakos identity manager of preference) which has to be set to kamaki. |
|
595 |
An other example (4.3.2) showcases how to acquire and modify configuration |
|
596 |
settings from a different context. In this scenario, the user token expires at |
|
597 |
server side while the user is working. When that happens, the system responds |
|
598 |
with an *(401) UNAUTHORIZED* message. The user can acquire a new token (valid |
|
599 |
for the Astakos identity manager of preference) which has to be set to kamaki. |
|
490 | 600 |
|
491 | 601 |
.. code-block:: console |
492 | 602 |
:emphasize-lines: 1 |
... | ... | |
500 | 610 |
[file]: /user authenticate |
501 | 611 |
(401) UNAUTHORIZED Invalid X-Auth-Token |
502 | 612 |
|
503 |
[file]: /config get token |
|
613 |
[file]: /config get remote.default.token
|
|
504 | 614 |
my3xp1r3dt0k3n== |
505 | 615 |
|
506 |
[file]: /config set token myfr35ht0k3n== |
|
616 |
[file]: /config set remote.default.token myfr35ht0k3n==
|
|
507 | 617 |
|
508 |
[file]: /config get token |
|
509 |
myfr35ht0k3n== |
|
618 |
[file]: /config get remote.default |
|
619 |
remote.default.url = https://astakos.example.com/astakos/identity/2.0/ |
|
620 |
remote.default.token = myfr35ht0k3n== |
|
510 | 621 |
|
511 | 622 |
[file]: list |
512 | 623 |
1. pithos (10MB, 2 objects) |
513 | 624 |
2. trash (0B, 0 objects) |
514 | 625 |
|
515 |
.. note:: The error messages on this example where shortened for clarity. Actual kamaki error messages are more helpful and descriptive. |
|
626 |
.. note:: The error messages on this example where shortened for clarity. |
|
627 |
Actual kamaki error messages are more helpful and descriptive. |
|
516 | 628 |
|
517 |
The following example compares some equivalent calls that run *user-authenticate* after a *file-list* 401 failure. |
|
629 |
The following example compares some equivalent calls that run |
|
630 |
*user-authenticate* after a *file-list* 401 failure. |
|
518 | 631 |
|
519 | 632 |
.. code-block:: console |
520 | 633 |
:emphasize-lines: 1,3,10,17,26 |
521 | 634 |
|
522 |
Example 4.3.3: Equivalent user-authenticate calls after a file-list 401 failure
|
|
635 |
Example 4.3.3: Equivalent user-authenticate calls after a file-list 401 |
|
523 | 636 |
|
524 | 637 |
* without kamaki interactive shell * |
525 | 638 |
$ kamaki file list |
... | ... | |
556 | 669 |
Using config |
557 | 670 |
^^^^^^^^^^^^ |
558 | 671 |
|
559 |
The configuration mechanism of kamaki is detailed at the `setup section <setup.html>`_ and it is common for both interaction modes. In specific, the configuration mechanism is implemented as a command group, namely *config*. Using the config commands is as straightforward as any other kamaki commands. |
|
672 |
The configuration mechanism of kamaki is detailed at the |
|
673 |
`setup section <setup.html>`_ and it is common for both interaction modes. In |
|
674 |
specific, the configuration mechanism is implemented as a command group, namely |
|
675 |
`config`. Using the config commands is as straightforward as any other kamaki |
|
676 |
commands. |
|
560 | 677 |
|
561 |
It is often useful to set, delete or update a value. This can be managed either inside the config context or from any command context by using the / prefix. |
|
678 |
It is often useful to set, delete or update a value. This can be managed either |
|
679 |
inside the config context or from any command context by using the / prefix. |
|
562 | 680 |
|
563 |
.. Note:: config updates in kamaki shell persist even after the session is over.
|
|
681 |
.. Note:: config updates in kamaki shell persist even after the session is over |
|
564 | 682 |
|
565 |
All setting changes affect the physical kamaki config file. The config file is created automatically at callers' home firectory the first time a config option is set, and lives there as *.kamakirc* . It can be edited with any text editor or managed with kamaki config commands. |
|
683 |
All setting changes affect the physical kamaki config file. The config file is |
|
684 |
created automatically at callers' home firectory the first time a config option |
|
685 |
is set, and lives there as *.kamakirc* . It can be edited with any text editor |
|
686 |
or managed with kamaki config commands. |
|
566 | 687 |
|
567 |
In example 4.4.1 the user is going to work with only one storage container. The file commands use the container:path syntax, but if the user sets a container name as default, the container name can be omitted. This is possible by setting a *file.container* setting. |
|
688 |
In example 4.4.1 the user is going to work with only one storage container. The |
|
689 |
file commands use the container:path syntax, but if the user sets a container |
|
690 |
name as default, the container name can be omitted. This is possible by setting |
|
691 |
a *file.container* setting. |
|
568 | 692 |
|
569 | 693 |
.. code-block:: console |
570 | 694 |
:emphasize-lines: 1 |
... | ... | |
581 | 705 |
1. D mydir/ |
582 | 706 |
2. 20M mydir/rndm_local.file |
583 | 707 |
|
584 |
[file]: /config set file.container mycontainer
|
|
708 |
[file]: /config set pithos_container mycontainer
|
|
585 | 709 |
|
586 | 710 |
[file]: list |
587 | 711 |
1. D mydir/ |
588 | 712 |
2. 20M mydir/rndm_local.file |
589 | 713 |
|
590 |
After a while, the user needs to work with multiple containers, therefore a default container is no longer needed. The *file.container* setting can be deleted, as shown in example 4.4.2 . |
|
714 |
After a while, the user needs to work with multiple containers, therefore a |
|
715 |
default container is no longer needed. The *pithos_container* setting can be |
|
716 |
deleted, as shown in example 4.4.2 |
|
591 | 717 |
|
592 | 718 |
.. code-block:: console |
593 | 719 |
:emphasize-lines: 1 |
... | ... | |
595 | 721 |
Example 4.4.2: Delete a setting option |
596 | 722 |
|
597 | 723 |
|
598 |
[file]: /config delete file.container
|
|
724 |
[file]: /config delete pithos_container
|
|
599 | 725 |
|
600 | 726 |
[file]: list |
601 | 727 |
1. mycontainer (32MB, 2 objects) |
... | ... | |
605 | 731 |
Using history |
606 | 732 |
^^^^^^^^^^^^^ |
607 | 733 |
|
608 |
There are two history modes: session and permanent. Session history keeps record of all actions in a kamaki shell session, while permanent history appends all commands to an accessible history file. |
|
734 |
There are two history modes: session and permanent. Session history keeps |
|
735 |
record of all actions in a kamaki shell session, while permanent history |
|
736 |
appends all commands to an accessible history file. |
|
609 | 737 |
|
610 |
Session history is only available in interactive shell mode. Users can iterate through past commands in the same session with the *up* and *down* keys. Session history is not stored, although syntactically correct commands are recorded through the permanent history mechanism |
|
738 |
Session history is only available in interactive shell mode. Users can iterate |
|
739 |
through past commands in the same session with the ↑ and ↓ keys. Session |
|
740 |
history is not stored, although syntactically correct commands are recorded |
|
741 |
through the permanent history mechanism. |
|
611 | 742 |
|
612 |
Permanent history is implemented as a command group and is common to both the one-command and shell interfaces. In specific, every syntactically correct command is appended in a history file (configured as *history.file* in settings, see `setup section <setup.html>`_ for details). Commands executed in one-command mode are mixed with the ones run in kamaki shell (also see :ref:`using-history-ref` section on this guide). |
|
743 |
Permanent history is implemented as a command group and is common to both the |
|
744 |
one-command and shell interfaces. In specific, every syntactically correct |
|
745 |
command is appended in a history file (configured as `history_file` in |
|
746 |
settings, see `setup section <setup.html>`_ for details). Commands executed in |
|
747 |
one-command mode are mixed with the ones run in kamaki shell (also |
|
748 |
see :ref:`using-history-ref` section on this guide). |
|
613 | 749 |
|
614 | 750 |
Scripting |
615 | 751 |
^^^^^^^^^ |
616 | 752 |
|
617 |
The history-run feature allows the sequential run of previous command executions in kamaki shell. |
|
753 |
The history-run feature allows the sequential run of previous command |
|
754 |
executions in kamaki shell. |
|
618 | 755 |
|
619 |
The following sequence copies and downloads a file from *mycontainer1* , uploads it to *mycontainer2* , then undo the proccess and repeats it with history-run |
|
756 |
The following sequence copies and downloads a file from *mycontainer1* , |
|
757 |
uploads it to *mycontainer2* , then undo the proccess and repeats it with |
|
758 |
history-run |
|
620 | 759 |
|
621 | 760 |
.. code-block:: console |
622 | 761 |
:emphasize-lines: 1,12,19,32 |
... | ... | |
655 | 794 |
<file upload mylocalfile mycontainer2:myfile> |
656 | 795 |
Upload completed |
657 | 796 |
|
658 |
For powerfull scripting, users are advised to take advantage of their os shell scripting capabilities and combine them with kamaki one-command. Still, the history-run functionality might prove handy in many occasions. |
|
797 |
For powerfull scripting, users are advised to take advantage of their os shell |
|
798 |
scripting capabilities and combine them with kamaki one-command. Still, the |
|
799 |
history-run functionality might prove handy in many occasions. |
|
659 | 800 |
|
660 | 801 |
Tab completion |
661 | 802 |
^^^^^^^^^^^^^^ |
662 | 803 |
|
663 |
Kamaki shell features tab completion for the first level of command terms of the current context. Tab completion pool changes dynamically when the context is switched. Currently, tab completion is not supported when / is used (see :ref:`accessing-top-level-commands-ref` ). |
|
804 |
Kamaki shell features tab completion for the first level of command terms of |
|
805 |
the current context. Tab completion pool changes dynamically when the context |
|
806 |
is switched. Currently, tab completion is not supported when / is used |
|
807 |
(see :ref:`accessing-top-level-commands-ref` ). |
|
664 | 808 |
|
665 | 809 |
OS Shell integration |
666 | 810 |
^^^^^^^^^^^^^^^^^^^^ |
667 | 811 |
|
668 |
Kamaki shell features the ability to execute OS-shell commands from any context. This can be achieved by typing *!* or *shell*:: |
|
812 |
Kamaki shell features the ability to execute OS-shell commands from any |
|
813 |
context. This can be achieved by typing *!* or *shell*:: |
|
669 | 814 |
|
670 | 815 |
[kamaki_context]: !<OS shell command> |
671 | 816 |
... OS shell command output ... |
... | ... | |
695 | 840 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 logo-copy.png |
696 | 841 |
|
697 | 842 |
|
698 |
Kamaki shell commits command strings to the outside shell and prints the results, without interacting with it. After a command is finished, kamaki shell returns to its initial state, which involves the current directory, as show in example 4.8.2 . |
|
843 |
Kamaki shell commits command strings to the outside shell and prints the |
|
844 |
results, without interacting with it. After a command is finished, kamaki shell |
|
845 |
returns to its initial state, which involves the current directory, as show in |
|
846 |
example 4.8.2 |
|
699 | 847 |
|
700 | 848 |
.. code-block:: console |
701 | 849 |
:emphasize-lines: 1 |
b/kamaki/cli/__init__.py | ||
---|---|---|
206 | 206 |
print 'The following information will NOT be preserved:' |
207 | 207 |
print '\t', '\n\t'.join(lost_terms) |
208 | 208 |
print('Kamaki is ready to convert the config file to version 3.0') |
209 |
stdout.write('Overwrite file %s ? [Y, y] ' % cnf.path)
|
|
209 |
stdout.write('Create (overwrite) file %s ? [y/N] ' % cnf.path)
|
|
210 | 210 |
from sys import stdin |
211 | 211 |
reply = stdin.readline() |
212 | 212 |
if reply in ('Y\n', 'y\n'): |
Also available in: Unified diff