FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ceph-devstack/ceph_devstack/cli.py at main · ceph/ceph-devstack · GitHub
ceph
ceph-devstack
Repository navigation
Code
Issues
4
(4)
Pull requests
8
(8)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
cli.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
67 lines (59 loc) · 2.11 KB
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
cli.py
Copy path
File metadata and controls
67 lines (59 loc) · 2.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import
asyncio
import
logging
import
sys
from
pathlib
import
Path
from
ceph_devstack
import
config
,
logger
,
parse_args
,
VERBOSE
from
ceph_devstack
.
requirements
import
check_requirements
from
ceph_devstack
.
resources
.
ceph
import
CephDevStack
CONFIG_HANDLERS
=
{
"dump"
:
lambda
config
,
args
:
print
(
config
.
dump
()),
"get"
:
lambda
config
,
args
:
print
(
config
.
get_value
(
args
.
name
)),
"set"
:
lambda
config
,
args
:
print
(
config
.
set_value
(
args
.
name
,
args
.
value
)),
"unset"
:
lambda
config
,
args
:
config
.
unset_value
(
args
.
name
),
}
COMMAND_HANDLERS
=
{
"doctor"
:
None
,
"apply"
:
lambda
args
,
obj
:
obj
.
apply
(
args
.
command
),
"pull"
:
lambda
_
,
obj
:
obj
.
pull
(),
"build"
:
lambda
_
,
obj
:
obj
.
build
(),
"create"
:
lambda
_
,
obj
:
obj
.
create
(),
"remove"
:
lambda
_
,
obj
:
obj
.
remove
(),
"start"
:
lambda
_
,
obj
:
obj
.
start
(),
"stop"
:
lambda
_
,
obj
:
obj
.
stop
(),
"watch"
:
lambda
_
,
obj
:
obj
.
watch
(),
"wait"
:
lambda
args
,
obj
:
obj
.
wait
(
container_name
=
args
.
container
),
"logs"
:
lambda
args
,
obj
:
obj
.
logs
(
run_name
=
args
.
run_name
,
job_id
=
args
.
job_id
,
locate
=
args
.
locate
),
}
def
main
()
->
int
:
args
=
parse_args
(
sys
.
argv
[
1
:])
config
.
load
(
args
.
config_file
)
if
args
.
verbose
:
for
handler
in
logging
.
getLogger
(
"root"
).
handlers
:
if
not
isinstance
(
handler
,
logging
.
FileHandler
):
handler
.
setLevel
(
VERBOSE
)
if
args
.
command
==
"config"
:
CONFIG_HANDLERS
[
args
.
config_op
](
config
,
args
)
return
0
config
[
"args"
]
=
vars
(
args
)
data_path
=
Path
(
config
[
"data_dir"
]).
expanduser
()
data_path
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
obj
=
CephDevStack
()
async
def
run
():
if
not
all
(
await
asyncio
.
gather
(
check_requirements
(),
obj
.
check_requirements
(),
)
):
logger
.
error
(
"Requirements not met!"
)
return
1
handler
=
COMMAND_HANDLERS
.
get
(
args
.
command
)
if
handler
:
return
await
handler
(
args
,
obj
)
try
:
sys
.
exit
(
asyncio
.
run
(
run
()))
except
KeyboardInterrupt
:
logger
.
debug
(
"Exiting!"
)
return
130
# 128 + SIGINT
Back
|
FazBrowse Home
|
New Git URL