Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Véron
slapos.package
Commits
da83f1d8
Commit
da83f1d8
authored
Oct 17, 2022
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook/ors: fix conflicts with configure-slapos and vifib playbook
parent
b93fcda6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
26 deletions
+29
-26
playbook/roles/ors/files/configure-slapos.py
playbook/roles/ors/files/configure-slapos.py
+29
-26
No files found.
playbook/roles/ors/files/configure-slapos.py
100644 → 100755
View file @
da83f1d8
...
@@ -7,7 +7,6 @@ CONF_PATH = "/etc/opt/slapos/slapos.cfg"
...
@@ -7,7 +7,6 @@ CONF_PATH = "/etc/opt/slapos/slapos.cfg"
ors_config
=
{
ors_config
=
{
'slapformat'
:
{
'slapformat'
:
{
'create_tun'
:
'True'
,
'create_tun'
:
'True'
,
'create_tap'
:
'False'
,
'partition_amount'
:
'20'
,
'partition_amount'
:
'20'
,
},
},
'networkcache'
:
{
'networkcache'
:
{
...
@@ -17,28 +16,32 @@ https://lab.node.vifib.com/nexedi/slapos/raw/1.0.''',
...
@@ -17,28 +16,32 @@ https://lab.node.vifib.com/nexedi/slapos/raw/1.0.''',
},
},
}
}
config
=
configparser
.
ConfigParser
()
with
open
(
'/opt/upgrader/configure-slapos.log'
,
'w+'
)
as
l
:
config
.
read
(
CONF_PATH
)
l
.
write
(
"[configure-slapos] Configuring slapos...
\
n
"
)
def
is_slapformat_valid
():
for
k
in
ors_config
[
'slapformat'
]:
config
=
configparser
.
ConfigParser
()
if
ors_config
[
'slapformat'
][
k
]
!=
\
config
.
read
(
CONF_PATH
)
config
.
setdefault
(
'slapformat'
,
{}).
setdefault
(
k
,
''
):
return
False
def
is_slapformat_valid
():
return
True
for
k
in
ors_config
[
'slapformat'
]:
slapformat_valid
=
is_slapformat_valid
()
if
ors_config
[
'slapformat'
][
k
]
!=
\
config
.
setdefault
(
'slapformat'
,
{}).
setdefault
(
k
,
''
):
config
[
'slapformat'
].
update
(
ors_config
[
'slapformat'
])
l
.
write
(
"[configure-slapos] {} not valid ( {} != {} )
\
n
"
.
format
(
k
,
ors_config
[
'slapformat'
][
k
],
config
.
setdefault
(
'slapformat'
,
{}).
setdefault
(
k
,
''
)))
config
[
'networkcache'
].
update
(
ors_config
[
'networkcache'
])
return
False
with
open
(
CONF_PATH
,
'w+'
)
as
f
:
return
True
config
.
write
(
f
)
slapformat_valid
=
is_slapformat_valid
()
if
not
slapformat_valid
:
config
[
'slapformat'
].
update
(
ors_config
[
'slapformat'
])
# Delete routes
config
[
'networkcache'
].
update
(
ors_config
[
'networkcache'
])
s
=
subprocess
.
run
([
'ip'
,
'route'
],
check
=
True
,
capture_output
=
True
)
with
open
(
CONF_PATH
,
'w+'
)
as
f
:
for
r
in
s
.
stdout
.
decode
().
split
(
'
\
n
'
):
config
.
write
(
f
)
if
"slaptun"
in
r
:
l
=
r
.
split
(
' '
)
subprocess
.
run
([
'ip'
,
'route'
,
'del'
,]
+
l
[:
l
.
index
(
'dev'
)
+
2
],
check
=
True
)
if
not
slapformat_valid
:
subprocess
.
run
([
'rm'
,
'-f'
,
'/opt/slapos/slapos.xml'
],
check
=
True
)
l
.
write
(
"[configure-slapos] slapos.cfg not valid
\
n
"
)
subprocess
.
run
([
'slapos'
,
'node'
,
'format'
,
'--now'
],
check
=
True
,
capture_output
=
True
)
# Delete slaptun devices
for
i
in
range
(
0
,
19
):
subprocess
.
run
([
'ip'
,
'link'
,
'delete'
,
'slaptun'
])
subprocess
.
run
([
'rm'
,
'-f'
,
'/opt/slapos/slapos.xml'
],
check
=
True
)
subprocess
.
run
([
'slapos'
,
'node'
,
'format'
,
'--now'
],
check
=
True
,
capture_output
=
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment