Statistics
| Branch: | Tag: | Revision:

root / docs / usage.rst @ 52b2b3bd

History | View | Annotate | Download (22.6 kB)

1 8f489707 Stavros Sachtouris
Usage
2 8f489707 Stavros Sachtouris
=====
3 8f489707 Stavros Sachtouris
4 76769d2f Stavros Sachtouris
Kamaki features commands of the form::
5 f23a5cdb Stavros Sachtouris
6 76769d2f Stavros Sachtouris
  [kamaki] <object> <action> [identifier(s)] <non-positional arguments>
7 76769d2f Stavros Sachtouris
  e.g., 
8 76769d2f Stavros Sachtouris
  kamaki user info --username=user@example.com
9 76769d2f Stavros Sachtouris
10 76769d2f Stavros Sachtouris
A detailed list of the command specifications can be found in
11 76769d2f Stavros Sachtouris
`Commands <commands.html>`_ section.
12 76769d2f Stavros Sachtouris
13 76769d2f Stavros Sachtouris
All commands can run either from the host shell or through the kamaki
14 76769d2f Stavros Sachtouris
interactive shell:
15 76769d2f Stavros Sachtouris
16 76769d2f Stavros Sachtouris
.. code-block:: console
17 76769d2f Stavros Sachtouris
18 76769d2f Stavros Sachtouris
  #  Run from host shell
19 76769d2f Stavros Sachtouris
  $ kamaki user info
20 76769d2f Stavros Sachtouris
  ... RESULTS ...
21 76769d2f Stavros Sachtouris
22 76769d2f Stavros Sachtouris
  #  Run from kamaki interactive shell
23 76769d2f Stavros Sachtouris
  $ kamaki-shell
24 76769d2f Stavros Sachtouris
  [kamaki]: user info
25 76769d2f Stavros Sachtouris
  ... RESULTS ...
26 76769d2f Stavros Sachtouris
27 76769d2f Stavros Sachtouris
In the later, the term "one-command" will be user to refer to running kamaki
28 76769d2f Stavros Sachtouris
commands from host shell, while the term "shell" will refer to the kamaki's own
29 76769d2f Stavros Sachtouris
interactive shell
30 76769d2f Stavros Sachtouris
31 76769d2f Stavros Sachtouris
.. note:: This section refers to the kamaki CLI. Developers and people who write
32 76769d2f Stavros Sachtouris
  scripts, should rather use the the
33 76769d2f Stavros Sachtouris
  `Clients lib <developers/code.html#the-clients-api>`_ instead of the kamaki
34 76769d2f Stavros Sachtouris
  CLI.
35 f23a5cdb Stavros Sachtouris
36 961e6040 Stavros Sachtouris
Quick Setup
37 961e6040 Stavros Sachtouris
-----------
38 f23a5cdb Stavros Sachtouris
39 76769d2f Stavros Sachtouris
Kamaki interfaces rely on a list of configuration options. Check the
40 76769d2f Stavros Sachtouris
`Setup <setup.html>`_ guide for a full list.
41 f23a5cdb Stavros Sachtouris
42 76769d2f Stavros Sachtouris
As rule of the thump, it is enough to set a cloud authentication URL and TOKEN:
43 f23a5cdb Stavros Sachtouris
44 f23a5cdb Stavros Sachtouris
.. code-block:: console
45 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
46 f23a5cdb Stavros Sachtouris
47 76769d2f Stavros Sachtouris
    Example 1.1: Set authentication URL, user token for cloud alias "default"
48 f23a5cdb Stavros Sachtouris
49 fa382f9e Stavros Sachtouris
    $ kamaki config set cloud.default.url <authentication URL>
50 fa382f9e Stavros Sachtouris
    $ kamaki config set cloud.default.token myt0k3n==
51 fa382f9e Stavros Sachtouris
52 fa382f9e Stavros Sachtouris
.. note:: The term *default* can be replaced by any arbitary term chosen by
53 76769d2f Stavros Sachtouris
    the user.
54 f3446cf0 Stavros Sachtouris
55 a6370d73 Stavros Sachtouris
Shell vs one-command
56 7536c9bf Stavros Sachtouris
--------------------
57 76769d2f Stavros Sachtouris
58 76769d2f Stavros Sachtouris
Kamaki users can access Synnefo services through either the kamaki shell or the
59 76769d2f Stavros Sachtouris
one-command interface. Both systems feature identical responses and error
60 76769d2f Stavros Sachtouris
messages, since they rely on the same internal command and library API
61 76769d2f Stavros Sachtouris
implementation. However, there are some minor differences.
62 7536c9bf Stavros Sachtouris
63 2bd23362 Stavros Sachtouris
In favor of interactive shell:
64 a6370d73 Stavros Sachtouris
65 76769d2f Stavros Sachtouris
* shorter commands (context switching)
66 76769d2f Stavros Sachtouris
* tab completion for commands (if supported by host shell)
67 76769d2f Stavros Sachtouris
* kamaki-specific history with ↑ or ↓ keys (if supported by host shell)
68 79b4f177 Stavros Sachtouris
* re-run old commands with /history
69 a6370d73 Stavros Sachtouris
70 2bd23362 Stavros Sachtouris
In favor of one-command:
71 a6370d73 Stavros Sachtouris
72 76769d2f Stavros Sachtouris
* users take advantage of host shell features (pipelines, redirection, etc.)
73 a6370d73 Stavros Sachtouris
* can be used in shell scripts
74 a6370d73 Stavros Sachtouris
75 f23a5cdb Stavros Sachtouris
Run as shell
76 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^
77 a6370d73 Stavros Sachtouris
To use kamaki as a shell, run:
78 f23a5cdb Stavros Sachtouris
79 f23a5cdb Stavros Sachtouris
.. code-block:: console
80 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
81 f23a5cdb Stavros Sachtouris
82 f3446cf0 Stavros Sachtouris
    Example 2.2.1: Run kamaki shell
83 f23a5cdb Stavros Sachtouris
84 76769d2f Stavros Sachtouris
    $ kamaki-shell
85 f23a5cdb Stavros Sachtouris
86 2bd23362 Stavros Sachtouris
* with any kind of '-' prefixed arguments, except '-h', '--help', '-V',
87 2bd23362 Stavros Sachtouris
    '- - version'.
88 f23a5cdb Stavros Sachtouris
89 f23a5cdb Stavros Sachtouris
.. code-block:: console
90 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
91 f23a5cdb Stavros Sachtouris
92 f3446cf0 Stavros Sachtouris
    Example 2.2.2: Run kamaki shell with custom configuration file
93 f23a5cdb Stavros Sachtouris
94 76769d2f Stavros Sachtouris
    $ kamaki-shell -c myconfig.file
95 76769d2f Stavros Sachtouris
96 76769d2f Stavros Sachtouris
    Example 2.2.3: Run kamaki shell so as to use a specific cloud
97 76769d2f Stavros Sachtouris
98 76769d2f Stavros Sachtouris
    $ kamaki-shell --cloud=my_demo_cloud
