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
Rafael Monnerat
slapos.package
Commits
f09dd0e5
Commit
f09dd0e5
authored
Apr 25, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook/ors: improve configure-re6st script
parent
954aaacf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
17 deletions
+39
-17
playbook/roles/ors/files/configure-re6st
playbook/roles/ors/files/configure-re6st
+38
-16
playbook/roles/ors/files/configure-slapos.py
playbook/roles/ors/files/configure-slapos.py
+1
-1
No files found.
playbook/roles/ors/files/configure-re6st
View file @
f09dd0e5
#!/bin/bash
#!/bin/bash
if
ip
-6
a show dev enp0s31f6 |
grep
-q
fe80
;
then
IF_LIST
=()
IFACE
=
"enp0s31f6"
RM_IF_LIST
=()
elif
ip
-6
a show dev enp2s0 |
grep
-q
fe80
;
then
IFACE
=
"enp2s0"
else
exit
;
fi
CONF
=
"/etc/re6stnet/re6stnet.conf"
CONF
=
"/etc/re6stnet/re6stnet.conf"
sed
-i
'/^interface/d'
$CONF
TMP
=
"/tmp/re6stnet.conf.
$(
date
+%s
)
"
# Don't run re6st with interface option at Lille Office
cd
/sys/class/net
;
if
ping6
-q
-c2
-w3
fe80::20d:b9ff:fe3f:9055%
$IFACE
;
then
for
IF
in
$(
find
.
-type
l
-printf
"%f
\n
"
)
;
do
if
ps
-ax
-o
cmd |
grep
babeld |
grep
-q
$IFACE
;
then
# If interface is virtual
systemctl restart re6stnet
;
if
!
realpath
$(
readlink
$IF
)
|
grep
-q
"^/sys/devices/virtual"
;
then
# If interface is up and has IPv6 neighbours
if
[
"
$(
cat
$IF
/operstate
)
"
=
"up"
]
&&
[
-n
"
$(
ip
-6
neigh list dev
$IF
)
"
]
;
then
# Special case: interfaces connected to Lille office LAN should not have interface option enabled
if
!
ping6
-q
-c3
-w3
fe80::20d:b9ff:fe3f:9055%
$IF
;
then
IF_LIST+
=(
$IF
)
;
else
RM_IF_LIST+
=(
$IF
)
;
fi
fi
fi
done
cp
$CONF
$TMP
;
REPLACE
=
0
# Check if configuration is correct
for
IF
in
"
${
IF_LIST
[@]
}
"
;
do
if
!
grep
-q
"^interface
$IF
"
$TMP
;
then
REPLACE
=
1
fi
fi
els
e
don
e
echo
"interface
$IFACE
"
>>
$CONF
for
IF
in
"
${
RM_IF_LIST
[@]
}
"
;
do
if
!
ps
-ax
-o
cmd |
grep
babeld |
grep
-q
$IFACE
;
then
if
grep
-q
"^interface
$IF
"
$TMP
;
then
systemctl restart re6stnet
;
REPLACE
=
1
fi
fi
done
# Reconfigure re6st if configuration not correct
if
((
$REPLACE
))
;
then
sed
-i
'/^interface/d'
$TMP
for
IF
in
"
${
IF_LIST
[@]
}
"
;
do
echo
"interface
$IF
"
>>
$TMP
done
mv
$TMP
$CONF
;
systemctl restart re6stnet
fi
fi
rm
-rf
$TMP
;
playbook/roles/ors/files/configure-slapos.py
View file @
f09dd0e5
...
@@ -43,6 +43,6 @@ with open('/opt/upgrader/configure-slapos.log', 'w+') as l:
...
@@ -43,6 +43,6 @@ with open('/opt/upgrader/configure-slapos.log', 'w+') as l:
l
.
write
(
"[configure-slapos] slapos.cfg not valid
\
n
"
)
l
.
write
(
"[configure-slapos] slapos.cfg not valid
\
n
"
)
# Delete slaptun devices
# Delete slaptun devices
for
i
in
range
(
0
,
19
):
for
i
in
range
(
0
,
19
):
subprocess
.
run
([
'ip'
,
'link'
,
'delete'
,
'slaptun
'
])
subprocess
.
run
([
'ip'
,
'link'
,
'delete'
,
'slaptun
{}'
.
format
(
i
)
])
subprocess
.
run
([
'rm'
,
'-f'
,
'/opt/slapos/slapos.xml'
],
check
=
True
)
subprocess
.
run
([
'rm'
,
'-f'
,
'/opt/slapos/slapos.xml'
],
check
=
True
)
subprocess
.
run
([
'slapos'
,
'node'
,
'format'
,
'--now'
],
check
=
True
,
capture_output
=
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