Revision f084bdc8

b/docs/examplesdir/imageregister.rst
24 24
Let the image file `debian_base3.diskdump` be a debian image located at the
25 25
current local directory.
26 26

  
27
Upload the image to container `pithos`
27
Upload the image to container `images`
28 28

  
29 29
.. code-block:: console
30 30

  
31
    $ kamaki file upload debian_base3.diskdump pithos
31
    $ kamaki file upload debian_base3.diskdump /images
32 32

  
33 33
Register the image object with the name 'Debian Base Alpha'
34 34

  
35 35
.. code-block:: console
36 36

  
37
    kamaki image register 'Debian Base Alpha' pithos:debian_base3.diskdump
37
    kamaki image register --name 'Debian Base Alpha' --location=/images/debian_base3.diskdump
38 38
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
39 39
    container-format: bare
40 40
    created-at:       2013-06-19 08:00:22
......
42 42
    disk-format:      diskdump
43 43
    id:               7h1rd-1m4g3-1d
44 44
    is-public:        False
45
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
45
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
46 46
    name:             Debian Base Alpha
47 47
    owner:            s0m3-u53r-1d
48 48
    properties:
49 49
    size:             903471104
50 50
    status:           available
51 51
    updated-at:       2013-06-19 08:01:00
52
    Metadata file uploaded as pithos:debian_base3.diskdump.meta (version 1352)
53
    [kamaki]:
52
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1352)
54 53

  
55 54
.. warning:: The image created by the above command will not be able to create
56 55
    a working virtual server, although the registration will be successful. In
......
70 69

  
71 70
.. code-block:: console
72 71

  
73
        [kamaki]: image register 'Debian Base Alpha'
74
            pithos:debian_base3.diskdump
75
            --upload-image-file='debian_base3.diskdump'
76
        [kamaki]:
72
        kamaki image register --name='Debian Base Alpha'
73
            --location=/images/debian_base3.diskdump
74
            --upload-image-file=debian_base3.diskdump
77 75

  
78 76

  
79 77
Read the metafile
80 78

  
81 79
.. code-block:: console
82 80

  
83
    [kamaki]: file cat pithos:debian_base3.diskdump.meta
81
    kamaki file cat /images/debian_base3.diskdump.meta
84 82
    {
85 83
      "status": "available",
86 84
      "name": "Debian Base Gama",
......
89 87
      "updated-at": "2013-06-19 08:01:00",
90 88
      "created-at": "2013-06-19 08:00:22",
91 89
      "properties": {},
92
      "location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
90
      "location": "pithos://s0m3-u53r-1d/images/debian_base3.diskdump",
93 91
      "is-public": "False",
94 92
      "owner": "s0m3-u53r-1d",
95 93
      "disk-format": "diskdump",
......
97 95
      "deleted-at": "",
98 96
      "container-format": "bare"
99 97
    }
100
    [kamaki]:
101 98

  
102 99
Images registered by me
103 100
-----------------------
......
106 103

  
107 104
.. code-block:: console
108 105

  
109
    [kamaki]: image list
106
    kamaki image list
110 107
    f1r57-1m4g3-1d Debian Base Alpha
111 108
        container_format: bare
112 109
        disk_format:      diskdump
......
122 119
        disk_format:      diskdump
123 120
        size:             474066944
124 121
        status:           available
125
    [kamaki]: image list --owner=s0m3-u53r-1d
122
    kamaki image list --owner=s0m3-u53r-1d
126 123
    7h1rd-1m4g3-1d Debian Base Gama
127 124
        container_format: bare
128 125
        disk_format:      diskdump
129 126
        size:             474066944
130 127
        status:           available
131
    [kamaki]:
132 128

  
133
.. note:: To get the current user id, use `user authenticate` in kamaki
129
.. note:: To get the current user id, use `kamaki user info`
134 130

  
135 131
Unregister an image
136 132
-------------------
......
143 139

  
144 140
.. code-block:: console
145 141

  
146
    [kamaki]: image unregister 7h1rd-1m4g3-1d
147
    [kamaki]:
142
    kamaki image unregister 7h1rd-1m4g3-1d
148 143

  
149 144
Check if the image is deleted
150 145

  
151 146
.. code-block:: console
152 147

  
153
    [kamaki]: image list --owner=s0m3-u53r-1d