99 76769d2f Stavros Sachtouris
100 76769d2f Stavros Sachtouris
    Example 2.2.4: Run kamaki shell with verbosity (shows HTTP requests)
101 76769d2f Stavros Sachtouris
102 76769d2f Stavros Sachtouris
    $ kamaki-shell -v
103 f23a5cdb Stavros Sachtouris
104 76769d2f Stavros Sachtouris
.. note:: Valid arguments can be combined e.g., it is ok to run a shell with
105 76769d2f Stavros Sachtouris
  verbosity and a specific cloud::
106 76769d2f Stavros Sachtouris
107 76769d2f Stavros Sachtouris
    $ kamaki-shell -v --cloud=my_demo_cloud
108 f23a5cdb Stavros Sachtouris
109 f23a5cdb Stavros Sachtouris
Run as one-command
110 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^^^^^^
111 a6370d73 Stavros Sachtouris
To use kamaki as an one-command tool, run:
112 f23a5cdb Stavros Sachtouris
113 f23a5cdb Stavros Sachtouris
* with the '-h' or '--help' arguments (help for kamaki one-command)
114 f23a5cdb Stavros Sachtouris
115 f23a5cdb Stavros Sachtouris
.. code-block:: console
116 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
117 f23a5cdb Stavros Sachtouris
118 a6370d73 Stavros Sachtouris
    Example 2.3.1: Kamaki help
119 f23a5cdb Stavros Sachtouris
120 f3446cf0 Stavros Sachtouris
    $kamaki -h
121 f3446cf0 Stavros Sachtouris
122 76769d2f Stavros Sachtouris
* with one or more command parameters (object and, maybe, action):
123 f23a5cdb Stavros Sachtouris
124 f23a5cdb Stavros Sachtouris
.. code-block:: console
125 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
126 f23a5cdb Stavros Sachtouris
127 2bd23362 Stavros Sachtouris
    Example 2.3.2: List servers managed by user
128 f23a5cdb Stavros Sachtouris
129 f3446cf0 Stavros Sachtouris
    $ kamaki server list
130 f3446cf0 Stavros Sachtouris
131 457cb69b Stavros Sachtouris
One-command interface
132 7536c9bf Stavros Sachtouris
---------------------
133 a6370d73 Stavros Sachtouris
134 a6370d73 Stavros Sachtouris
Using help
135 7536c9bf Stavros Sachtouris
^^^^^^^^^^
136 a6370d73 Stavros Sachtouris
137 76769d2f Stavros Sachtouris
Kamaki help provides information on commands (description, syntax).
138 a6370d73 Stavros Sachtouris
139 76769d2f Stavros Sachtouris
To see the command groups (objects), use -h or --help (example 1.3.1). The
140 f6822a26 Stavros Sachtouris
following examples demonstrate the help messages of kamaki, in the context of a
141 f6822a26 Stavros Sachtouris
command group (server) and of a command in that group (list).
142 a6370d73 Stavros Sachtouris
143 a6370d73 Stavros Sachtouris
.. code-block:: console
144 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
145 f3446cf0 Stavros Sachtouris
146 2151584b Stavros Sachtouris
    Example 3.1.1: kamaki help shows available parameters and command groups
147 f3446cf0 Stavros Sachtouris
148 a6370d73 Stavros Sachtouris
149 a6370d73 Stavros Sachtouris
    $ kamaki -h
150 f3446cf0 Stavros Sachtouris
    usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd>
151 76769d2f Stavros Sachtouris
        [-v] [-s] [-V] [-d] [-c CONFIG] [-o OPTIONS] [--cloud CLOUD] [-h]
152 a6370d73 Stavros Sachtouris
153 a6370d73 Stavros Sachtouris
    optional arguments:
154 a6370d73 Stavros Sachtouris
      -v, --verbose         More info at response
155 a6370d73 Stavros Sachtouris
      -s, --silent          Do not output anything
156 a6370d73 Stavros Sachtouris
      -V, --version         Print current version
157 a6370d73 Stavros Sachtouris
      -d, --debug           Include debug output
158 904091dd Stavros Sachtouris
      -c CONFIG, --config CONFIG
159 904091dd Stavros Sachtouris
                            Path to configuration file
160 a6370d73 Stavros Sachtouris
      -o OPTIONS, --options OPTIONS
161 a6370d73 Stavros Sachtouris
                            Override a config value
162 fa382f9e Stavros Sachtouris
      --cloud CLOUD         Chose a cloud to connect to
163 a6370d73 Stavros Sachtouris
      -h, --help            Show help message
164 a6370d73 Stavros Sachtouris
165 a6370d73 Stavros Sachtouris
    Options:
166 a6370d73 Stavros Sachtouris
     - - - -
167 76769d2f Stavros Sachtouris
    resource: Astakos/Account API commands for resources
168 76769d2f Stavros Sachtouris
    group: Pithos+/Storage user groups
169 76769d2f Stavros Sachtouris
    network: Networking API network commands
170 76769d2f Stavros Sachtouris
    subnet: Networking API network commands
171 76769d2f Stavros Sachtouris
    ip: Networking API floatingip commands
172 76769d2f Stavros Sachtouris
    image: Cyclades/Plankton API image commands
173 76769d2f Stavros Sachtouris
    imagecompute: Cyclades/Compute API image commands
174 76769d2f Stavros Sachtouris
    quota: Astakos/Account API commands for quotas
175 76769d2f Stavros Sachtouris
    sharer: Pithos+/Storage sharers
176 76769d2f Stavros Sachtouris
    project: Astakos project API commands
177 76769d2f Stavros Sachtouris
    user: Astakos/Identity API commands
178 76769d2f Stavros Sachtouris
    file: Pithos+/Storage object level API commands
179 76769d2f Stavros Sachtouris
    container: Pithos+/Storage container level API commands
180 f6822a26 Stavros Sachtouris
    flavor: Cyclades/Compute API flavor commands
181 76769d2f Stavros Sachtouris
    server: Cyclades/Compute API server commands
182 f6822a26 Stavros Sachtouris
    config: Kamaki configurations
183 76769d2f Stavros Sachtouris
    port: Networking API network commands
184 f6822a26 Stavros Sachtouris
    history: Kamaki command history
185 76769d2f Stavros Sachtouris
    kamaki-shell: An interactive command line shell
186 a6370d73 Stavros Sachtouris
187 f3446cf0 Stavros Sachtouris
.. code-block:: console
188 904091dd Stavros Sachtouris
    :emphasize-lines: 1,2
189 a6370d73 Stavros Sachtouris
190 904091dd Stavros Sachtouris
    Example 3.1.2: Cyclades help contains all first-level commands of Cyclades
191 904091dd Stavros Sachtouris
    command group
192 a6370d73 Stavros Sachtouris
193 e9e547ed Stavros Sachtouris
    $ kamaki server -h
194 76769d2f Stavros Sachtouris
    usage: kamaki server <...> [-v] [-s] [-V] [-d] [-c CONFIG]
