Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
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
Lu Xu
slapos.package
Commits
ecefc35a
Commit
ecefc35a
authored
Mar 28, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewritten enable_bridge() to set create_tap
parent
e66208b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
slapprepare/slapprepare/slapprepare.py
slapprepare/slapprepare/slapprepare.py
+10
-16
No files found.
slapprepare/slapprepare/slapprepare.py
View file @
ecefc35a
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
from
optparse
import
OptionParser
,
Option
from
optparse
import
OptionParser
,
Option
import
ConfigParser
,
os
import
ConfigParser
,
os
import
pkg_resources
import
pkg_resources
from
shutil
import
mov
e
import
r
e
import
socket
import
socket
from
subprocess
import
call
as
subprocessCall
from
subprocess
import
call
as
subprocessCall
import
sys
import
sys
...
@@ -159,22 +159,16 @@ def get_computer_name(slapos_configuration):
...
@@ -159,22 +159,16 @@ def get_computer_name(slapos_configuration):
return
socket
.
gethostname
()
return
socket
.
gethostname
()
def
enable_bridge
(
slapos_configuration
):
def
enable_bridge
(
slapos_configuration
):
#Create temp file
# we don't use ConfigParser here, as it would remove comments
slapos_old_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg'
)
slapos_cfg_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg'
)
slapos_new_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg.tmp'
)
lines
=
[]
slapos_new
=
open
(
slapos_new_path
,
'w'
)
for
line
in
open
(
slapos_cfg_path
):
slapos_old
=
open
(
slapos_old_path
)
if
re
.
match
(
'^create_tap *='
,
line
):
for
line
in
slapos_old
:
line
=
'create_tap = true
\
n
'
slapos_new
.
write
(
line
.
replace
(
"create_tap = false"
,
"#create_tap = false"
))
lines
.
append
(
line
)
#close temp file
with
open
(
slapos_cfg_path
,
'w'
)
as
fout
:
slapos_new
.
close
()
fout
.
writelines
(
lines
)
slapos_old
.
close
()
#Remove original file
os
.
remove
(
slapos_old_path
)
#Move new file
move
(
slapos_new_path
,
slapos_old_path
)
# Function to get ssh key
# Function to get ssh key
...
...
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