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
d5985803
Commit
d5985803
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
addacount now take a password argument and so use TqlCommand
parent
747dfb55
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/account.py
+16
-6
16 additions, 6 deletions
cccli/command/account.py
cccli/command/command.py
+10
-2
10 additions, 2 deletions
cccli/command/command.py
with
26 additions
and
8 deletions
cccli/command/account.py
+
16
−
6
View file @
d5985803
...
...
@@ -10,20 +10,30 @@ from sjrpc.core.exceptions import *
from
cccli.printer
import
Printer
,
color
from
cccli.command.command
import
OptionCommand
,
TqlCommand
class
Command_addaccount
(
Option
Command
):
class
Command_addaccount
(
Tql
Command
):
'''
Create an account
'''
def
__init__
(
self
,
cli
,
argv0
):
Option
Command
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] <account name> <role>
"
)
Tql
Command
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] <account name> <role>
[password]
"
)
def
__call__
(
self
,
argv
):
# parse args
self
.
parse_args
(
argv
)
if
len
(
self
.
args
)
!=
2
:
if
len
(
self
.
args
)
==
2
:
_pass
=
None
elif
len
(
self
.
args
)
==
3
:
_pass
=
self
.
args
[
2
]
if
self
.
printer
.
isinteractive
():
self
.
printer
.
warn
(
"
Removing last line from history
"
)
self
.
printer
.
history
.
removelast
()
else
:
raise
cmdBadArgument
()
# execute command
self
.
rpccall
(
"
addaccount
"
,
self
.
args
[
0
],
self
.
args
[
1
])
# add account
self
.
rpccall
(
"
addaccount
"
,
self
.
args
[
0
],
self
.
args
[
1
],
_status
=
False
)
# set password
if
_pass
is
not
None
:
self
.
rpccall
(
"
passwd
"
,
"
a=%s
"
%
self
.
args
[
0
],
_pass
)
class
Command_delaccount
(
TqlCommand
):
...
...
This diff is collapsed.
Click to expand it.
cccli/command/command.py
+
10
−
2
View file @
d5985803
...
...
@@ -94,15 +94,23 @@ class TqlCommand(OptionCommand):
def
rpccall
(
self
,
*
args
,
**
kwargs
):
'''
Call a RPC method an show tql return
'''
# check for status printing
if
"
_status
"
in
kwargs
:
_status
=
kwargs
[
"
_status
"
]
del
kwargs
[
"
_status
"
]
elif
self
.
options
.
status
:
_status
=
True
else
:
_status
=
False
# Do RPC Call
try
:
d
=
self
.
rpc
.
call
(
*
args
,
**
kwargs
)
if
self
.
options
.
status
:
if
_
status
:
self
.
show_status
(
d
)
return
d
except
RpcError
as
e
:
raise
cmdError
(
"
RPCError: %s
"
%
str
(
e
))
def
show_status
(
self
,
ans
):
'''
Show status of an Tql request
'''
try
:
...
...
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