Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-cli
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-cli
Commits
363c4626
Commit
363c4626
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
VmCommand now use TqlCommand
parent
d4060c39
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cccli/command/vm.py
+9
-8
9 additions, 8 deletions
cccli/command/vm.py
cccli/printer.py
+1
-1
1 addition, 1 deletion
cccli/printer.py
with
10 additions
and
9 deletions
cccli/command/vm.py
+
9
−
8
View file @
363c4626
...
...
@@ -6,13 +6,13 @@ CloudControl VM related commands
from
cccli.exception
import
*
from
sjrpc.core.exceptions
import
*
from
cccli.printer
import
Printer
,
color
from
cccli.command.command
import
Option
Command
from
cccli.command.command
import
Tql
Command
class
VmCommand
(
Option
Command
):
class
VmCommand
(
Tql
Command
):
'''
Command for vm style
'''
def
__init__
(
self
,
cli
,
argv0
):
Option
Command
.
__init__
(
self
,
cli
,
argv0
)
Tql
Command
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] <tql>
"
)
self
.
add_option
(
"
--raw
"
,
action
=
"
store_true
"
,
dest
=
"
raw
"
,
help
=
"
Don
'
t append filter on request
"
)
...
...
@@ -22,16 +22,17 @@ class VmCommand(OptionCommand):
help
=
"
Don
'
t ask confirmation (Dangerous)
"
)
def
_vm_action
(
self
,
argv
,
filters
=
None
):
self
.
parse_args
()
if
len
(
args
)
==
0
:
# parse args
self
.
parse_args
(
argv
)
if
len
(
self
.
args
)
==
0
:
raise
cmdBadArgument
()
tql
=
str
.
join
(
""
,
args
)
tql
=
str
.
join
(
""
,
self
.
args
)
# append securty options by command name
if
filters
is
not
None
and
not
self
.
options
.
raw
:
tql
+=
filters
if
self
.
options
.
direct
:
try
:
objs
=
self
.
cli
.
rpc
.
call
(
arg
v
[
0
],
tql
)
objs
=
self
.
cli
.
rpc
.
call
(
self
.
arg
s
[
0
],
tql
)
except
RpcError
as
e
:
raise
cmdError
(
"
RPCError: %s
"
%
str
(
e
))
else
:
...
...
@@ -43,7 +44,7 @@ class VmCommand(OptionCommand):
# no result, goodbye
if
len
(
objs
)
==
0
:
raise
cmdWarning
(
"
tql:
'
%s
'
: No result.
"
%
tql
)
self
.
printer
.
out
(
"
You will %s:
"
%
arg
v
[
0
])
self
.
printer
.
out
(
"
You will %s:
"
%
self
.
arg
s
[
0
])
for
obj
in
objs
:
self
.
printer
.
out
(
"
%sid:%s%s%s
"
%
(
color
[
"
green
"
],
color
[
"
yellow
"
],
obj
[
"
id
"
],
color
[
"
reset
"
]))
self
.
printer
.
out
(
"
%sCount: %s%s
"
%
(
color
[
"
green
"
],
color
[
"
reset
"
],
len
(
objs
)))
...
...
This diff is collapsed.
Click to expand it.
cccli/printer.py
+
1
−
1
View file @
363c4626
...
...
@@ -147,7 +147,7 @@ class Printer(object):
h
=
list
(
self
.
history
)
self
.
history
.
clear
()
try
:
r
=
self
.
getline
(
prompt
,
history
=
False
)
r
=
self
.
getline
(
prompt
)
finally
:
self
.
history
.
load
(
h
)
return
r
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment