Commit 93ec8ed4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Make slapconsole section not compulsory.

slapconsole  should not fail  when there  is no  "slapconsole" section  in the
configuration file, as defaults should be enough.
parent 2807559a
...@@ -77,8 +77,11 @@ class Config: ...@@ -77,8 +77,11 @@ class Config:
configuration_parser = ConfigParser.SafeConfigParser() configuration_parser = ConfigParser.SafeConfigParser()
configuration_parser.read(configuration_file_path) configuration_parser.read(configuration_file_path)
# Merges the arguments and configuration # Merges the arguments and configuration
for section in ("slapconsole",): try:
configuration_dict = dict(configuration_parser.items(section)) configuration_dict = dict(configuration_parser.items("slapos"))
except ConfigParser.NoSectionError:
pass
else:
for key in configuration_dict: for key in configuration_dict:
if not getattr(self, key, None): if not getattr(self, key, None):
setattr(self, key, configuration_dict[key]) setattr(self, key, configuration_dict[key])
...@@ -98,7 +101,10 @@ def init(config): ...@@ -98,7 +101,10 @@ def init(config):
local = globals().copy() local = globals().copy()
local['slap'] = slap local['slap'] = slap
# Create aliases as global variables # Create aliases as global variables
alias = config.alias.split('\n') try:
alias = config.alias.split('\n')
except AttributeError:
alias = []
software_list = [] software_list = []
for software in alias: for software in alias:
if software is not '': if software is not '':
......
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