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
Hardik Juneja
slapos.core
Commits
86893227
Commit
86893227
authored
Sep 12, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[format] Introduce create_tun config option (default false)
parent
8338ec42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
slapos/format.py
slapos/format.py
+6
-4
No files found.
slapos/format.py
View file @
86893227
...
@@ -468,7 +468,7 @@ class Computer(object):
...
@@ -468,7 +468,7 @@ class Computer(object):
user
=
user
,
user
=
user
,
address_list
=
address_list
,
address_list
=
address_list
,
tap
=
tap
,
tap
=
tap
,
tun
=
tun
,
tun
=
tun
if
conf
.
create_tun
else
None
,
external_storage_list
=
external_storage_list
,
external_storage_list
=
external_storage_list
,
)
)
...
@@ -1278,6 +1278,7 @@ def parse_computer_definition(conf, definition_path):
...
@@ -1278,6 +1278,7 @@ def parse_computer_definition(conf, definition_path):
ipv6_interface
=
conf
.
ipv6_interface
,
ipv6_interface
=
conf
.
ipv6_interface
,
software_user
=
computer_definition
.
get
(
'computer'
,
'software_user'
),
software_user
=
computer_definition
.
get
(
'computer'
,
'software_user'
),
tap_gateway_interface
=
conf
.
tap_gateway_interface
,
tap_gateway_interface
=
conf
.
tap_gateway_interface
,
conf
=
conf
)
)
partition_list
=
[]
partition_list
=
[]
for
partition_number
in
range
(
int
(
conf
.
partition_amount
)):
for
partition_number
in
range
(
int
(
conf
.
partition_amount
)):
...
@@ -1290,7 +1291,7 @@ def parse_computer_definition(conf, definition_path):
...
@@ -1290,7 +1291,7 @@ def parse_computer_definition(conf, definition_path):
tap
=
Tap
(
computer_definition
.
get
(
section
,
'network_interface'
))
tap
=
Tap
(
computer_definition
.
get
(
section
,
'network_interface'
))
tun
=
Tun
(
"slaptun"
+
str
(
partition_number
),
tun
=
Tun
(
"slaptun"
+
str
(
partition_number
),
partition_number
,
partition_number
,
int
(
conf
.
partition_amount
))
if
conf
.
create_t
ap
else
None
int
(
conf
.
partition_amount
))
if
conf
.
create_t
un
else
None
partition
=
Partition
(
reference
=
computer_definition
.
get
(
section
,
'pathname'
),
partition
=
Partition
(
reference
=
computer_definition
.
get
(
section
,
'pathname'
),
path
=
os
.
path
.
join
(
conf
.
instance_root
,
path
=
os
.
path
.
join
(
conf
.
instance_root
,
computer_definition
.
get
(
section
,
'pathname'
)),
computer_definition
.
get
(
section
,
'pathname'
)),
...
@@ -1356,7 +1357,7 @@ def parse_computer_xml(conf, xml_path):
...
@@ -1356,7 +1357,7 @@ def parse_computer_xml(conf, xml_path):
user
=
User
(
'%s%s'
%
(
conf
.
user_base_name
,
i
)),
user
=
User
(
'%s%s'
%
(
conf
.
user_base_name
,
i
)),
address_list
=
None
,
address_list
=
None
,
tap
=
Tap
(
'%s%s'
%
(
conf
.
tap_base_name
,
i
)),
tap
=
Tap
(
'%s%s'
%
(
conf
.
tap_base_name
,
i
)),
tun
=
Tun
(
'slaptun'
+
str
(
i
),
i
,
partition_amount
)
tun
=
Tun
(
'slaptun'
+
str
(
i
),
i
,
partition_amount
)
if
conf
.
create_tun
else
None
)
)
computer
.
partition_list
.
append
(
partition
)
computer
.
partition_list
.
append
(
partition
)
...
@@ -1437,6 +1438,7 @@ class FormatConfig(object):
...
@@ -1437,6 +1438,7 @@ class FormatConfig(object):
alter_network
=
None
alter_network
=
None
alter_user
=
None
alter_user
=
None
create_tap
=
None
create_tap
=
None
create_tun
=
None
computer_xml
=
None
computer_xml
=
None
computer_json
=
None
computer_json
=
None
input_definition_file
=
None
input_definition_file
=
None
...
@@ -1520,7 +1522,7 @@ class FormatConfig(object):
...
@@ -1520,7 +1522,7 @@ class FormatConfig(object):
self
.
use_unique_local_address_block
=
False
self
.
use_unique_local_address_block
=
False
# Convert strings to booleans
# Convert strings to booleans
for
option
in
[
'alter_network'
,
'alter_user'
,
'create_tap'
,
'use_unique_local_address_block'
]:
for
option
in
[
'alter_network'
,
'alter_user'
,
'create_tap'
,
'
create_tun'
,
'
use_unique_local_address_block'
]:
attr
=
getattr
(
self
,
option
)
attr
=
getattr
(
self
,
option
)
if
isinstance
(
attr
,
str
):
if
isinstance
(
attr
,
str
):
if
attr
.
lower
()
==
'true'
:
if
attr
.
lower
()
==
'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