Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
ec52784d
Commit
ec52784d
authored
Oct 03, 2011
by
Giorgos Verigakis
Browse files
Allow more than one metadata updates at the time
Refs #1399
parent
054e60c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/client.py
View file @
ec52784d
...
...
@@ -245,9 +245,9 @@ class Client(object):
reply
=
self
.
_put
(
path
,
body
,
201
)
return
reply
[
'meta'
]
def
update_server_metadata
(
self
,
server_id
,
key
,
val
):
def
update_server_metadata
(
self
,
server_id
,
**
metadata
):
path
=
'/servers/%d/meta'
%
server_id
body
=
json
.
dumps
({
'metadata'
:
{
key
:
val
}
})
body
=
json
.
dumps
({
'metadata'
:
metadata
})
reply
=
self
.
_post
(
path
,
body
,
201
)
return
reply
[
'metadata'
]
...
...
@@ -309,9 +309,9 @@ class Client(object):
reply
=
self
.
_put
(
path
,
body
,
201
)
reply
[
'meta'
]
def
update_image_metadata
(
self
,
image_id
,
key
,
val
):
def
update_image_metadata
(
self
,
image_id
,
**
metadata
):
path
=
'/images/%d/meta'
%
image_id
body
=
json
.
dumps
({
'metadata'
:
{
key
:
val
}
})
body
=
json
.
dumps
({
'metadata'
:
metadata
})
reply
=
self
.
_post
(
path
,
body
,
201
)
return
reply
[
'metadata'
]
...
...
kamaki/kamaki.py
View file @
ec52784d
...
...
@@ -387,7 +387,8 @@ class UpdateServerMetadata(Command):
description
=
'update server metadata'
def
main
(
self
,
server_id
,
key
,
val
):
reply
=
self
.
client
.
update_server_metadata
(
int
(
server_id
),
key
,
val
)
metadata
=
{
key
:
val
}
reply
=
self
.
client
.
update_server_metadata
(
int
(
server_id
),
**
metadata
)
print_dict
(
reply
)
...
...
@@ -515,7 +516,8 @@ class UpdateImageMetadata(Command):
description
=
'update image metadata'
def
main
(
self
,
image_id
,
key
,
val
):
reply
=
self
.
client
.
update_image_metadata
(
int
(
image_id
),
key
,
val
)
metadata
=
{
key
:
val
}
reply
=
self
.
client
.
update_image_metadata
(
int
(
image_id
),
**
metadata
)
print_dict
(
reply
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment