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
Léo-Paul Géneau
slapos.core
Commits
8dd06a69
Commit
8dd06a69
authored
Feb 01, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new option --no-bridge to run slapformat on real interface like eth0
parent
e82a51c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
slapos/format.py
slapos/format.py
+15
-4
No files found.
slapos/format.py
View file @
8dd06a69
...
...
@@ -291,7 +291,7 @@ class Computer(object):
return
computer
def
construct
(
self
,
alter_user
=
True
,
alter_network
=
True
):
def
construct
(
self
,
alter_user
=
True
,
alter_network
=
True
,
create_tap
=
True
):
"""
Construct the computer object as it is.
"""
...
...
@@ -328,7 +328,7 @@ class Computer(object):
else
:
owner
=
User
(
'root'
)
if
alter_network
:
if
alter_network
and
create_tap
:
# In case it has to be attached to the TAP network device, only one
# is necessary for the interface to assert carrier
if
self
.
interface
.
attach_to_tap
and
partition_index
==
0
:
...
...
@@ -372,7 +372,7 @@ class Computer(object):
else
:
raise
ValueError
(
'Address %r is incorrect'
%
address
[
'addr'
])
finally
:
if
alter_network
and
self
.
interface
.
attach_to_tap
:
if
alter_network
and
create_tap
and
self
.
interface
.
attach_to_tap
:
try
:
self
.
partition_list
[
0
].
tap
.
detach
()
except
IndexError
:
...
...
@@ -837,6 +837,10 @@ class Parser(OptionParser):
help
=
"Don't actually do anything."
,
default
=
False
,
action
=
"store_true"
),
Option
(
"-b"
,
"--no_bridge"
,
help
=
"Don't use bridge but use real interface like eth0."
,
default
=
False
,
action
=
"store_true"
),
Option
(
"-v"
,
"--verbose"
,
default
=
False
,
action
=
"store_true"
,
...
...
@@ -988,7 +992,7 @@ def run(config):
computer_definition
.
write
(
open
(
filepath
,
'w'
))
config
.
logger
.
info
(
'Stored computer definition in %r'
%
filepath
)
computer
.
construct
(
alter_user
=
config
.
alter_user
,
alter_network
=
config
.
alter_network
)
alter_network
=
config
.
alter_network
,
create_tap
=
not
config
.
no_bridge
)
# Dumping and sending to the erp5 the current configuration
if
not
config
.
dry_run
:
...
...
@@ -1048,6 +1052,11 @@ class Config(object):
'tap_base_name'
,
'ipv4_local_network'
,
'ipv6_interface'
]:
if
getattr
(
self
,
parameter
,
None
)
is
None
:
setattr
(
self
,
parameter
,
None
)
# Backward compatibility
if
not
getattr
(
self
,
"interface_name"
,
None
)
\
and
getattr
(
self
,
"bridge_name"
,
None
):
setattr
(
self
,
"interface_name"
,
self
.
bridge_name
)
# Set defaults lately
if
self
.
alter_network
is
None
:
...
...
@@ -1119,6 +1128,8 @@ class Config(object):
self
.
logger
.
debug
(
"Verbose mode enabled."
)
if
self
.
dry_run
:
self
.
logger
.
info
(
"Dry-run mode enabled."
)
if
self
.
no_bridge
:
self
.
logger
.
info
(
"No-bridge mode enabled."
)
# Calculate path once
self
.
computer_xml
=
os
.
path
.
abspath
(
self
.
computer_xml
)
...
...
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