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

More Component Versions #112

Merged
merged 1 commit into from
Oct 28, 2024
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.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update Kubeconfig now has a name argument to name the user/context anything you want.
- Update Kubeconfig will always name the server after the Plan. This will share the same server for all tenants in the same plan. Also prevents unnecessary duplicates of the same server.
- Update kubeconfig will update the sections instead of skipping if they already exist. For example you can switch to interactive mode.
- Added more duplo component versions to the version command.

### Fixed

Expand Down
35 changes: 21 additions & 14 deletions src/duplo_resource/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,28 @@ class DuploVersion():
"""
def __init__(self, duplo: DuploClient):
self.duplo = duplo
self.paths = {
"ui": "build-metadata.json",
"frontdoor": "frontdoor/build-metadata.json",
"backend": "v3/version",
"auth": "v3/auth/version",
"katkit": "v3/katkit/version",
"billing": "v3/billing/version",
"security": "v3/security/version"
}

def __call__(self) -> dict:
ui = None
server = None
v = {
"cli": version('duplocloud-client')
v = {}
# first get cli version then server versions
v["cli"] = {
"tag": version('duplocloud-client')
}
try:
ui = self.duplo.get("build-metadata.json")
server = self.duplo.get("v3/version")
except Exception:
pass
finally:
if ui:
v["ui"] = ui.json()
if server:
v["server"] = server.json()
for (name, path) in self.paths.items():
try:
res = self.duplo.get(path).json()
except Exception as e:
self.duplo.logger.error(f"Failed to get version for {path}: {e}")
res = {"error": str(e)}
finally:
v[name] = res
return v