Skip to content

Commit

Permalink
Merge pull request #868 from cderici/kubernetes-series-version-2.9
Browse files Browse the repository at this point in the history
[JUJU-3886] Kubernetes series version
  • Loading branch information
juanmanuel-tirado committed May 31, 2023
2 parents 1992aea + fc2f39c commit 9593122
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
16 changes: 13 additions & 3 deletions juju/utils.py
Expand Up @@ -316,11 +316,18 @@ def get_local_charm_charmcraft_yaml(path):
KINETIC: "22.10",
}

KUBERNETES = "kubernetes"
KUBERNETES_SERIES = {
KUBERNETES: "kubernetes"
}

ALL_SERIES_VERSIONS = {**UBUNTU_SERIES, **KUBERNETES_SERIES}


def get_series_version(series_name):
if series_name not in UBUNTU_SERIES:
if series_name not in ALL_SERIES_VERSIONS:
raise errors.JujuError("Unknown series : %s", series_name)
return UBUNTU_SERIES[series_name]
return ALL_SERIES_VERSIONS[series_name]


def get_version_series(version):
Expand Down Expand Up @@ -349,7 +356,10 @@ def get_local_charm_base(series, charm_path, base_class):
# we currently only support ubuntu series (statically)
# TODO (cderici) : go juju/core/series/supported.go and get the
# others here too
os_name_for_base = 'ubuntu'
if series in KUBERNETES_SERIES:
os_name_for_base = 'kubernetes'
else:
os_name_for_base = 'ubuntu'

# Check the charm manifest
if channel_for_base == '':
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/charm-series-kubernetes/config.yaml
@@ -0,0 +1,4 @@
options:
status:
type: string
default: "active"
13 changes: 13 additions & 0 deletions tests/integration/charm-series-kubernetes/dispatch
@@ -0,0 +1,13 @@
#!/bin/bash

status="$(config-get status)"

if [[ "$status" == "error" ]]; then
if [[ -e .errored ]]; then
status="active"
else
touch .errored
exit 1
fi
fi
status-set "$status"
5 changes: 5 additions & 0 deletions tests/integration/charm-series-kubernetes/metadata.yaml
@@ -0,0 +1,5 @@
name: charm
series: ["kubernetes"]
summary: "test"
description: "test"
maintainers: ["test"]

0 comments on commit 9593122

Please sign in to comment.