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
3e88e47d
Commit
3e88e47d
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Add a new _list option to TqlCommand rpccall
This option allow to call multiple rpccall with changing argument each time
parent
06213f1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cccli/command.py
+26
-15
26 additions, 15 deletions
cccli/command.py
cccli/commands/right.py
+1
-3
1 addition, 3 deletions
cccli/commands/right.py
with
27 additions
and
18 deletions
cccli/command.py
+
26
−
15
View file @
3e88e47d
...
...
@@ -295,6 +295,7 @@ class TqlCommand(RemoteCommand):
_tql_print: print tql with filter
_exception: catch or not RPCError exception
_direct: call directly, no listing before
_list: list of arg which are added to call arg one by one (=> multiple call)
'''
# set rpccall default option value
...
...
@@ -306,6 +307,7 @@ class TqlCommand(RemoteCommand):
"
tql_index
"
:
1
,
"
tql_print
"
:
False
,
"
callback
"
:
None
,
"
list
"
:
[],
}
# check for options modifiers
for
o
in
_options
.
keys
():
...
...
@@ -336,11 +338,24 @@ class TqlCommand(RemoteCommand):
def
_unsecure_rpccall
(
self
,
_options
,
args
,
kwargs
):
'''
Just call an RPC without checking before
'''
try
:
d
=
self
.
rpc
.
call
(
*
args
,
**
kwargs
)
if
_options
[
"
callback
"
]
is
not
None
:
_options
[
"
callback
"
](
d
)
if
_options
[
"
status
"
]:
self
.
print_objects
(
d
,
[
"
output
"
],
index
=
_options
[
"
index
"
])
# list mode call command for each argument
# return is returned as a list
if
len
(
_options
[
"
list
"
])
==
0
:
d
=
self
.
rpc
.
call
(
*
args
,
**
kwargs
)
if
_options
[
"
callback
"
]
is
not
None
:
_options
[
"
callback
"
](
d
)
if
_options
[
"
status
"
]:
self
.
print_objects
(
d
,
[
"
output
"
],
index
=
_options
[
"
index
"
])
else
:
d
=
[]
for
arg
in
_options
[
"
list
"
]:
args2
=
args
+
[
arg
]
r
=
self
.
rpc
.
call
(
*
args2
,
**
kwargs
)
d
.
append
(
r
)
if
_options
[
"
callback
"
]
is
not
None
:
_options
[
"
callback
"
](
r
)
if
_options
[
"
status
"
]:
self
.
print_objects
(
r
,
[
"
output
"
],
index
=
_options
[
"
index
"
])
return
d
except
RpcError
as
e
:
if
_options
[
"
exception
"
]:
...
...
@@ -371,13 +386,9 @@ class TqlCommand(RemoteCommand):
raise
cmdWarning
(
"
User aborted
"
)
# per validated id execution (this is a kind of atomic implementation)
for
obj
in
objs
[
"
objects
"
]:
try
:
l
=
list
(
args
)
l
[
_options
[
"
tql_index
"
]]
=
"
id=%s
"
%
obj
[
"
id
"
]
d
=
self
.
cli
.
rpc
.
call
(
*
tuple
(
l
),
**
kwargs
)
if
_options
[
"
callback
"
]
is
not
None
:
_options
[
"
callback
"
](
d
)
if
_options
[
"
status
"
]:
self
.
print_objects
(
d
,
[
"
output
"
],
index
=
False
)
except
RpcError
as
e
:
self
.
printer
.
error
(
"
RPCError: %s
"
%
str
(
e
))
# make a list from tupe for editing
args2
=
list
(
args
)
# ovewrite tql object by id from object
args2
[
_options
[
"
tql_index
"
]]
=
"
id=%s
"
%
obj
[
"
id
"
]
# now we can make call
self
.
_unsecure_rpccall
(
_options
,
args2
,
kwargs
)
This diff is collapsed.
Click to expand it.
cccli/commands/right.py
+
1
−
3
View file @
3e88e47d
...
...
@@ -99,9 +99,7 @@ class Command_delright(TqlCommand):
if
"
*
"
in
self
.
args
[
1
:]:
self
.
rpccall
(
"
delright
"
,
self
.
args
[
0
],
None
)
else
:
self
.
rpccall
(
"
list
"
,
self
.
args
[
0
],
_status
=
False
)
for
index
in
l
:
self
.
rpccall
(
"
delright
"
,
self
.
args
[
0
],
index
,
_direct
=
True
)
self
.
rpccall
(
"
delright
"
,
self
.
args
[
0
],
_list
=
l
)
def
remote_functions
(
self
):
return
set
((
'
delright
'
,))
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