From f4541b18e5bf2b50b3e2e565e162a7f47fd6aa49 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 25 Nov 2020 16:20:13 +0100 Subject: [PATCH 1/3] Require repository group in inventory --- .../engine/ansible/AnsibleInventoryUpgrade.py | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py b/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py index c49ccb3eb8..c02b27a816 100644 --- a/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py +++ b/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py @@ -101,26 +101,19 @@ def upgrade(self): merge_objdict(default_cluster_model, self.cluster_model) self.cluster_model = default_cluster_model - # Check if repo roles are present and if not add them - master = self.get_role(new_inventory, 'kubernetes_master') - if master == None: - raise Exception('No kubernetes_master to use as repository') - master_node = master.hosts[0] + # repository & image_registry roles added in v0.4.0 + repository = self.get_role(new_inventory, 'repository') + if repository == None: + raise Exception('repository group not found in inventory. ' + 'Your deployment may not be supported by this version of Epiphany. ' + 'You may try to use older version first.') - # add image_registry + # add image_registry if not present image_registry = self.get_role(new_inventory, 'image_registry') if image_registry == None: - hosts = [] - hosts.append(AnsibleHostModel(master_node.name, master_node.ip)) + hosts = [AnsibleHostModel(repository.hosts[0].name, repository.hosts[0].ip)] new_inventory.append(AnsibleInventoryItem('image_registry', hosts)) - # add repository - repository = self.get_role(new_inventory, 'repository') - if repository == None: - hosts = [] - hosts.append(AnsibleHostModel(master_node.name, master_node.ip)) - new_inventory.append(AnsibleInventoryItem('repository', hosts)) - # save new inventory save_inventory(new_inventory, self.cluster_model, self.build_dir) From 2ab4d49fe5c886b58c01793ab1e5160ef7a5c9e1 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 25 Nov 2020 17:00:43 +0100 Subject: [PATCH 2/3] Update changelog --- CHANGELOG-0.9.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG-0.9.md b/CHANGELOG-0.9.md index 1d1980d0f9..c9ae8165e6 100644 --- a/CHANGELOG-0.9.md +++ b/CHANGELOG-0.9.md @@ -14,6 +14,7 @@ - [#1833](https://github.com/epiphany-platform/epiphany/issues/1833) - DaemonSets of Node Exporter and Filebeat deploy in default namespace - [#1872](https://github.com/epiphany-platform/epiphany/issues/1872) - pythonPath in launch.json is not supported - [#1868](https://github.com/epiphany-platform/epiphany/issues/1868) - Repository host runs Ubuntu on Azure/RHEL cluster +- [#1875](https://github.com/epiphany-platform/epiphany/issues/1875) - epicli upgrade fails when there is no kubernetes_master group in inventory ### Updated From 0f7892d42726dcc379caf528059f539cfe3d92c8 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Wed, 25 Nov 2020 21:40:48 +0100 Subject: [PATCH 3/3] Change operator after code review --- core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py b/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py index c02b27a816..7a33560ef9 100644 --- a/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py +++ b/core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py @@ -103,14 +103,14 @@ def upgrade(self): # repository & image_registry roles added in v0.4.0 repository = self.get_role(new_inventory, 'repository') - if repository == None: + if repository is None: raise Exception('repository group not found in inventory. ' 'Your deployment may not be supported by this version of Epiphany. ' 'You may try to use older version first.') # add image_registry if not present image_registry = self.get_role(new_inventory, 'image_registry') - if image_registry == None: + if image_registry is None: hosts = [AnsibleHostModel(repository.hosts[0].name, repository.hosts[0].ip)] new_inventory.append(AnsibleInventoryItem('image_registry', hosts))