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
Łukasz Nowak
slapos.package
Commits
c19d4b77
Commit
c19d4b77
authored
Mar 28, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo and spacing
parent
ecefc35a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
slapprepare/slapprepare/slapprepare.py
slapprepare/slapprepare/slapprepare.py
+9
-11
No files found.
slapprepare/slapprepare/slapprepare.py
View file @
c19d4b77
...
...
@@ -105,13 +105,14 @@ def _call(cmd_args, stdout=None, stderr=None, dry_run=False):
raise
ExecError
(
'Process respond:"%s" when calling "%s"'
%
\
(
str
(
e
),
' '
.
join
(
cmd_args
)))
# Utility fonction to get yes/no answers
def
get_yes_no
(
prompt
,
default
=
None
):
if
default
:
def_value
=
'/ Default yes'
elif
default
==
False
:
def_value
=
'/ Default no'
else
:
else
:
def_value
=
''
while
True
:
answer
=
raw_input
(
prompt
+
" [y,n] %s: "
%
def_value
)
...
...
@@ -120,6 +121,7 @@ def get_yes_no (prompt,default=None):
if
not
default
==
None
:
if
answer
==
''
:
return
default
def
getSlaposConfiguration
(
slapos_configuration_file_path
=
None
):
config
=
ConfigParser
.
RawConfigParser
()
# Search slapos.cfg
...
...
@@ -137,6 +139,7 @@ def getSlaposConfiguration(slapos_configuration_file_path=None):
config
.
read
(
slapos_configuration_file_path
)
return
config
# Return OpenSUSE version if it is SuSE
def
suse_version
():
if
os
.
path
.
exists
(
'/etc/SuSE-release'
)
:
...
...
@@ -145,7 +148,7 @@ def suse_version():
if
"VERSION"
in
line
:
dist
=
line
.
split
()
return
float
(
dist
[
2
])
else
:
else
:
return
0
...
...
@@ -273,7 +276,6 @@ def slapserver(config):
pkg_resources
.
resource_stream
(
__name__
,
'template/limits.conf.in'
).
read
())
# Writing ssh key
if
config
.
need_ssh
:
user_path
=
os
.
path
.
normpath
(
'/'
.
join
([
mount_dir_path
,
'root'
]))
...
...
@@ -390,8 +392,6 @@ def prepare_scripts (config):
remove_former_scripts
(
slapos_configuration
)
def
configureNtp
():
"""Configures NTP daemon"""
server
=
"server pool.ntp.org"
...
...
@@ -457,7 +457,7 @@ class Config:
self
.
force_slapcontainer
=
get_yes_no
(
"Do you want to force the use lxc on this computer?"
,
False
)
if
self
.
force_vpn
:
self
.
ipv6_interface
=
"tapVPN"
else
:
else
:
self
.
ipv6_interface
=
""
self
.
need_ssh
=
get_yes_no
(
"Do you want a remote ssh access?"
,
True
)
...
...
@@ -475,17 +475,16 @@ class Config:
print
"Use a second disk: %s"
%
(
not
self
.
one_disk
)
def
prepare_from_scratch
(
config
):
try
:
temp_directory
=
os
.
path
.
join
(
'/tmp/slaptemp/'
)
temp_directory
=
os
.
path
.
join
(
'/tmp/slaptemp/'
)
if
not
os
.
path
.
exists
(
temp_directory
):
print
"Creating directory: %s"
%
temp_directory
os
.
mkdir
(
temp_directory
,
0711
)
while
True
:
config
.
userConfig
()
print
"
\
n
This your configuration:
\
n
"
print
"
\
n
This
is
your configuration:
\
n
"
config
.
displayUserConfig
()
if
get_yes_no
(
"
\
n
Do you confirm?"
):
break
...
...
@@ -559,6 +558,7 @@ def prepare_from_scratch(config):
return
return_code
def
chownSlaposDirectory
():
config
=
getSlaposConfiguration
()
...
...
@@ -585,7 +585,6 @@ def chownSlaposDirectory():
if
not
os
.
path
.
islink
(
item
):
os
.
chown
(
os
.
path
.
join
(
root
,
item
),
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
2
],
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
3
])
# chown of software root (/opt/slapgrid)
for
root
,
dirs
,
files
in
os
.
walk
(
slapos_slapgrid_software
):
for
items
in
dirs
,
files
:
...
...
@@ -632,7 +631,6 @@ def slapprepare():
_call
([
'systemctl'
,
'enable'
,
'slapos-boot-dedicated.service'
])
_call
([
'systemctl'
,
'start'
,
'slapos-boot-dedicated.service'
])
return_code
=
0
except
UsageError
,
err
:
print
>>
sys
.
stderr
,
err
.
msg
...
...
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