1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Handle a missing cloud server section in the config file

This commit is contained in:
Jerry Seutter 2014-10-28 11:01:17 -06:00
parent 7830bf8b1a
commit 3a157b5e6d

View File

@ -26,6 +26,8 @@ import configparser
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
CLOUD_SERVER = 'CLOUD_SERVER'
class Config(object): class Config(object):
""" """
@ -81,9 +83,11 @@ class Config(object):
def read_cloud_config(self): def read_cloud_config(self):
parsed_file = self._cloud_config.read(self._cloud_file) parsed_file = self._cloud_config.read(self._cloud_file)
if not self._cloud_config.has_section(CLOUD_SERVER):
self._cloud_config.add_section(CLOUD_SERVER)
def cloud_settings(self): def cloud_settings(self):
return self._cloud_config['CLOUD_SERVER'] return self._cloud_config[CLOUD_SERVER]
def read_config(self): def read_config(self):
""" """