154
    [kamaki]:
148
    kamaki image list --owner=s0m3-u53r-1d
155 149

  
156 150
Attempt to unregister an image of another user
157 151

  
158 152
.. code-block:: console
159 153

  
160
    [kamaki]: image unregister f1r57-1m4g3-1d
154
    kamaki image unregister f1r57-1m4g3-1d
161 155
    (403) FORBIDDEN forbidden ()
162
    [kamaki]:
163 156

  
164 157
Register with properties
165 158
------------------------
......
174 167
    OSFAMILY: linux
175 168
    USER: someuser
176 169

  
177
These properties can be added freely by the user, and they are not required by
178
the image server, but they can be used by many applications.
179
Attempt to register an image with custom properties
170
In theory, these properties can be added freely by the user, and they are not
171
required by the image server. In practice, some properties are absolutely
172
vital for an image to be useful, although not necessary for registration.
173
An attempt to register an image with custom properties:
180 174

  
181 175
.. code-block:: console
182 176

  
183
    [kamaki]: image register 'Debian Base Gama' pithos:debian_base3.diskdump -p OS=linux -p user=someuser
184
    Metadata file pithos:debian_base3.diskdump.meta already exists
185
    [kamaki]:
177
    kamaki image register --name='Debian Base Gama' --location=/images/debian_base3.diskdump -p OS=linux -p user=someuser
178
    Metadata file /images/debian_base3.diskdump.meta already exists
186 179

  
187 180
It's true that a metafile with this name is already there, but we can override
188 181
it (**-f**)
189 182

  
190 183
.. code-block:: console
191 184

  
192
    [kamaki]: image register -f 'Debian Base Gama' pithos:debian_base3.diskdump -p OS=linux -p user=someuser
193
    [kamaki]:
185
    kamaki image register -f --name='Debian Base Gama' --location=/images/debian_base3.diskdump -p OS=linux -p user=someuser
194 186

  
195 187
Register with a meta file
196 188
-------------------------
......
199 191

  
200 192
.. code-block:: console
201 193

  
202
    [kamaki]: file download pithos:debian_base3.diskdump.meta
203
    Downloading pithos:debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta
194
    kamaki file download /images/debian_base3.diskdump.meta
195
    Downloading /images/debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta
204 196
    Done
205
    [kamaki]:
206 197

  
207 198
The metadata file can be edited. Let's edit the file to add these properties::
208 199

  
......
224 215
        "OS": "linux",
225 216
        "USER": "root"
226 217
      },
227
      "location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
218
      "location": "pithos://s0m3-u53r-1d/images/debian_base3.diskdump",
228 219
      "is-public": "False",
229 220
      "owner": "s0m3-u53r-1d",
230 221
      "disk-format": "diskdump",
......
242 233

  
243 234
.. code-block:: console
244 235

  
245
    [kamaki]: image register -f 'Debian Base Delta' pithos:debian_base3.diskdump --metafile=debian_base3.diskdump.meta
236
    kamaki image register -f --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta
246 237
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
247 238
    container-format: bare
248 239
    created-at:       2013-06-19 08:00:22
......
250 241
    disk-format:      diskdump
251 242
    id:               7h1rd-1m4g3-1d
252 243
    is-public:        False
253
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
244
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
254 245
    name:             Debian Base Delta
255 246
    owner:            s0m3-u53r-1d
256 247
    properties:
......
259 250
    size:             903471104
260 251
    status:           available
261 252
    updated-at:       2013-06-19 08:01:00
262
    Metadata file uploaded as pithos:debian_base3.diskdump.meta (version 1359)
263
    [kamaki]:
253
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1359)
264 254

  
265 255
Metadata and Property modification
266 256
----------------------------------
267 257

  
268
Image metadata and custom properties can be modified even after the image is
269
registered. Metadata are fixed image attributes, like name, disk format etc.
270
while custom properties are set by the image owner and, usually, refer to
271
attributes of the images OS.
258
According to the OpenStack terminology, the terms **metadata** and
259
**properties** are two different thinks, if we talk about images. **Metadata**
260
are all kinds of named metadata on an image. Some of them are assigned by the
261
system, some others are custom and set by the users who register the image.
262
These custom **metadata** are called **properties**.
263

  
264
Image **metadata** and custom **properties** can be modified even after the
265
image is registered. Metadata are fixed image attributes, like name, disk
266
format etc. while custom properties are set by the image owner and, usually,
267
refer to attributes of the images OS.
272 268

  
273 269
Let's rename the image:
274 270

  
275 271
.. code-block:: console
276 272

  
277
    [kamaki]: image meta set 7h1rd-1m4g3-1d --name='Changed Name'
