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
2afb8137
Commit
2afb8137
authored
Apr 04, 2014
by
Stavros Sachtouris
Browse files
Remove "PERMANENTS" from kamaki.cli.cmds classes
Resolves #9 This variable was used only once per case
parent
ea8f09c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/cmds/cyclades.py
View file @
2afb8137
...
...
@@ -121,8 +121,6 @@ class server_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
Use filtering arguments (e.g., --name-like) to manage long server lists
"""
PERMANENTS
=
(
'id'
,
'name'
)
arguments
=
dict
(
detail
=
FlagArgument
(
'show detailed output'
,
(
'-l'
,
'--details'
)),
since
=
DateArgument
(
...
...
@@ -215,7 +213,7 @@ class server_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
pass
else
:
for
srv
in
servers
:
for
key
in
set
(
srv
).
difference
(
self
.
PERMANENTS
):
for
key
in
set
(
srv
).
difference
(
[
'id'
,
'name'
]
):
srv
.
pop
(
key
)
kwargs
=
dict
(
with_enumeration
=
self
[
'enum'
])
...
...
@@ -809,8 +807,6 @@ class server_wait(_CycladesInit, _ServerWait):
class
flavor_list
(
_CycladesInit
,
OptionalOutput
,
NameFilter
,
IDFilter
):
"""List available hardware flavors"""
PERMANENTS
=
(
'id'
,
'name'
)
arguments
=
dict
(
detail
=
FlagArgument
(
'show detailed output'
,
(
'-l'
,
'--details'
)),
limit
=
IntArgument
(
'limit # of listed flavors'
,
(
'-n'
,
'--number'
)),
...
...
@@ -852,7 +848,7 @@ class flavor_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
remove_from_items
(
flavors
,
'links'
)
if
detail
and
not
self
[
'detail'
]:
for
flv
in
flavors
:
for
key
in
set
(
flv
).
difference
(
self
.
PERMANENTS
):
for
key
in
set
(
flv
).
difference
(
[
'id'
,
'name'
]
):
flv
.
pop
(
key
)
kwargs
=
dict
(
out
=
StringIO
(),
title
=
())
if
self
[
'more'
]
else
{}
self
.
print_
(
...
...
kamaki/cli/cmds/image.py
View file @
2afb8137
...
...
@@ -123,10 +123,6 @@ def load_image_meta(filepath):
class
image_list
(
_ImageInit
,
OptionalOutput
,
NameFilter
,
IDFilter
):
"""List images accessible by user"""
PERMANENTS
=
(
'id'
,
'name'
,
'status'
,
'container_format'
,
'disk_format'
,
'size'
)
arguments
=
dict
(
detail
=
FlagArgument
(
'show detailed output'
,
(
'-l'
,
'--details'
)),
container_format
=
ValueArgument
(
...
...
@@ -222,7 +218,9 @@ class image_list(_ImageInit, OptionalOutput, NameFilter, IDFilter):
images
=
self
.
_add_owner_name
(
images
)
elif
detail
and
not
self
[
'detail'
]:
for
img
in
images
:
for
key
in
set
(
img
).
difference
(
self
.
PERMANENTS
):
for
key
in
set
(
img
).
difference
([
'id'
,
'name'
,
'status'
,
'container_format'
,
'disk_format'
,
'size'
]):
img
.
pop
(
key
)
kwargs
=
dict
(
with_enumeration
=
self
[
'enum'
])
if
self
[
'limit'
]:
...
...
@@ -585,9 +583,6 @@ class image_unregister(_ImageInit):
@
command
(
imagecompute_cmds
)
class
imagecompute_list
(
_CycladesInit
,
OptionalOutput
,
NameFilter
,
IDFilter
):
"""List images"""
PERMANENTS
=
(
'id'
,
'name'
)
arguments
=
dict
(
detail
=
FlagArgument
(
'show detailed output'
,
(
'-l'
,
'--details'
)),
limit
=
IntArgument
(
'limit number listed images'
,
(
'-n'
,
'--number'
)),
...
...
@@ -643,7 +638,7 @@ class imagecompute_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
images
=
self
.
_add_name
(
self
.
_add_name
(
images
,
'tenant_id'
))
elif
detail
and
not
self
[
'detail'
]:
for
img
in
images
:
for
key
in
set
(
img
).
difference
(
self
.
PERMANENTS
):
for
key
in
set
(
img
).
difference
(
[
'id'
,
'name'
]
):
img
.
pop
(
key
)
kwargs
=
dict
(
with_enumeration
=
self
[
'enum'
])
if
self
[
'limit'
]:
...
...
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