Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Łukasz Nowak
slapos
Commits
12fd85f1
Commit
12fd85f1
authored
Jan 31, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate hack to install production system on ipv4 only server
parent
16dd742a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
30 deletions
+29
-30
slapos/recipe/bef_erp5/__init__.py
slapos/recipe/bef_erp5/__init__.py
+0
-26
slapos/recipe/softwaretype.py
slapos/recipe/softwaretype.py
+29
-4
No files found.
slapos/recipe/bef_erp5/__init__.py
View file @
12fd85f1
...
...
@@ -31,34 +31,8 @@ import zc.buildout
import
sys
import
netaddr
def
validLoopBackAddress
(
ip
):
if
netaddr
.
IPAddress
(
ip
).
is_loopback
():
return
True
else
:
return
False
def
validPublicAddress
(
ip
):
return
not
validLoopBackAddress
(
ip
)
class
Recipe
(
slapos
.
recipe
.
erp5
.
Recipe
):
def
getLocalIPv4Address
(
self
):
"""Returns local IPv4 address available on partition"""
# XXX: Lack checking for locality of address
if
self
.
development
:
# XXX: Development superhack.
return
slapos
.
recipe
.
erp5
.
Recipe
.
getLocalIPv4Address
(
self
)
return
self
.
_getIpAddress
(
validLoopBackAddress
)
def
getGlobalIPv6Address
(
self
):
"""Returns global IPv6 address available on partition"""
if
self
.
development
:
# XXX: Development superhack.
return
slapos
.
recipe
.
erp5
.
Recipe
.
getGlobalIPv6Address
(
self
)
# XXX: Lack checking for globality of address
return
self
.
_getIpAddress
(
validPublicAddress
)
def
installProductionFrontend
(
self
):
frontend_key
,
frontend_certificate
=
self
.
requestCertificate
(
self
.
parameter_dict
[
'frontend_name'
])
...
...
slapos/recipe/softwaretype.py
View file @
12fd85f1
...
...
@@ -36,6 +36,15 @@ import logging
import
zc.buildout
def
validLoopBackAddress
(
ip
):
if
netaddr
.
IPAddress
(
ip
).
is_loopback
():
return
True
else
:
return
False
def
validPublicAddress
(
ip
):
return
not
validLoopBackAddress
(
ip
)
class
Recipe
:
def
__init__
(
self
,
buildout
,
name
,
options
):
...
...
@@ -58,11 +67,20 @@ class Recipe:
# XXX: Lack checking for locality of address
return
self
.
_getIpAddress
(
netaddr
.
valid_ipv4
)
def
getLoopbackIPv4Address
(
self
):
"""Returns local IPv4 address available on partition"""
return
self
.
_getIpAddress
(
validLoopBackAddress
)
def
getGlobalIPv6Address
(
self
):
"""Returns global IPv6 address available on partition"""
# XXX: Lack checking for globality of address
return
self
.
_getIpAddress
(
netaddr
.
valid_ipv6
)
def
getGlobalIPv4Address
(
self
):
"""Returns global IPv4 address available on partition"""
# XXX: Lack checking for globality of address
return
self
.
_getIpAddress
(
validPublicAddress
)
def
install
(
self
):
slap
=
slapos
.
slap
.
slap
()
slap_connection
=
self
.
buildout
[
'slap_connection'
]
...
...
@@ -104,10 +122,17 @@ class Recipe:
buildout
.
set
(
'slap-parameter'
,
parameter
,
value
)
buildout
.
add_section
(
'slap-network-information'
)
buildout
.
set
(
'slap-network-information'
,
'local-ipv4'
,
self
.
getLocalIPv4Address
())
buildout
.
set
(
'slap-network-information'
,
'global-ipv6'
,
self
.
getGlobalIPv6Address
())
if
software_type
in
(
'production'
,
'mariadb-prod'
):
# XXX Hack for beteireflow production
buildout
.
set
(
'slap-network-information'
,
'local-ipv4'
,
self
.
getLoopbackIPv4Address
())
buildout
.
set
(
'slap-network-information'
,
'global-ipv6'
,
self
.
getGlobalIPv4Address
())
else
:
buildout
.
set
(
'slap-network-information'
,
'local-ipv4'
,
self
.
getLocalIPv4Address
())
buildout
.
set
(
'slap-network-information'
,
'global-ipv6'
,
self
.
getGlobalIPv6Address
())
# Copy/paste slap_connection
buildout
.
add_section
(
'slap-connection'
)
...
...
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