Skip to content

Commit

Permalink
epicli upgrade fails when there is no kubernetes_master group in inve…
Browse files Browse the repository at this point in the history
…ntory (#1876)

* Require repository group in inventory

* Update changelog
  • Loading branch information
to-bar authored Nov 26, 2020
1 parent 28d44c7 commit a493e15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 9 additions & 16 deletions core/src/epicli/cli/engine/ansible/AnsibleInventoryUpgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
# 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))
if image_registry is None:
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)

Expand Down

0 comments on commit a493e15

Please sign in to comment.