diff --git a/changelogs/fragments/coe_cluster_template_labels_comparison.yml b/changelogs/fragments/coe_cluster_template_labels_comparison.yml new file mode 100644 index 00000000..5d26647d --- /dev/null +++ b/changelogs/fragments/coe_cluster_template_labels_comparison.yml @@ -0,0 +1,7 @@ +--- + +bugfixes: + - | + coe_cluster_template - now labels are converted to strings by module that + fixes module idempotence in case label values defined by users are + integers or booleans. diff --git a/ci/roles/coe_cluster_template/tasks/main.yml b/ci/roles/coe_cluster_template/tasks/main.yml index f310ebb7..8e121604 100644 --- a/ci/roles/coe_cluster_template/tasks/main.yml +++ b/ci/roles/coe_cluster_template/tasks/main.yml @@ -26,6 +26,9 @@ keypair_id: '{{ keypair.keypair.id }}' name: k8s state: present + labels: + docker_volume_size: 10 + cloud_provider_tag: v1.23.1 register: coe_cluster_template - name: Assert return values of coe_cluster_template module @@ -43,6 +46,9 @@ keypair_id: '{{ keypair.keypair.id }}' name: k8s state: present + labels: + docker_volume_size: 10 + cloud_provider_tag: v1.23.1 register: coe_cluster_template - name: Assert return values of coe_cluster_template module diff --git a/plugins/modules/coe_cluster_template.py b/plugins/modules/coe_cluster_template.py index 7217a8b4..caed9fc4 100644 --- a/plugins/modules/coe_cluster_template.py +++ b/plugins/modules/coe_cluster_template.py @@ -433,6 +433,9 @@ class COEClusterTemplateModule(OpenStackModule): if isinstance(labels, str): labels = dict([tuple(kv.split(":")) for kv in labels.split(",")]) + elif isinstance(labels, dict): + labels = dict({str(k): str(v) + for k, v in labels.items()}) if labels != cluster_template['labels']: non_updateable_keys.append('labels')