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
Lisa Casino
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 @@
from
optparse
import
OptionParser
,
Option
import
ConfigParser
,
os
import
pkg_resources
from
shutil
import
mov
e
import
r
e
import
socket
from
subprocess
import
call
as
subprocessCall
import
sys
...
...
@@ -159,22 +159,16 @@ def get_computer_name(slapos_configuration):
return
socket
.
gethostname
()
def
enable_bridge
(
slapos_configuration
):
#Create temp file
slapos_old_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg'
)
slapos_new_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg.tmp'
)
slapos_new
=
open
(
slapos_new_path
,
'w'
)
slapos_old
=
open
(
slapos_old_path
)
for
line
in
slapos_old
:
slapos_new
.
write
(
line
.
replace
(
"create_tap = false"
,
"#create_tap = false"
))
#close temp file
slapos_new
.
close
()
slapos_old
.
close
()
#Remove original file
os
.
remove
(
slapos_old_path
)
#Move new file
move
(
slapos_new_path
,
slapos_old_path
)
# we don't use ConfigParser here, as it would remove comments
slapos_cfg_path
=
os
.
path
.
join
(
slapos_configuration
,
'slapos.cfg'
)
lines
=
[]
for
line
in
open
(
slapos_cfg_path
):
if
re
.
match
(
'^create_tap *='
,
line
):
line
=
'create_tap = true
\
n
'
lines
.
append
(
line
)
with
open
(
slapos_cfg_path
,
'w'
)
as
fout
:
fout
.
writelines
(
lines
)
# 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