195 904091dd Stavros Sachtouris
                               [-o OPTIONS] [--cloud CLOUD] [-h]
196 a6370d73 Stavros Sachtouris
197 a6370d73 Stavros Sachtouris
    optional arguments:
198 a6370d73 Stavros Sachtouris
      -v, --verbose         More info at response
199 a6370d73 Stavros Sachtouris
      -s, --silent          Do not output anything
200 a6370d73 Stavros Sachtouris
      -V, --version         Print current version
201 a6370d73 Stavros Sachtouris
      -d, --debug           Include debug output
202 904091dd Stavros Sachtouris
      -c CONFIG, --config CONFIG
203 904091dd Stavros Sachtouris
                            Path to configuration file
204 a6370d73 Stavros Sachtouris
      -o OPTIONS, --options OPTIONS
205 a6370d73 Stavros Sachtouris
                            Override a config value
206 fa382f9e Stavros Sachtouris
      --cloud CLOUD         Chose a cloud to connect to
207 a6370d73 Stavros Sachtouris
      -h, --help            Show help message
208 a6370d73 Stavros Sachtouris
209 a6370d73 Stavros Sachtouris
    Options:
210 a6370d73 Stavros Sachtouris
     - - - -
211 f6822a26 Stavros Sachtouris
    info: Detailed information on a Virtual Machine
212 76769d2f Stavros Sachtouris
    modify: Modify attributes of a virtual server
213 f6822a26 Stavros Sachtouris
    create: Create a server (aka Virtual Machine)
214 76769d2f Stavros Sachtouris
    list: List virtual servers accessible by user
215 f6822a26 Stavros Sachtouris
    reboot: Reboot a virtual server
216 f6822a26 Stavros Sachtouris
    start: Start an existing virtual server
217 f6822a26 Stavros Sachtouris
    shutdown: Shutdown an active virtual server
218 76769d2f Stavros Sachtouris
    delete: Delete a virtual server
219 a6370d73 Stavros Sachtouris
220 f3446cf0 Stavros Sachtouris
.. code-block:: console
221 904091dd Stavros Sachtouris
    :emphasize-lines: 1,2
222 a6370d73 Stavros Sachtouris
223 904091dd Stavros Sachtouris
    Example 3.1.3: Help for command "server list" with syntax, description and
224 904091dd Stavros Sachtouris
    available user options
225 a6370d73 Stavros Sachtouris
226 a6370d73 Stavros Sachtouris
    $ kamaki server list -h
227 76769d2f Stavros Sachtouris
    usage: kamaki server list [-v] [-s] [-V] [-d] [-c CONFIG] [-o OPTIONS]
228 904091dd Stavros Sachtouris
                              [--cloud CLOUD] [-h] [--since SINCE] [--enumerate]
229 904091dd Stavros Sachtouris
                              [-l] [--more] [-n LIMIT] [-j]
230 a6370d73 Stavros Sachtouris
231 904091dd Stavros Sachtouris
    List Virtual Machines accessible by user
232 a6370d73 Stavros Sachtouris
233 a6370d73 Stavros Sachtouris
    optional arguments:
234 f6822a26 Stavros Sachtouris
      -v, --verbose         More info at response
235 f6822a26 Stavros Sachtouris
      -s, --silent          Do not output anything
236 f6822a26 Stavros Sachtouris
      -V, --version         Print current version
237 f6822a26 Stavros Sachtouris
      -d, --debug           Include debug output
238 f6822a26 Stavros Sachtouris
      -c CONFIG, --config CONFIG
239 f6822a26 Stavros Sachtouris
                            Path to config file
240 f6822a26 Stavros Sachtouris
      -o OPTIONS, --options OPTIONS
241 f6822a26 Stavros Sachtouris
                            Override a config value
242 f6822a26 Stavros Sachtouris
      --cloud CLOUD         Chose a cloud to connect to
243 f6822a26 Stavros Sachtouris
      -h, --help            Show help message
244 f6822a26 Stavros Sachtouris
      --status STATUS       filter by status (ACTIVE, STOPPED, REBOOT, ERROR,
245 f6822a26 Stavros Sachtouris
                            etc.)
246 f6822a26 Stavros Sachtouris
      --enumerate           Enumerate results
247 f6822a26 Stavros Sachtouris
      --name-suffix NAME_SUFF
248 f6822a26 Stavros Sachtouris
                            filter by name suffix (case insensitive)
249 f6822a26 Stavros Sachtouris
      --image-id IMAGE_ID   filter by image id
250 f6822a26 Stavros Sachtouris
      --metadata META       filter by metadata key=values
251 f6822a26 Stavros Sachtouris
      -j, --json            show headers in json
252 f6822a26 Stavros Sachtouris
      --id ID               filter by id
253 f6822a26 Stavros Sachtouris
      --user-id USER_ID     filter by user id
254 f6822a26 Stavros Sachtouris
      --id-like ID_LIKE     print only if id contains this (case insensitive)
255 f6822a26 Stavros Sachtouris
      --id-suffix ID_SUFF   filter by id suffix (case insensitive)
256 f6822a26 Stavros Sachtouris
      --since SINCE         show only items since date (' d/m/Y H:M:S ')
257 f6822a26 Stavros Sachtouris
      -l, --details         show detailed output
258 f6822a26 Stavros Sachtouris
      --name NAME           filter by name
259 f6822a26 Stavros Sachtouris
      --more                output results in pages (-n to set items per page,
260 f6822a26 Stavros Sachtouris
                            default 10)
261 f6822a26 Stavros Sachtouris
      --name-prefix NAME_PREF
262 f6822a26 Stavros Sachtouris
                            filter by name prefix (case insensitive)
263 f6822a26 Stavros Sachtouris
      -n LIMIT, --number LIMIT
264 f6822a26 Stavros Sachtouris
                            limit number of listed virtual servers
265 f6822a26 Stavros Sachtouris
      --id-prefix ID_PREF   filter by id prefix (case insensitive)
266 f6822a26 Stavros Sachtouris
      --user-name USER_NAME
267 f6822a26 Stavros Sachtouris
                            filter by user name
268 f6822a26 Stavros Sachtouris
      --name-like NAME_LIKE
269 f6822a26 Stavros Sachtouris
                            print only if name contains this (case insensitive)
270 f6822a26 Stavros Sachtouris
      --metadata-like META_LIKE
271 f6822a26 Stavros Sachtouris
                            print only if in key=value, the value is part of
272 f6822a26 Stavros Sachtouris
                            actual value
273 f6822a26 Stavros Sachtouris
      --flavor-id FLAVOR_ID
274 f6822a26 Stavros Sachtouris
                            filter by flavor id
275 f6822a26 Stavros Sachtouris
276 f6822a26 Stavros Sachtouris
    Details:
277 16d7b9ff Stavros Sachtouris
    Use filtering arguments (e.g., --name-like) to manage long server lists
