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
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
Iliya Manolov
slapos
Commits
b0100a77
Commit
b0100a77
authored
Apr 13, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide access to partition network settings.
parent
4e295a79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
slapos/recipe/slapconfiguration.py
slapos/recipe/slapconfiguration.py
+25
-1
No files found.
slapos/recipe/slapconfiguration.py
View file @
b0100a77
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
##############################################################################
##############################################################################
import
slapos.slap
import
slapos.slap
from
ConfigParser
import
RawConfigParser
from
ConfigParser
import
RawConfigParser
from
netaddr
import
valid_ipv4
,
valid_ipv6
class
Recipe
(
object
):
class
Recipe
(
object
):
"""
"""
...
@@ -33,6 +34,8 @@ class Recipe(object):
...
@@ -33,6 +34,8 @@ class Recipe(object):
buildout section in various ways, and in various encodings.
buildout section in various ways, and in various encodings.
Populates the buildout section it is used in with all slap partition
Populates the buildout section it is used in with all slap partition
parameters.
parameters.
Also provides access to partition properties: all IPv4, IPv6 and tap
interfaces it is allowed to use.
Input:
Input:
url
url
...
@@ -57,6 +60,12 @@ class Recipe(object):
...
@@ -57,6 +60,12 @@ class Recipe(object):
Output:
Output:
slap-software-type
slap-software-type
Current partition's software type.
Current partition's software type.
ipv4
Set of IPv4 addresses.
ipv6
Set of IPv6 addresses.
tap
Set of TAP interfaces.
configuration
configuration
Dict of all parameters.
Dict of all parameters.
configuration.<key>
configuration.<key>
...
@@ -85,7 +94,22 @@ class Recipe(object):
...
@@ -85,7 +94,22 @@ class Recipe(object):
# Discard them, and make them available as separate section keys.
# Discard them, and make them available as separate section keys.
options
[
'slap-software-type'
]
=
parameter_dict
.
pop
(
options
[
'slap-software-type'
]
=
parameter_dict
.
pop
(
'slap_software_type'
)
'slap_software_type'
)
del
parameter_dict
[
'ip_list'
]
ipv4_set
=
set
()
v4_add
=
ipv4_set
.
add
ipv6_set
=
set
()
v6_add
=
ipv6_set
.
add
tap_set
=
set
()
tap_add
=
tap_set
.
add
for
tap
,
ip
in
parameter_dict
.
pop
(
'ip_list'
):
tap_add
(
tap
)
if
valid_ipv4
(
ip
):
v4_add
(
ip
)
elif
valid_ipv6
(
ip
):
v6_add
(
ip
)
# XXX: emit warning on unknown address type ?
options
[
'ipv4'
]
=
ipv4_set
options
[
'ipv6'
]
=
ipv6_set
options
[
'tap'
]
=
tap_set
options
[
'configuration'
]
=
parameter_dict
options
[
'configuration'
]
=
parameter_dict
match
=
self
.
OPTCRE_match
match
=
self
.
OPTCRE_match
for
key
,
value
in
parameter_dict
.
iteritems
():
for
key
,
value
in
parameter_dict
.
iteritems
():
...
...
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