summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2016-08-19 15:51:13 -0400
committerSamuel Munilla <smunilla@redhat.com>2016-08-19 16:08:19 -0400
commit2bb4266be4f3e30f4ab1b22354bbeb68f3432df7 (patch)
tree29c9172455dd48c1c5403e90d6b8e438e93083c9 /utils/src/ooinstall
parentc38bd418e0940deb5fb3f57583d1e6d0019962cf (diff)
downloadopenshift-2bb4266be4f3e30f4ab1b22354bbeb68f3432df7.tar.gz
openshift-2bb4266be4f3e30f4ab1b22354bbeb68f3432df7.tar.bz2
openshift-2bb4266be4f3e30f4ab1b22354bbeb68f3432df7.tar.xz
openshift-2bb4266be4f3e30f4ab1b22354bbeb68f3432df7.zip
a-o-i: Remove Legacy Config Upgrade
Remove the automatic upgrade of the 3.0 configuration file format and add some better error messaging that points the user at the docs.
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r--utils/src/ooinstall/oo_config.py42
1 files changed, 13 insertions, 29 deletions
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index cc6f7b041..f2990662e 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -167,16 +167,23 @@ class OOConfig(object):
# pylint: disable=too-many-branches
def _read_config(self):
+ def _print_read_config_error(error, path='the configuration file'):
+ message = """
+Error loading config. {}.
+
+See https://docs.openshift.com/enterprise/latest/install_config/install/quick_install.html#defining-an-installation-configuration-file
+for information on creating a configuration file or delete {} and re-run the installer.
+"""
+ print message.format(error, path)
+
try:
if os.path.exists(self.config_path):
with open(self.config_path, 'r') as cfgfile:
loaded_config = yaml.safe_load(cfgfile.read())
- # Use the presence of a Description as an indicator this is
- # a legacy config file:
- if 'Description' in self.settings:
- self._upgrade_legacy_config()
-
+ if not 'version' in loaded_config:
+ _print_read_config_error('Legacy configuration file found', self.config_path)
+ sys.exit(0)
if loaded_config.get('version', '') == 'v1':
loaded_config = self._upgrade_v1_config(loaded_config)
@@ -185,7 +192,7 @@ class OOConfig(object):
host_list = loaded_config['deployment']['hosts']
role_list = loaded_config['deployment']['roles']
except KeyError as e:
- print "Error loading config, no such key: {}".format(e)
+ _print_read_config_error("No such key: {}".format(e), self.config_path)
sys.exit(0)
for setting in CONFIG_PERSIST_SETTINGS:
@@ -218,29 +225,6 @@ class OOConfig(object):
raise OOConfigFileError(
'Config file "{}" is not a valid YAML document'.format(self.config_path))
- def _upgrade_legacy_config(self):
- new_hosts = []
- remove_settings = ['validated_facts', 'Description', 'Name',
- 'Subscription', 'Vendor', 'Version', 'masters', 'nodes']
-
- if 'validated_facts' in self.settings:
- for key, value in self.settings['validated_facts'].iteritems():
- value['connect_to'] = key
- if 'masters' in self.settings and key in self.settings['masters']:
- value['master'] = True
- if 'nodes' in self.settings and key in self.settings['nodes']:
- value['node'] = True
- new_hosts.append(value)
- self.settings['hosts'] = new_hosts
-
- for s in remove_settings:
- if s in self.settings:
- del self.settings[s]
-
- # A legacy config implies openshift-enterprise 3.0:
- self.settings['variant'] = 'openshift-enterprise'
- self.settings['variant_version'] = '3.0'
-
def _upgrade_v1_config(self, config):
new_config_data = {}
new_config_data['deployment'] = {}