278
    [kamaki]:
273
    kamaki image modify 7h1rd-1m4g3-1d --name='Changed Name'
279 274

  
280 275
A look at the image metadata reveals that the name is changed:
281 276

  
282 277
.. code-block:: console
283 278

  
284
    [kamaki]: image info 7h1rd-1m4g3-1d
279
    kamaki image info 7h1rd-1m4g3-1d
285 280
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
286 281
    container-format: bare
287 282
    created-at:       2013-06-19 08:00:22
......
289 284
    disk-format:      diskdump
290 285
    id:               7h1rd-1m4g3-1d
291 286
    is-public:        False
292
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
287
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
293 288
    name:             Changed Name
294 289
    owner:            s0m3-u53r-1d
295 290
    properties:
......
298 293
    size:             903471104
299 294
    status:           available
300 295
    updated-at:       2013-06-19 08:01:00
301
    [kamaki]:
296
    kamaki
302 297

  
303 298
We can use the same idea to change the values of other metadata like disk
304 299
format, container format or status. On the other hand, we cannot modify the
......
306 301

  
307 302
.. code-block:: console
308 303

  
309
    [kamaki]: image meta set 7h1rd-1m4g3-1d --publish --name='Debian Base Gama'
310
    [kamaki]: image meta set 7h1rd-1m4g3-1d --unpublish
311
    [kamaki]:
304
    kamaki image modify 7h1rd-1m4g3-1d --publish --name='Debian Base Gama'
305
    kamaki image modify 7h1rd-1m4g3-1d --unpublish
312 306

  
313 307
The first call publishes the image (set is-public to True) and also restores
314 308
the name to "Debian Base Gama". The second one unpublishes the image (set
315 309
is-public to False).
316 310

  
317
To delete metadata, use the image meta delete method. For example, the
318
following will set the value of *status* to an empty string:
319

  
320
.. code-block:: console
321

  
322
    [kamaki]: image meta delete 7h1rd-1m4g3-1d status
323
    [kamaki]:
324

  
325

  
326 311
These operations can be used for properties with the same semantics:
327 312

  
328 313
.. code-block:: console
329 314

  
330
    [kamaki]: image meta set 7h1rd-1m4g3-1d -p user=user
331
    [kamaki]: image info 7h1rd-1m4g3-1d
315
    kamaki image modify 7h1rd-1m4g3-1d -p user=user
316
    kamaki image info 7h1rd-1m4g3-1d
332 317
    ...
333 318
    properties:
334 319
            OS:     linux
335 320
            USER:   user
336 321
    ...
337
    [kamaki]:
322
    kamaki
338 323

  
339 324
Just to test the feature, let's create a property "greet" with value
340 325
"hi there", and then remove it. Also, let's restore the value of USER:
341 326

  
342 327
.. code-block:: console
343 328

  
344
    [kamaki]: image meta set 7h1rd-1m4g3-1d -p greet='Hi there' -p user=root
345
    [kamaki]: image info 7h1rd-1m4g3-1d
329
    kamaki image modify 7h1rd-1m4g3-1d -p greet='Hi there' -p user=root
330
    kamaki image info 7h1rd-1m4g3-1d
346 331
    ...
347 332
    properties:
348 333
            OS:     linux
349 334
            USER:   root
350 335
            GREET:  Hi there
351 336
    ...
352
    [kamaki]: image meta delete 7h1rd-1m4g3-1d -p greet
353
    [kamaki]: image info 7h1rd-1m4g3-1d
337
    kamaki image modify 7h1rd-1m4g3-1d -p greet=
338
    kamaki image info 7h1rd-1m4g3-1d
354 339
    ...
355 340
    properties:
356 341
            OS:     linux
357 342
            USER:   root
358 343
    ...
359
    [kamaki]:
344
    kamaki
