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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
slapos.package
Commits
754e4d30
Commit
754e4d30
authored
Mar 07, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor code that gets slapos.cfg content.
parent
b40d4426
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
slapprepare/slapprepare/slapprepare.py
slapprepare/slapprepare/slapprepare.py
+18
-13
No files found.
slapprepare/slapprepare/slapprepare.py
View file @
754e4d30
...
...
@@ -120,6 +120,23 @@ 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
if
not
slapos_configuration_file_path
:
slapos_configuration_file_path
=
"/etc/opt/slapos/slapos.cfg"
slapos_configuration_file_path_old
=
"/etc/slapos/slapos.cfg"
if
not
os
.
path
.
isfile
(
slapos_configuration_file_path
):
if
os
.
path
.
isfile
(
slapos_configuration_file_path_old
):
slapos_configuration_file_path
=
slapos_configuration_file_path_old
else
:
# No configuration found : returning
return
{}
# Reading slapos paths from configuration file
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'
)
:
...
...
@@ -554,20 +571,8 @@ def prepare_from_scratch(config):
return
return_code
def
chownSlaposDirectory
():
config
=
ConfigParser
.
RawConfigParser
()
# Search slapos.cfg
slapos_configuration_file_path
=
"/etc/opt/slapos/slapos.cfg"
slapos_configuration_file_path_old
=
"/etc/slapos/slapos.cfg"
if
not
os
.
path
.
isfile
(
slapos_configuration_file_path
):
if
os
.
path
.
isfile
(
slapos_configuration_file_path_old
):
slapos_configuration_file_path
=
slapos_configuration_file_path_old
else
:
# No configuration found : returning
return
config
=
getSlaposConfiguration
()
# Reading slapos paths from configuration file
config
.
read
(
slapos_configuration_file_path
)
slapos_slapgrid_instance
=
config
.
get
(
'slapos'
,
'instance_root'
)
slapos_slapgrid_software
=
config
.
get
(
'slapos'
,
'software_root'
)
slapformat_partition
=
config
.
get
(
'slapformat'
,
'partition_amount'
)
...
...
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