278 a6370d73 Stavros Sachtouris
279 e5d1d5c2 Stavros Sachtouris
.. _using-history-ref:
280 e5d1d5c2 Stavros Sachtouris
281 a6370d73 Stavros Sachtouris
Using history
282 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^
283 a6370d73 Stavros Sachtouris
284 76769d2f Stavros Sachtouris
Kamaki command history is stored in '${HOME}/.kamaki.history' by default). To
285 76769d2f Stavros Sachtouris
set a custom history file path users must set the history.file config option
286 76769d2f Stavros Sachtouris
(more on config options `here <setup.html#editing-options>`_).
287 a6370d73 Stavros Sachtouris
288 f6822a26 Stavros Sachtouris
Every command is appended at the end of that file. In order to see how to use
289 f6822a26 Stavros Sachtouris
history, use the kamaki help system:
290 a6370d73 Stavros Sachtouris
291 a6370d73 Stavros Sachtouris
.. code-block:: console
292 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
293 f3446cf0 Stavros Sachtouris
294 2151584b Stavros Sachtouris
    Example 3.2.1: Available history options
295 f3446cf0 Stavros Sachtouris
296 a6370d73 Stavros Sachtouris
    $ kamaki history -h
297 79b4f177 Stavros Sachtouris
    Options:
298 79b4f177 Stavros Sachtouris
     - - - -
299 79b4f177 Stavros Sachtouris
    clean:  Clean up history (permanent)
300 79b4f177 Stavros Sachtouris
    run  :  Run previously executed command(s)
301 79b4f177 Stavros Sachtouris
    show :  Show intersession command history
302 a6370d73 Stavros Sachtouris
303 f3446cf0 Stavros Sachtouris
304 2151584b Stavros Sachtouris
    Example 3.2.2: Clean up everything, run a kamaki command, show full and filtered history
305 a6370d73 Stavros Sachtouris
306 e5d1d5c2 Stavros Sachtouris
    $ kamaki history clean
307 a6370d73 Stavros Sachtouris
    $ kamaki server list
308 a6370d73 Stavros Sachtouris
    ...
309 a6370d73 Stavros Sachtouris
    $ kamaki history show
310 a6370d73 Stavros Sachtouris
    1.  kamaki server list
311 a6370d73 Stavros Sachtouris
    2.  kamaki history show
312 a6370d73 Stavros Sachtouris
    $ kamaki history show --match server
313 a6370d73 Stavros Sachtouris
    1. kamaki server list
314 a6370d73 Stavros Sachtouris
    3. kamaki history show --match server
315 a6370d73 Stavros Sachtouris
316 904091dd Stavros Sachtouris
Debug and logging
317 904091dd Stavros Sachtouris
^^^^^^^^^^^^^^^^^
318 904091dd Stavros Sachtouris
319 a6370d73 Stavros Sachtouris
Debug
320 904091dd Stavros Sachtouris
"""""
321 904091dd Stavros Sachtouris
322 f6822a26 Stavros Sachtouris
When in debug mode, kamaki outputs some useful debug information (stack trace
323 76769d2f Stavros Sachtouris
and http logs). Kamaki in debug mode cancels the suppression of warning
324 76769d2f Stavros Sachtouris
messages too.
325 f6822a26 Stavros Sachtouris
326 f6822a26 Stavros Sachtouris
To run kamaki in debug mode use the -d or --debug option.
327 f6822a26 Stavros Sachtouris
328 f6822a26 Stavros Sachtouris
329 f6822a26 Stavros Sachtouris
Verbose
330 f6822a26 Stavros Sachtouris
"""""""
331 f6822a26 Stavros Sachtouris
332 f6822a26 Stavros Sachtouris
Most kamaki commands are translated into http requests. Kamaki clients API
333 76769d2f Stavros Sachtouris
translates command semantics to REST and handles the response. Users who need
334 76769d2f Stavros Sachtouris
to have access to these commands can use the verbose mode that outputs the
335 76769d2f Stavros Sachtouris
HTTP Request and Response details along with the (possibly modified) regular
336 76769d2f Stavros Sachtouris
command output.
337 f6822a26 Stavros Sachtouris
338 76769d2f Stavros Sachtouris
To run kamaki in verbose mode use the *-v/- - verbose* argument, it goes with
339 76769d2f Stavros Sachtouris
everything.
340 f6822a26 Stavros Sachtouris
341 f6822a26 Stavros Sachtouris
Verbose mode outputs the request and response mode, address and
342 f6822a26 Stavros Sachtouris
headers as well as the size of the data block, if any. Sensitive information
343 f6822a26 Stavros Sachtouris
(x-auth-token header and data body) are omitted by default,. Users who need
344 f6822a26 Stavros Sachtouris
this information may enable it through the log_token and log_data configuration
345 76769d2f Stavros Sachtouris
options
346 f6822a26 Stavros Sachtouris
347 76769d2f Stavros Sachtouris
.. tip:: Use the -o argument to include http data in the output:
348 f6822a26 Stavros Sachtouris
349 f6822a26 Stavros Sachtouris
    .. code-block:: console
350 f6822a26 Stavros Sachtouris
351 f6822a26 Stavros Sachtouris
        $ kamaki server list -v -o log_data=on
352 904091dd Stavros Sachtouris
353 904091dd Stavros Sachtouris
354 904091dd Stavros Sachtouris
Logging
355 904091dd Stavros Sachtouris
"""""""
356 904091dd Stavros Sachtouris
357 76769d2f Stavros Sachtouris
Kamaki logs in a file specified by the *log_file* option which defaults to
358 76769d2f Stavros Sachtouris
*${HOME}/.kamaki.log*. This configuration option can be modified::
359 904091dd Stavros Sachtouris
360 904091dd Stavros Sachtouris
    kamaki config set log_file /new/log/file/path
361 904091dd Stavros Sachtouris
362 f6822a26 Stavros Sachtouris
Kamaki logs http request and response information, namely the method, URL,
363 f6822a26 Stavros Sachtouris
headers and data size. Sensitive information (data and token header) are
364 f6822a26 Stavros Sachtouris
omitted by default. There are some configuration options that can switch them
365 f6822a26 Stavros Sachtouris
on, though:
366 904091dd Stavros Sachtouris
367 f6822a26 Stavros Sachtouris
* HTTP data blocks are not logged by default
368 904091dd Stavros Sachtouris
    to enable logging the full http bodies, set log_data to `on`::
369 904091dd Stavros Sachtouris
370 904091dd Stavros Sachtouris
        kamaki config set log_data on
371 904091dd Stavros Sachtouris
372 904091dd Stavros Sachtouris
    to disable it, set it to `off`::
373 904091dd Stavros Sachtouris
374 904091dd Stavros Sachtouris
        kamaki config set log_data off
375 904091dd Stavros Sachtouris
376 904091dd Stavros Sachtouris
    or delete it::
377 904091dd Stavros Sachtouris
378 904091dd Stavros Sachtouris
        kamaki config delete log_data
379 904091dd Stavros Sachtouris
380 904091dd Stavros Sachtouris
* X-Auth-Token header is not logged by default
381 904091dd Stavros Sachtouris
    to enable logging the X-Auth-Token header, set log_token to `on`::
382 904091dd Stavros Sachtouris
383 904091dd Stavros Sachtouris
        kamaki config set log_token on
384 904091dd Stavros Sachtouris
385 904091dd Stavros Sachtouris
    to disable it, set it to `off`::
386 904091dd Stavros Sachtouris
387 904091dd Stavros Sachtouris
        kamaki config set log_token off
388 a6370d73 Stavros Sachtouris
389 904091dd Stavros Sachtouris
    or delete it::
390 a6370d73 Stavros Sachtouris
391 904091dd Stavros Sachtouris
        kamaki config delete log_token
392 a6370d73 Stavros Sachtouris
393 f6822a26 Stavros Sachtouris
* The information (pid, name, date) of the processes that handle http requests
394 f6822a26 Stavros Sachtouris
    is not logged by default, because if they are, logs are difficult to read.
395 f6822a26 Stavros Sachtouris
    Still, they are useful for resolving race condition problems, so to enable
396 f6822a26 Stavros Sachtouris
    logging proccess information::
397 a6370d73 Stavros Sachtouris
398 f6822a26 Stavros Sachtouris
        kamaki config set log_pid on
399 f6822a26 Stavros Sachtouris
400 f6822a26 Stavros Sachtouris
    to disable it, set if to off::
401 a6370d73 Stavros Sachtouris
402 f6822a26 Stavros Sachtouris
        kamaki config set log_pid off
403 f6822a26 Stavros Sachtouris
404 f6822a26 Stavros Sachtouris
    or delete it::
405 a6370d73 Stavros Sachtouris
406 f6822a26 Stavros Sachtouris
        kamaki config delete log_pid
407 79b4f177 Stavros Sachtouris
408 f3446cf0 Stavros Sachtouris
One-command features
409 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^
410 a6370d73 Stavros Sachtouris
411 a6370d73 Stavros Sachtouris
.. code-block:: console
412 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
413 f3446cf0 Stavros Sachtouris
414 904091dd Stavros Sachtouris
    Example 3.4.1: List the trash container contents, containing c1_
415 f3446cf0 Stavros Sachtouris
    
416 76769d2f Stavros Sachtouris
    $ kamaki file list -v -o log_token=on
417 76769d2f Stavros Sachtouris
    ...
418 76769d2f Stavros Sachtouris
    X-Auth-Token: s0m3-3x4mp1e-70k3n
419 76769d2f Stavros Sachtouris
    ...
420 a6370d73 Stavros Sachtouris
421 904091dd Stavros Sachtouris
The -o argument can be used to temporarily override various (set or unset)
422 904091dd Stavros Sachtouris
options. In one command, all -o option sets are forgotten just after the
423 904091dd Stavros Sachtouris
command has been completed, and the previous settings are restored (the
424 904091dd Stavros Sachtouris
configuration file is not modified).
425 a6370d73 Stavros Sachtouris
426 76769d2f Stavros Sachtouris
For security reasons, all commands hide the authentication token from outputs
427 76769d2f Stavros Sachtouris
and the logs. In example 3.4.1 the token is not hided, because of the
428 76769d2f Stavros Sachtouris
*log_token=on* config option.
429 457cb69b Stavros Sachtouris
430 76769d2f Stavros Sachtouris
.. warning:: Complimentary output i.e., http logs and informative messages are
431 76769d2f Stavros Sachtouris
  printed to standard error stream
432 f6822a26 Stavros Sachtouris
433 457cb69b Stavros Sachtouris
Interactive shell
434 7536c9bf Stavros Sachtouris
-----------------
435 f23a5cdb Stavros Sachtouris
436 f3446cf0 Stavros Sachtouris
Command Contexts
437 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^^^^
438 f3446cf0 Stavros Sachtouris
439 76769d2f Stavros Sachtouris
The command namespaces in kamaki interactive shell are called **contexts**.
440 76769d2f Stavros Sachtouris
441 76769d2f Stavros Sachtouris
Each command group is also a context where the users can **enter** by typing
442 76769d2f Stavros Sachtouris
the group name. If the context switch is successful, the kamaki shell prompt
443 f6822a26 Stavros Sachtouris
changes to present the new context ("*file*" in example 4.1.1).
444 f3446cf0 Stavros Sachtouris
445 f3446cf0 Stavros Sachtouris
.. code-block:: console
446 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
447 f3446cf0 Stavros Sachtouris
448 f6822a26 Stavros Sachtouris
    Example 4.1.1: Start kamaki and switch to file context
449 f3446cf0 Stavros Sachtouris
450 f3446cf0 Stavros Sachtouris
451 f3446cf0 Stavros Sachtouris
    $ kamaki
452 0ea31480 Stavros Sachtouris
    [kamaki]: file
453 0ea31480 Stavros Sachtouris
    [file]:
454 f3446cf0 Stavros Sachtouris
455 904091dd Stavros Sachtouris
Type **exit** (alternatively **ctrl-D** in (X)nix systems or **ctrl-Z** in
456 904091dd Stavros Sachtouris
Windows) to exit a context and return to the context of origin. If already at
457 904091dd Stavros Sachtouris
the top context (kamaki), an exit is equivalent to exiting the program.
458 f3446cf0 Stavros Sachtouris
459 f3446cf0 Stavros Sachtouris
.. code-block:: console
460 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
461 f3446cf0 Stavros Sachtouris
462 0ea31480 Stavros Sachtouris
    Example 4.1.2: Exit file context and then exit kamaki
463 f3446cf0 Stavros Sachtouris
464 0ea31480 Stavros Sachtouris
    [file]: exit
465 f3446cf0 Stavros Sachtouris
    [kamaki]: exit
466 f3446cf0 Stavros Sachtouris
    $
467 f3446cf0 Stavros Sachtouris
468 f3446cf0 Stavros Sachtouris
A user might **browse** through different contexts during one session.
469 f3446cf0 Stavros Sachtouris
470 f3446cf0 Stavros Sachtouris
.. code-block:: console
471 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
472 f3446cf0 Stavros Sachtouris
473 2151584b Stavros Sachtouris
    Example 4.1.3: Execute list command in different contexts
474 f3446cf0 Stavros Sachtouris
475 f3446cf0 Stavros Sachtouris
    $ kamaki
476 79b4f177 Stavros Sachtouris
    [kamaki]: config
477 79b4f177 Stavros Sachtouris
    [config]: list
478 f3446cf0 Stavros Sachtouris
    ... (configuration options listing) ...
479 79b4f177 Stavros Sachtouris
    [config]: exit
480 0ea31480 Stavros Sachtouris
    [kamaki]: file
481 0ea31480 Stavros Sachtouris
    [file]: list
482 76769d2f Stavros Sachtouris
    ... (file listing) ...
483 0ea31480 Stavros Sachtouris
    [file]: exit
484 79b4f177 Stavros Sachtouris
    [kamaki]: server
485 79b4f177 Stavros Sachtouris
    [server]: list
486 2bd23362 Stavros Sachtouris
    ... (servers listing) ...
487 f3446cf0 Stavros Sachtouris
    [server]: exit
488 f3446cf0 Stavros Sachtouris
    [kamaki]:
489 f3446cf0 Stavros Sachtouris
490 76769d2f Stavros Sachtouris
Users can avoid switching between contexts: all commands can run from the
491 76769d2f Stavros Sachtouris
**top context** e.g., examples 4.1.3 and 4.1.4 are equivalent.
492 f3446cf0 Stavros Sachtouris
493 f3446cf0 Stavros Sachtouris
.. code-block:: console
494 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
495 f3446cf0 Stavros Sachtouris
496 2151584b Stavros Sachtouris
    Example 4.1.4: Execute different "list" commands from top context
497 f3446cf0 Stavros Sachtouris
498 79b4f177 Stavros Sachtouris
    [kamaki]: config list
499 f3446cf0 Stavros Sachtouris
    ... (configuration options listing) ...
500 0ea31480 Stavros Sachtouris
    [kamaki]: file list
501 76769d2f Stavros Sachtouris
    ... (file listing) ...
502 79b4f177 Stavros Sachtouris
    [kamaki]: server list
503 2bd23362 Stavros Sachtouris
    ... (servers listing) ...
504 f3446cf0 Stavros Sachtouris
    [kamaki]:
505 f3446cf0 Stavros Sachtouris
506 76769d2f Stavros Sachtouris
While in a context, other contexts are accessible by using a **/** as shown in
507 76769d2f Stavros Sachtouris
the following example:
508 76769d2f Stavros Sachtouris
509 76769d2f Stavros Sachtouris
.. code-block:: console
510 76769d2f Stavros Sachtouris
511 76769d2f Stavros Sachtouris
  Example 4.1.5: Execute different "list" commands from the config context
512 76769d2f Stavros Sachtouris
513 76769d2f Stavros Sachtouris
  [kamaki]: config
514 76769d2f Stavros Sachtouris
  [config]: list
515 76769d2f Stavros Sachtouris
  ... (configuration option listing) ...
516 76769d2f Stavros Sachtouris
  [config]: /file list
517 76769d2f Stavros Sachtouris
  ... (file listing) ...
518 76769d2f Stavros Sachtouris
  [config]: /server list
519 76769d2f Stavros Sachtouris
  ... (servers listing) ...
520 76769d2f Stavros Sachtouris
  [config]:
521 76769d2f Stavros Sachtouris
522 7536c9bf Stavros Sachtouris
Using Help
523 7536c9bf Stavros Sachtouris
^^^^^^^^^^
524 f3446cf0 Stavros Sachtouris
525 f3446cf0 Stavros Sachtouris
There are two help mechanisms: a context-level and a command-level.
526 f3446cf0 Stavros Sachtouris
527 904091dd Stavros Sachtouris
**Context-level help** lists the available commands in a context and can also
528 904091dd Stavros Sachtouris
offer a short description for each command.
529 f3446cf0 Stavros Sachtouris
530 f3446cf0 Stavros Sachtouris
Context-level help syntax::
531 f3446cf0 Stavros Sachtouris
532 f3446cf0 Stavros Sachtouris
    * Show available commands in current context *
533 79b4f177 Stavros Sachtouris
    [context]: help
534 f6822a26 Stavros Sachtouris
    ...
535 79b4f177 Stavros Sachtouris
    [context]: ?
536 f6822a26 Stavros Sachtouris
    ...
537 f3446cf0 Stavros Sachtouris
538 f3446cf0 Stavros Sachtouris
    * Show help for command cmd *
539 79b4f177 Stavros Sachtouris
    [context]: help cmd
540 f6822a26 Stavros Sachtouris
    ...
541 79b4f177 Stavros Sachtouris
    [context]: ?cmd
542 f6822a26 Stavros Sachtouris
    ...
543 f3446cf0 Stavros Sachtouris
544 904091dd Stavros Sachtouris
The context-level help results may change from context to context
545 f3446cf0 Stavros Sachtouris
546 f3446cf0 Stavros Sachtouris
.. code-block:: console
547 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
548 f3446cf0 Stavros Sachtouris
549 904091dd Stavros Sachtouris
    Example 4.2.1: Get available commands and then get help in a context
550 f3446cf0 Stavros Sachtouris
551 79b4f177 Stavros Sachtouris
    [kamaki]: help
552 f3446cf0 Stavros Sachtouris
553 f3446cf0 Stavros Sachtouris
    kamaki commands:
554 f3446cf0 Stavros Sachtouris
    ================
555 f6822a26 Stavros Sachtouris
    user  config  flavor  history  image  network  server  file ...
556 f3446cf0 Stavros Sachtouris
557 f3446cf0 Stavros Sachtouris
    interactive shell commands:
558 f3446cf0 Stavros Sachtouris
    ===========================
559 f3446cf0 Stavros Sachtouris
    exit  help  shell
560 f3446cf0 Stavros Sachtouris
561 79b4f177 Stavros Sachtouris
    [kamaki]: ?config
562 f3446cf0 Stavros Sachtouris
    Configuration commands (config -h for more options)
563 f3446cf0 Stavros Sachtouris
564 79b4f177 Stavros Sachtouris
    [kamaki]: config
565 f3446cf0 Stavros Sachtouris
566 79b4f177 Stavros Sachtouris
    [config]: ?
567 f3446cf0 Stavros Sachtouris
568 f3446cf0 Stavros Sachtouris
    config commands:
569 f3446cf0 Stavros Sachtouris
    ================
570 f3446cf0 Stavros Sachtouris
    delete  get  list  set
571 f3446cf0 Stavros Sachtouris
572 f3446cf0 Stavros Sachtouris
    interactive shell commands:
573 f3446cf0 Stavros Sachtouris
    ===========================
574 f3446cf0 Stavros Sachtouris
    exit  help  shell
575 f3446cf0 Stavros Sachtouris
576 79b4f177 Stavros Sachtouris
    [config]: help set
577 f3446cf0 Stavros Sachtouris
    Set a configuration option (set -h for more options)
578 f3446cf0 Stavros Sachtouris
579 904091dd Stavros Sachtouris
In context-level, there is a distinction between kamaki-commands and
580 904091dd Stavros Sachtouris
interactive shell commands. The former are available in one-command mode and
581 76769d2f Stavros Sachtouris
are the main functionality of kamaki, while the later are used to manage the
582 76769d2f Stavros Sachtouris
kamaki-shell.
583 f3446cf0 Stavros Sachtouris
584 904091dd Stavros Sachtouris
**Command-level help** prints the syntax, arguments and description of a
585 904091dd Stavros Sachtouris
specific (terminal) command
586 f3446cf0 Stavros Sachtouris
587 f3446cf0 Stavros Sachtouris
Command-level help syntax::
588 f3446cf0 Stavros Sachtouris
589 f3446cf0 Stavros Sachtouris
    * Get help for command cmd1 cmd2 ... cmdN *
590 79b4f177 Stavros Sachtouris
    [context]: cmd1 cmd2 ... cmdN -h
591 f3446cf0 Stavros Sachtouris
    <syntax>
592 f3446cf0 Stavros Sachtouris
593 f3446cf0 Stavros Sachtouris
    <description>
594 f3446cf0 Stavros Sachtouris
595 7536c9bf Stavros Sachtouris
    <arguments and possible extensions>
596 f3446cf0 Stavros Sachtouris
597 904091dd Stavros Sachtouris
Command-level help mechanism is exactly the same as the one used in
598 904091dd Stavros Sachtouris
one-command mode. For example, it is invoked by using the -h or --help
599 904091dd Stavros Sachtouris
parameter at any point.
600 f3446cf0 Stavros Sachtouris
601 f3446cf0 Stavros Sachtouris
.. code-block:: console
602 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
603 f3446cf0 Stavros Sachtouris
604 2151584b Stavros Sachtouris
    Example 4.2.2: Get command-level help for config and config-set
605 f3446cf0 Stavros Sachtouris
606 f3446cf0 Stavros Sachtouris
607 79b4f177 Stavros Sachtouris
    [kamaki]: config --help
608 f3446cf0 Stavros Sachtouris
    config: Configuration commands
609 f3446cf0 Stavros Sachtouris
    delete:  Delete a configuration option (and use the default value)
610 f3446cf0 Stavros Sachtouris
    get   :  Show a configuration option
611 f3446cf0 Stavros Sachtouris
    list  :  List configuration options
612 f3446cf0 Stavros Sachtouris
    set   :  Set a configuration option
613 f3446cf0 Stavros Sachtouris
614 79b4f177 Stavros Sachtouris
    [kamaki]: config
615 f3446cf0 Stavros Sachtouris
616 79b4f177 Stavros Sachtouris
    [config]: set -h
617 f3446cf0 Stavros Sachtouris
    usage: set <option> <value> [-v] [-d] [-h] [-i] [--config CONFIG] [-s]
618 f3446cf0 Stavros Sachtouris
619 f3446cf0 Stavros Sachtouris
    Set a configuration option
620 f3446cf0 Stavros Sachtouris
621 f3446cf0 Stavros Sachtouris
    optional arguments:
622 f3446cf0 Stavros Sachtouris
      -v, --verbose    More info at response
623 f3446cf0 Stavros Sachtouris
      -d, --debug      Include debug output
624 f3446cf0 Stavros Sachtouris
      -h, --help       Show help message
625 f3446cf0 Stavros Sachtouris
      -i, --include    Include protocol headers in the output
626 f3446cf0 Stavros Sachtouris
      --config CONFIG  Path to configuration file
627 f3446cf0 Stavros Sachtouris
      -s, --silent     Do not output anything
628 f3446cf0 Stavros Sachtouris
629 2151584b Stavros Sachtouris
There are many ways of producing a help message, as shown in example 4.2.3
630 f3446cf0 Stavros Sachtouris
631 f3446cf0 Stavros Sachtouris
.. code-block:: console
632 f3446cf0 Stavros Sachtouris
    :emphasize-lines: 1
633 f3446cf0 Stavros Sachtouris
634 2151584b Stavros Sachtouris
    Example 4.2.3: Equivalent calls of command-level help for config-set
635 f3446cf0 Stavros Sachtouris
636 f3446cf0 Stavros Sachtouris
637 79b4f177 Stavros Sachtouris
    [config]: set -h
638 79b4f177 Stavros Sachtouris
    [config]: set --help
639 79b4f177 Stavros Sachtouris
    [kamaki]: config set -h
640 79b4f177 Stavros Sachtouris
    [kamaki]: config set --help
641 0ea31480 Stavros Sachtouris
    [file]: /config set -h
642 79b4f177 Stavros Sachtouris
    [server]: /config set --help
643 f3446cf0 Stavros Sachtouris
644 f6822a26 Stavros Sachtouris
History modes
645 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^
646 f3446cf0 Stavros Sachtouris
647 904091dd Stavros Sachtouris
There are two history modes: session and permanent. Session history keeps
648 904091dd Stavros Sachtouris
record of all actions in a kamaki shell session, while permanent history
649 904091dd Stavros Sachtouris
appends all commands to an accessible history file.
650 e5d1d5c2 Stavros Sachtouris
651 904091dd Stavros Sachtouris
Session history is only available in interactive shell mode. Users can iterate
652 904091dd Stavros Sachtouris
through past commands in the same session with the ↑ and ↓ keys. Session
653 f6822a26 Stavros Sachtouris
history is not stored, although commands are recorded through the permanent
654 f6822a26 Stavros Sachtouris
history mechanism.
655 e5d1d5c2 Stavros Sachtouris
656 904091dd Stavros Sachtouris
Permanent history is implemented as a command group and is common to both the
657 f6822a26 Stavros Sachtouris
one-command and shell interfaces. In specific, every command is appended in a
658 f6822a26 Stavros Sachtouris
history file (configured as `history_file` in settings, see
659 f6822a26 Stavros Sachtouris
`setup section <setup.html>`_ for details). Commands executed in one-command
660 f6822a26 Stavros Sachtouris
mode are mixed with the ones run in kamaki shell (also see
661 f6822a26 Stavros Sachtouris
:ref:`using-history-ref` section on this guide).
662 e5d1d5c2 Stavros Sachtouris
663 ee9f8245 Stavros Sachtouris
Scripting
664 ee9f8245 Stavros Sachtouris
^^^^^^^^^
665 ee9f8245 Stavros Sachtouris
666 904091dd Stavros Sachtouris
The history-run feature allows the sequential run of previous command
667 904091dd Stavros Sachtouris
executions in kamaki shell.
668 ee9f8245 Stavros Sachtouris
669 904091dd Stavros Sachtouris
The following sequence copies and downloads a file from *mycontainer1* ,
670 904091dd Stavros Sachtouris
uploads it to *mycontainer2* , then undo the proccess and repeats it with
671 904091dd Stavros Sachtouris
history-run
672 ee9f8245 Stavros Sachtouris
673 ee9f8245 Stavros Sachtouris
.. code-block:: console
674 ee9f8245 Stavros Sachtouris
    :emphasize-lines: 1,12,19,32
675 ee9f8245 Stavros Sachtouris
676 f6822a26 Stavros Sachtouris
    * Download mycontainer1:myfile and upload it to mycontainer2:myfile *
677 0ea31480 Stavros Sachtouris
    [kamaki]: file
678 76769d2f Stavros Sachtouris
    [file]: copy /mycontainer1/somefile /mycontainer1/myfile
679 76769d2f Stavros Sachtouris
    [file]: download /mycontainer1/myfile mylocalfile
680 f6822a26 Stavros Sachtouris
    ...
681 ee9f8245 Stavros Sachtouris
    Download completed
682 76769d2f Stavros Sachtouris
    [file]: upload mylocalfile /mycontainer2/myfile -f
683 f6822a26 Stavros Sachtouris
    ...
684 ee9f8245 Stavros Sachtouris
    Upload completed
685 ee9f8245 Stavros Sachtouris
686 ee9f8245 Stavros Sachtouris
    * undo the process *
687 0ea31480 Stavros Sachtouris
    [file]: !rm mylocalfile
688 76769d2f Stavros Sachtouris
    [file]: delete /mycontainer1/myfile
689 76769d2f Stavros Sachtouris
    [file]: delete /mycontainer2/myfile
690 ee9f8245 Stavros Sachtouris
691 ee9f8245 Stavros Sachtouris
    * check history entries *
692 0ea31480 Stavros Sachtouris
    [file]: exit
693 ee9f8245 Stavros Sachtouris
    [kamaki]: history
694 ee9f8245 Stavros Sachtouris
    [history]: show
695 0ea31480 Stavros Sachtouris
    1.  file
696 76769d2f Stavros Sachtouris
    2.  file copy /mycontainer1/somefile /mycontainer1/myfile
697 76769d2f Stavros Sachtouris
    3.  file download /mycontainer1/myfile mylocalfile
698 76769d2f Stavros Sachtouris
    4.  file upload mylocalfile /mycontainer2/myfile -f
699 76769d2f Stavros Sachtouris
    5.  file delete /mycontainer1/myfile
700 76769d2f Stavros Sachtouris
    6.  file delete /mycontainer2/myfile
701 79b4f177 Stavros Sachtouris
    7.  history
702 79b4f177 Stavros Sachtouris
    8.  history show
703 ee9f8245 Stavros Sachtouris
704 ee9f8245 Stavros Sachtouris
    *repeat the process *
705 68ab0942 Stavros Sachtouris
    [history]: run 2-4
706 76769d2f Stavros Sachtouris
    <file copy /mycontainer1/somefile /mycontainer1/myfile>
707 76769d2f Stavros Sachtouris
    <file download /mycontainer1/myfile mylocalfile>
708 ee9f8245 Stavros Sachtouris
    Download completed
709 76769d2f Stavros Sachtouris
    <file upload mylocalfile /mycontainer2/myfile>
710 ee9f8245 Stavros Sachtouris
    Upload completed
711 ee9f8245 Stavros Sachtouris
712 76769d2f Stavros Sachtouris
The suggested best practice for scripting is python scripts that import the
713 76769d2f Stavros Sachtouris
`kamaki.clients` library. Another option is host shell scripting (e.g., bash)
714 76769d2f Stavros Sachtouris
with kamaki one-command. Still, the history-run functionality might prove handy
715 76769d2f Stavros Sachtouris
in many occasions.
716 ee9f8245 Stavros Sachtouris
717 f3446cf0 Stavros Sachtouris
OS Shell integration
718 7536c9bf Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^
719 b8e90894 Stavros Sachtouris
720 904091dd Stavros Sachtouris
Kamaki shell features the ability to execute OS-shell commands from any
721 904091dd Stavros Sachtouris
context. This can be achieved by typing *!* or *shell*::
722 e5d1d5c2 Stavros Sachtouris
723 79b4f177 Stavros Sachtouris
    [kamaki_context]: !<OS shell command>
724 e5d1d5c2 Stavros Sachtouris
    ... OS shell command output ...
725 e5d1d5c2 Stavros Sachtouris
726 79b4f177 Stavros Sachtouris
    [kamaki_context]: shell <OS shell command>
727 e5d1d5c2 Stavros Sachtouris
    ... OS shell command output ...
728 e5d1d5c2 Stavros Sachtouris
729 e5d1d5c2 Stavros Sachtouris
.. code-block:: console
730 e5d1d5c2 Stavros Sachtouris
    :emphasize-lines: 1
731 e5d1d5c2 Stavros Sachtouris
732 2151584b Stavros Sachtouris
    Example 4.7.1: Run unix-style shell commands from kamaki shell
733 e5d1d5c2 Stavros Sachtouris
734 e5d1d5c2 Stavros Sachtouris
735 79b4f177 Stavros Sachtouris
    [kamaki]: !ls -al
736 e5d1d5c2 Stavros Sachtouris
    total 16
737 59cadffb Stavros Sachtouris
    drwxrwxr-x 2 username username 4096 Nov 27 16:47 .
738 59cadffb Stavros Sachtouris
    drwxrwxr-x 7 username username 4096 Nov 27 16:47 ..
739 59cadffb Stavros Sachtouris
    -rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png
740 e5d1d5c2 Stavros Sachtouris
741 79b4f177 Stavros Sachtouris
    [kamaki]: shell cp kamaki-logo.png logo-copy.png
742 e5d1d5c2 Stavros Sachtouris
743 79b4f177 Stavros Sachtouris
    [kamaki]: shell ls -al
744 e5d1d5c2 Stavros Sachtouris
    total 24
745 59cadffb Stavros Sachtouris
    drwxrwxr-x 2 username username 4096 Nov 27 16:47 .
746 59cadffb Stavros Sachtouris
    drwxrwxr-x 7 username username 4096 Nov 27 16:47 ..
747 59cadffb Stavros Sachtouris
    -rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png
748 59cadffb Stavros Sachtouris
    -rw-rw-r-- 1 username username 8063 Jun 28 14:48 logo-copy.png
749 e5d1d5c2 Stavros Sachtouris
750 e5d1d5c2 Stavros Sachtouris
751 904091dd Stavros Sachtouris
Kamaki shell commits command strings to the outside shell and prints the
752 904091dd Stavros Sachtouris
results, without interacting with it. After a command is finished, kamaki shell
753 f6822a26 Stavros Sachtouris
returns to its initial state, which involves the current directory, as shown in
754 904091dd Stavros Sachtouris
example 4.8.2
755 e5d1d5c2 Stavros Sachtouris
756 e5d1d5c2 Stavros Sachtouris
.. code-block:: console
757 e5d1d5c2 Stavros Sachtouris
    :emphasize-lines: 1
758 e5d1d5c2 Stavros Sachtouris
759 ee9f8245 Stavros Sachtouris
    Example 4.8.2: Attempt (and fail) to change working directory
760 e5d1d5c2 Stavros Sachtouris
761 e5d1d5c2 Stavros Sachtouris
762 79b4f177 Stavros Sachtouris
    [kamaki]: !pwd
763 e5d1d5c2 Stavros Sachtouris
    /home/username
764 e5d1d5c2 Stavros Sachtouris
765 79b4f177 Stavros Sachtouris
    [kamaki]: !cd ..
766 e5d1d5c2 Stavros Sachtouris
767 79b4f177 Stavros Sachtouris
    [kamaki]: shell pwd
768 e5d1d5c2 Stavros Sachtouris
    /home/username