360 345

  
361 346

  
362 347
Reregistration: priorities and overrides
......
393 378

  
394 379
.. code-block:: console
395 380

  
396
    [kamaki]: image register -f 'Debian Base Delta' pithos:debian_base3.diskdump --metafile=debian_base3.diskdump.meta
381
    kamaki image register -f --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta
397 382
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
398 383
    container-format: bare
399 384
    created-at:       2013-06-19 08:00:22
......
401 386
    disk-format:      diskdump
402 387
    id:               7h1rd-1m4g3-1d
403 388
    is-public:        False
404
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
389
    location:         pithos://s0me-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
405 390
    name:             Debian Base Delta
406 391
    owner:            s0m3-u53r-1d
407 392
    properties:
......
410 395
    size:             903471104
411 396
    status:           available
412 397
    updated-at:       2013-06-19 08:01:00
413
    Metadata file uploaded as pithos:debian_base3.diskdump.meta (version 1377)
414
    [kamaki]:
398
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1377)
399
    kamaki
415 400

  
416 401
Although the property `OS` was read from the metafile, the property `USER` was
417 402
set by the command line property to `admin`.
......
428 413

  
429 414
    .. code-block:: console
430 415

  
431
        [kamaki]: file versioning get pithos
416
        kamaki container info images | grep versioning
432 417
        x-container-policy-versioning: auto
433
        [kamaki]:
434 418

  
435 419
    To set versioning to auto
436 420

  
437 421
    .. code-block:: console
438 422

  
439
        [kamaki]: file versioning set auto pithos
440
        [kamaki]:
423
        kamaki container modify images --versioning=auto
441 424

  
442 425
In the above examples, the image was registered many times by overriding the
443 426
metafile. It is possible to avoid writing a metafile, as well as accessing
......
447 430

  
448 431
.. code-block:: console
449 432

  
450
    [kamaki]: image register 'Debian Base Delta' pithos:debian_base3.diskdump --metafile=debian_base3.diskdump.meta --no-metafile-upload
433
    kamaki image register --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta --no-metafile-upload
451 434
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
452 435
    container-format: bare
453 436
    created-at:       2013-06-19 08:00:22
......
455 438
    disk-format:      diskdump
456 439
    id:               7h1rd-1m4g3-1d
457 440
    is-public:        False
458
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
441
    location:         pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
459 442
    name:             Debian Base Delta
460 443
    owner:            s0m3-u53r-1d
461 444
    properties:
......
464 447
    size:             903471104
465 448
    status:           available
466 449
    updated-at:       2013-06-19 08:01:00
467
    [kamaki]:
450
    kamaki
468 451

  
469 452
Uploaded metafiles are kept in versions, thanks to Pithos+ versioning support
470 453

  
471 454
.. code-block:: console
472 455

  
473
    [kamaki]: file versions pithos:debian_base3.diskdump.meta
456
    kamaki file info /images/debian_base3.diskdump.meta --object-versions
474 457
    1352
475 458
     created: 19-06-2013 11:00:22
476 459
    1359
477 460
     created: 19-06-2013 11:01:00
478 461
    1377
479 462
     created: 19-06-2013 11:34:37
480
    [kamaki]:
463
    kamaki
481 464

  
482 465
Consult the first version of the metafile
483 466

  
484 467
.. code-block:: console
485 468

  
486
    [kamaki]: file cat --object-version=1352 pithos:debian_base3.diskdump.meta
469
    kamaki file cat --object-version=1352 /images/debian_base3.diskdump.meta
487 470
    {
488 471
      "status": "available",
489 472
      "name": "Debian Base Gama",
......
492 475
      "updated-at": "2013-06-19 08:01:00",
493 476
      "created-at": "2013-06-19 08:00:22",
494 477
      "properties": {},
495
      "location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
478
      "location": "pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump",
496 479
      "is-public": "False",
497 480
      "owner": "s0m3-u53r-1d",
498 481
      "disk-format": "diskdump",
......
500 483
      "deleted-at": "",
501 484
      "container-format": "bare"
502 485
    }
503
    [kamaki]:
504 486

  
505 487
Download the second version
506 488

  
507 489
.. code-block:: console
508 490

  
509
    [kamaki]: file download --object-version=1359 pithos:debian_base3.diskdump.meta debian_base3.diskdump.meta.v1359
510
    Downloading pithos:debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta.v1359
