FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ceph-devstack/ceph_devstack/resources/ceph/requirements.py at main · exkson/ceph-devstack · GitHub
exkson
ceph-devstack
Repository navigation
Code
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
resources
/
ceph
/
requirements.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
90 lines (78 loc) · 2.63 KB
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
resources
/
ceph
/
requirements.py
Copy path
File metadata and controls
90 lines (78 loc) · 2.63 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from
ceph_devstack
import
logger
,
PROJECT_ROOT
from
ceph_devstack
.
requirements
import
Requirement
,
FixableRequirement
class
HasSudo
(
Requirement
):
check_cmd
=
[
"sudo"
,
"true"
]
suggest_msg
=
"sudo access is required"
class
LoopControlDeviceExists
(
FixableRequirement
):
device
=
"/dev/loop-control"
check_cmd
=
[
"test"
,
"-e"
,
device
]
suggest_msg
=
f"
{
device
}
does not exist"
fix_cmd
=
[
"sudo"
,
"modprobe"
,
"loop"
]
class
LoopControlDeviceWriteable
(
FixableRequirement
):
device
=
"/dev/loop-control"
check_cmd
=
[
"test"
,
"-w"
,
device
]
suggest_msg
=
f"Cannot write to
{
device
}
"
async
def
check
(
self
):
if
not
(
result
:=
await
super
().
check
()):
group
=
(
self
.
host
.
run
([
"stat"
,
"--printf"
,
"%G"
,
self
.
device
])
.
communicate
()[
0
]
.
decode
()
)
user
=
self
.
host
.
run
([
"whoami"
]).
communicate
()[
0
].
strip
().
decode
()
if
self
.
host
.
type
==
"local"
:
self
.
fix_cmd
=
[
"sudo"
,
"usermod"
,
"-a"
,
"-G"
,
group
,
user
]
else
:
self
.
fix_cmd
=
[
"sudo"
,
"chgrp"
,
user
,
self
.
device
]
self
.
suggest_msg
=
f"Cannot write to
{
self
.
device
}
"
return
result
async
def
suggest
(
self
):
await
super
().
suggest
()
if
self
.
host
.
type
==
"local"
:
logger
.
warning
(
"Note that group modifications require a logout to take effect."
)
class
SELinuxModule
(
FixableRequirement
):
def
__init__
(
self
):
fix_cmd
=
self
.
fix_cmd_prebuilt
if
self
.
host
.
type
==
"remote"
:
fix_cmd
=
[
"podman"
,
"machine"
,
"ssh"
,
"--"
]
+
fix_cmd
self
.
fix_cmd
=
fix_cmd
fix_cmd_build
=
[
"(sudo"
,
"dnf"
,
"install"
,
"-y"
,
"policycoreutils-devel"
,
"selinux-policy-devel"
,
"&&"
,
"cd"
,
str
(
PROJECT_ROOT
),
"&&"
,
"make"
,
"-f"
,
"/usr/share/selinux/devel/Makefile"
,
"ceph_devstack.pp"
,
"&&"
,
"sudo"
,
"semodule"
,
"-i"
,
"ceph_devstack.pp)"
,
]
fix_cmd_prebuilt
=
[
"sudo"
,
"semodule"
,
"-i"
,
str
(
PROJECT_ROOT
/
"ceph_devstack.pp"
),
]
suggest_msg
=
(
"SELinux is in Enforcing mode. To run nested rootless podman "
"containers, it is necessary to install ceph-devstack's SELinux "
"module"
)
async
def
check
(
self
):
proc
=
await
self
.
host
.
arun
([
"sudo"
,
"semodule"
,
"-l"
])
assert
proc
.
stdout
is
not
None
await
proc
.
wait
()
out
=
(
await
proc
.
stdout
.
read
()).
decode
()
return
"ceph_devstack"
in
out
.
split
(
"
\n
"
)
Back
|
FazBrowse Home
|
New Git URL