Commit 95625c99 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slaptest check if section are in slapos.cfg

slapos-start exit with 0 if no slapos.cfg is found
parent b9beef3e
......@@ -7,6 +7,11 @@ IPV6WAITTIME=5
SLAPOS_CONFIGURATION=/etc/opt/slapos/
if [ ! -f $SLAPOS_CONFIGURATION/slapos.cfg ]; then
echo "No slapos.cfg found"
exit 0
fi
echo "Starting slap script"
# Check ipv4
......
......@@ -114,6 +114,7 @@ def check_networkcache(config,logger,configuration_parser
Check network cache download
"""
section = "networkcache"
if configuration_parser.has_section(section) :
configuration_example_dict = dict(configuration_example_parser.items(section))
configuration_dict = dict(configuration_parser.items(section))
for key in configuration_example_dict:
......@@ -133,6 +134,7 @@ def check_networkcache(config,logger,configuration_parser
if config.check_upload == True :
check_networkcache_upload(config,logger,configuration_dict)
class Upload:
"""
Class used as a reference to check network cache upload
......@@ -223,8 +225,19 @@ def slapos_conf_check (config):
configuration_example_parser = ConfigParser.RawConfigParser()
configuration_example_parser.read(slapos_cfg_example)
os.remove(slapos_cfg_example)
# Check sections
mandatory_sections = ["slapos","slapformat","networkcache"]
for section in mandatory_sections:
if not configuration_parser.has_section(section):
logger.critical("No %s section in slapos.cfg" % section)
mandatory_sections.remove(section)
if 'networkcache' in mandatory_sections:
mandatory_sections.remove('networkcache')
# Check if parameters for slapos and slapformat exists
for section in ("slapos","slapformat"):
for section in mandatory_sections :
configuration_dict = dict(configuration_parser.items(section))
configuration_example_dict = dict(configuration_example_parser.items(section))
for key in configuration_example_dict:
......
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