491
    kamaki file download --object-version=1359 /images/debian_base3.diskdump.meta debian_base3.diskdump.meta.v1359
492
    Downloading /images/debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta.v1359
511 493
    Done
512
    [kamaki]:
513 494

  
514 495
Batch image upload
515 496
------------------
......
521 502

  
522 503
.. code-block:: console
523 504

  
524
    [kamaki]: file upload -R images pithos
525
    mkdir pithos:images
526
    Uploading /home/someuser/images/debian.diskdump --> pithos:images/debian.diskdump
527
    Uploading /home/someuser/images/win8.diskdump --> pithos:images/win8.diskdump
505
    kamaki file upload -r images /images
506
    mkdir /images/images
507
    Uploading /home/someuser/images/debian.diskdump --> /images/images/debian.diskdump
508
    Uploading /home/someuser/images/win8.diskdump --> /images/images/win8.diskdump
528 509
    ...
529 510
    Done
530
    [kamaki]:
531 511

  
532
Make sure the images are uploaded to pithos:images/ remote directory object
512
Make sure the images are uploaded to /images/images/ remote directory object
533 513

  
534 514
.. code-block:: console
535 515

  
536
    [kamaki]: file list pithos:images/
516
    kamaki file list /images/images/
537 517
    D       images/
538 518
    983MB   images/debian.diskdump
539 519
    2.2GB   images/win8.diskdump
540 520
    ...
541
    [kamaki]:
521
    kamaki
542 522

  
543 523
Use the host shell capabilities to streamline the registration, so exit kamaki
544 524

  
545 525
.. code-block:: console
546 526

  
547
    [kamaki]: /exit
548

  
549
The following is a bash script that attempts to register the already uploaded
550
images:
551

  
552
.. code-block:: bash
553

  
554
    #!/bin/bash
555

  
556
    userid=... # e.g., s0m3-u53r-1d
557
    container=... # e.g., pithos
558

  
559
    for path in images/*.diskdump; do
560
        location=$container:${path}
561
        kamaki image register $path $location
562
    done
563

  
564
Let's use the script (enriched with a separator message) to batch-register the
565
images (all images will be named after their relative paths).
566

  
567
Also, let the registered images be public (accessible to all users for creating
568
VMs) by adding the **- - public** flag argument when calling `image register`.
569

  
570
.. code-block:: console
571

  
572
    $ for path in images/*.diskdump; do
573
        location=pithos:${path}
574
        echo "- - - Register ${path} - - -"
575
        kamaki image register $path $location --public
576
    done
577
    - - - Register images/debian.diskdump ---
578
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
579
    container-format: bare
580
    created-at:       2013-06-19 08:00:22
581
    deleted-at:
582
    disk-format:      diskdump
583
    id:               d3b14n-1m4g3-1d
584
    is-public:        False
585
    location:         pithos://s0m3-u53r-1d/pithos/images/debian.diskdump
586
    name:             images/debian.diskdump
587
    owner:            s0m3-u53r-1d
588
    properties:
589
    size:             903471104
590
    status:           available
591
    updated-at:       2013-06-19 08:01:00
592
    Metadata file uploaded as pithos:images/debian.diskdump.meta (version 4201)
593
    - - - Register images/win8.diskdump ---
594
    checksum:         4cb03556ec971f...e8dd6190443b560cb6
595
    container-format: bare
596
    created-at:       2013-06-19 08:00:22
597
    deleted-at:
598
    disk-format:      diskdump
599
    id:               w1nd0w5-1m4g3-1d
600
    is-public:        False
601
    location:         pithos://s0m3-u53r-1d/pithos/images/win8.diskdump
602
    name:             images/win8.diskdump
603
    owner:            s0m3-u53r-1d
604
    properties:
605
    size:             2103471104
606
    status:           available
607
    updated-at:       2013-06-19 08:01:00
608
    Metadata file uploaded as pithos:images/debian.diskdump.meta (version 4301)
609
    ...
610
    $
611

  
612
.. note:: All images can be re-registered, either individually or with a batch
613
    process.
614

  
615

  
527
    kamaki /exit
b/kamaki/cli/commands/cyclades.py
551 551
        if self['metadata_to_set']:
552 552
            self.client.update_server_metadata(
553 553
                server_id, **self['metadata_to_set'])
554
        for key in self['metadata_to_delete']:
554
        for key in (self['metadata_to_delete'] or []):
555 555
            errors.cyclades.metadata(
556 556
                self.client.delete_server_metadata)(server_id, key=key)
557 557
        if self['with_output']:
b/kamaki/cli/commands/image.py
42 42
from kamaki.cli.utils import filter_dicts_by_dict
43 43
from kamaki.clients.image import ImageClient
44 44
from kamaki.clients.pithos import PithosClient
45
from kamaki.clients.astakos import AstakosClient
46 45
from kamaki.clients import ClientError
47 46
from kamaki.cli.argument import (
48 47
    FlagArgument, ValueArgument, RepeatableArgument, KeyValueArgument,
......
347 346
    @errors.plankton.connection
348 347
    @errors.plankton.id
349 348
    def _run(self, image_id):
350
        for mid in self['member_ID_to_add']:
349
        for mid in (self['member_ID_to_add'] or []):
351 350
            self.client.add_member(image_id, mid)
352
        for mid in self['member_ID_to_remove']:
351
        for mid in (self['member_ID_to_remove'] or []):
353 352
            self.client.remove_member(image_id, mid)
354
        if len([term for term in self.required if (
355
                self[term] and not term.startswith('member_ID'))]) > 1:
356
            meta = self.client.get_meta(image_id)
357
            for k, v in self['property_to_set'].items():
358
                meta['properties'][k.upper()] = v
359
            for k in self['property_to_del']:
360
                meta['properties'][k.upper()] = None
361
            self._optional_output(self.client.update_image(
362
                image_id,
363
                name=self['image_name'],
364
                disk_format=self['disk_format'],
365
                container_format=self['container_format'],
366
                status=self['status'],
367
                public=self['publish'] or self['unpublish'] or None,
368
                **meta['properties']))
353
        meta = self.client.get_meta(image_id)
354
        for k, v in self['property_to_set'].items():
355
            meta['properties'][k.upper()] = v
356
        for k in (self['property_to_del'] or []):
357
            meta['properties'][k.upper()] = None
358
        self._optional_output(self.client.update_image(
359
            image_id,
360
            name=self['image_name'],
361
            disk_format=self['disk_format'],
362
            container_format=self['container_format'],
363
            status=self['status'],
364
            public=self['publish'] or self['unpublish'] or None,
365
            **meta['properties']))
369 366
        if self['with_output']:
370 367
            self._optional_output(self.get_image_details(image_id))
371 368

  
......
754 751
        if self['property_to_add']:
755 752
            self.client.update_image_metadata(
756 753
                image_id, **self['property_to_add'])
757
        for key in self['property_to_del']:
754
        for key in (self['property_to_del'] or []):
758 755
            self.client.delete_image_metadata(image_id, key)
759 756
        if self['with_output']:
760 757
            self._optional_output(self.client.get_image_details(image_id))
b/kamaki/cli/commands/pithos.py
1338 1338
            'Set a versioning scheme (%s)' % ', '.join(
1339 1339
                VersioningArgument.schemes), '--versioning')
1340 1340
    )
1341
    required = ['metadata_to_add', 'metadata_to_delete', 'sizelimit']
1341
    required = [
1342
        'metadata_to_add', 'metadata_to_delete', 'sizelimit', 'versioning']
1342 1343

  
1343 1344
    @errors.generic.all
1344 1345
    @errors.pithos.connection
1345 1346
    @errors.pithos.container
1346 1347
    def _run(self, container):
1347 1348
        metadata = self['metadata_to_add']
1348
        for k in self['metadata_to_delete']:
1349
        for k in (self['metadata_to_delete'] or []):
1349 1350
            metadata[k] = ''
1350 1351
        if metadata:
1351 1352
            self.client.set_container_meta(metadata)
......
1650 1651

  
1651 1652
    def main(self, groupname):
1652 1653
        super(self.__class__, self)._run()
1653
        users = self['user_uuid'] + self._usernames2uuids(
1654
            self['username']).values()
1654
        users = (self['user_uuid'] or []) + self._usernames2uuids(
1655
            self['username'] or []).values()
1655 1656
        if users:
1656 1657
            self._run(groupname, *users)
1657 1658
        else:

Also available in: Unified diff