Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epicli upgrade fails when there is no kubernetes_master group in inventory #1876

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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