Revision 904091dd docs/usage.rst
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 |
Also available in: Unified diff