Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos-caddy
Commits
ee340b26
Commit
ee340b26
authored
Nov 27, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.recipe.re6stmaster: More verbosity and update ips if they changed.
parent
7f4aa2b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
slapos/recipe/re6stnet/re6stnet.py
slapos/recipe/re6stnet/re6stnet.py
+17
-5
No files found.
slapos/recipe/re6stnet/re6stnet.py
View file @
ee340b26
...
...
@@ -208,8 +208,9 @@ def dumpIPv6Network(slave_reference, db, network, ipv6_file):
cn
=
x509
.
subnetFromCert
(
cert
)
subnet
=
network
+
utils
.
binFromSubnet
(
cn
)
ipv6
=
utils
.
ipFromBin
(
subnet
)
changed
=
readFile
(
ipv6_file
)
!=
ipv6
writeFile
(
ipv6_file
,
ipv6
)
return
ipv6
,
utils
.
binFromSubnet
(
cn
)
return
ipv6
,
utils
.
binFromSubnet
(
cn
)
,
changed
except
Exception
:
log
.
debug
(
'XXX for %s...
\
n
%s'
%
(
slave_reference
,
traceback
.
format_exc
()))
...
...
@@ -234,8 +235,9 @@ def dumpIPv4Network(ipv6_prefix, network, ipv4_file, sock, peer_prefix_list):
if
ipv6_prefix
==
"00000000000000000000000000000000"
:
# workarround to ignore the first node
ipv4
=
"0.0.0.0"
changed
=
readFile
(
ipv4_file
)
!=
ipv4
writeFile
(
ipv4_file
,
ipv4
)
return
return
ipv4
,
changed
peers
=
[]
...
...
@@ -265,10 +267,13 @@ def dumpIPv4Network(ipv6_prefix, network, ipv4_file, sock, peer_prefix_list):
ipv4
=
msg
.
split
(
','
)[
0
]
else
:
ipv4
=
"0.0.0.0"
changed
=
readFile
(
ipv4_file
)
!=
ipv4
writeFile
(
ipv4_file
,
ipv4
)
return
ipv4
,
changed
except
Exception
:
log
.
debug
(
'XXX for %s...
\
n
%s'
%
(
ipv6_prefix
,
log
.
info
(
'XXX for %s...
\
n
%s'
%
(
ipv6_prefix
,
traceback
.
format_exc
()))
return
"0.0.0.0"
,
False
def
checkService
(
args
,
can_bang
=
True
):
base_token_path
=
args
[
'token_base_path'
]
...
...
@@ -300,12 +305,18 @@ def checkService(args, can_bang=True):
ipv4_file
=
os
.
path
.
join
(
base_token_path
,
'%s.ipv4'
%
slave_reference
)
if
not
os
.
path
.
exists
(
status_file
):
# This token is not added yet!
log
.
info
(
"Token %s dont exist yet."
%
status_file
)
continue
msg
=
readFile
(
status_file
)
log
.
info
(
"Token %s has %s State."
%
(
status_file
,
msg
))
if
msg
==
'TOKEN_USED'
:
ipv6
,
ipv6_prefix
=
dumpIPv6Network
(
slave_reference
,
db
,
network
,
ipv6_file
)
dumpIPv4Network
(
ipv6_prefix
,
network
,
ipv4_file
,
sock
,
peer_prefix_list
)
log
.
info
(
"Dumping ipv6..."
)
ipv6
,
ipv6_prefix
,
ipv6_changed
=
dumpIPv6Network
(
slave_reference
,
db
,
network
,
ipv6_file
)
log
.
info
(
"%s, IPV6 = %s, IPV6_PREFIX = %s"
%
(
slave_reference
,
ipv6
,
ipv6_prefix
))
_
,
ipv4_changed
=
dumpIPv4Network
(
ipv6_prefix
,
network
,
ipv4_file
,
sock
,
peer_prefix_list
)
if
ipv4_changed
or
ipv6_changed
:
call_bang
=
True
continue
# Check if token is not in the database
...
...
@@ -323,6 +334,7 @@ def checkService(args, can_bang=True):
try
:
writeFile
(
status_file
,
'TOKEN_USED'
)
dumpIPv6Network
(
slave_reference
,
db
,
network
,
ipv6_file
)
dumpIPv4Network
(
ipv6_prefix
,
network
,
ipv4_file
,
sock
,
peer_prefix_list
)
log
.
info
(
"Token status of %s updated to 'used'."
%
slave_reference
)
except
IOError
:
# XXX- this file should always exists
...
...
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