Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Guillaume Hervier
slapos.core
Commits
96a7e7d5
Commit
96a7e7d5
authored
Sep 26, 2018
by
Alain Takoudjou
Committed by
Rafael Monnerat
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.cli.boot: allow custom hostname for network test, default is slap.vifib.com
parent
c7ebe964
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
slapos.cfg.example
slapos.cfg.example
+4
-0
slapos/cli/boot.py
slapos/cli/boot.py
+13
-7
No files found.
slapos.cfg.example
View file @
96a7e7d5
...
...
@@ -25,6 +25,10 @@ tap_base_name = slaptap
ipv4_local_network = 10.0.0.0/16
# Change to true if you want slapos to use local-only IPv6
use_unique_local_address = False
# IPv6 host to ping6 while testing network
ipv6_test_hostname = slap.vifib.com
# IPv4 host to ping while testing network
ipv4_test_hostname = slap.vifib.com
# to enable, change to [firewall]
[disabled-firewall]
...
...
slapos/cli/boot.py
View file @
96a7e7d5
...
...
@@ -64,13 +64,13 @@ def _runFormat(app):
return
0
return
1
def
_ping
():
def
_ping
(
hostname
):
"""
Ping a hostname
"""
print
"[BOOT] Invoking ping to ipv4 network..."
p
=
subprocess
.
Popen
(
[
"ping"
,
"-c"
,
"2"
,
"www.google.com"
],
[
"ping"
,
"-c"
,
"2"
,
hostname
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
if
p
.
returncode
==
0
:
...
...
@@ -79,13 +79,13 @@ def _ping():
print
"[BOOT] [ERROR] IPv4 network unreachable..."
return
0
def
_ping6
():
def
_ping6
(
hostname
):
"""
Ping an ipv6 address
"""
print
"[BOOT] Invoking ping to ipv6 network..."
p
=
subprocess
.
Popen
(
[
"ping6"
,
"-c"
,
"2"
,
"ipv6.google.com"
],
[
"ping6"
,
"-c"
,
"2"
,
hostname
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
if
p
.
returncode
==
0
:
...
...
@@ -110,15 +110,21 @@ class BootCommand(ConfigCommand):
@
must_be_root
def
take_action
(
self
,
args
):
configp
=
self
.
fetch_config
(
args
)
# Make sure ipv4 is working
instance_root
=
configp
.
get
(
'slapos'
,
'instance_root'
)
is_ready
=
_ping
()
ipv6_host
=
ipv4_host
=
"slap.vifib.com"
if
configp
.
has_option
(
'slapformat'
,
'ipv6_test_hostname'
):
ipv6_host
=
configp
.
get
(
'slapformat'
,
'ipv6_test_hostname'
)
if
configp
.
has_option
(
'slapformat'
,
'ipv4_test_hostname'
):
ipv4_host
=
configp
.
get
(
'slapformat'
,
'ipv4_test_hostname'
)
# Make sure ipv4 is working
is_ready
=
_ping
(
ipv4_host
)
while
is_ready
==
0
:
sleep
(
5
)
is_ready
=
_ping
()
# Make sure ipv6 is working
is_ready
=
_ping6
()
is_ready
=
_ping6
(
ipv6_host
)
while
is_ready
==
0
:
sleep
(
5
)
is_ready
=
_ping6
()
...
...
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