From 3a157b5e6d8781d830708c1a7de781510a8c01ad Mon Sep 17 00:00:00 2001 From: Jerry Seutter Date: Tue, 28 Oct 2014 11:01:17 -0600 Subject: [PATCH] Handle a missing cloud server section in the config file --- gns3server/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gns3server/config.py b/gns3server/config.py index 5ded482e8..41f922f40 100644 --- a/gns3server/config.py +++ b/gns3server/config.py @@ -26,6 +26,8 @@ import configparser import logging log = logging.getLogger(__name__) +CLOUD_SERVER = 'CLOUD_SERVER' + class Config(object): """ @@ -81,9 +83,11 @@ class Config(object): def read_cloud_config(self): 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): - return self._cloud_config['CLOUD_SERVER'] + return self._cloud_config[CLOUD_SERVER] def read_config(self): """