Commit 74ef042c authored by Marco Mariani's avatar Marco Mariani

simpler getSlaposConfiguration()

parent 7f52951e
...@@ -126,21 +126,16 @@ def get_yes_no(prompt, default=None): ...@@ -126,21 +126,16 @@ def get_yes_no(prompt, default=None):
def getSlaposConfiguration(slapos_configuration_file_path=None): def getSlaposConfiguration(slapos_configuration_file_path=None):
for path in [
slapos_configuration_file_path,
'/etc/opt/slapos/slapos.cfg',
'/etc/slapos/slapos.cfg'
]:
if path and os.path.isfile(path):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
# Search slapos.cfg config.read(path)
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 config
return {}
# Return OpenSUSE version if it is SuSE # Return OpenSUSE version if it is SuSE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment