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

Fix setting some configuration for cluster in foundation #343

Merged
merged 2 commits into from
Jun 13, 2023
Merged
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
21 changes: 12 additions & 9 deletions plugins/module_utils/foundation/image_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,33 +111,36 @@ def _build_spec_blocks(self, payload, blocks):
payload["blocks"] = _blocks
return payload, None

def _build_spec_cluster(self, payload, param):
clusters = []
for cluster in param:
def _build_spec_cluster(self, payload, clusters):
cluster_specs = []
for cluster in clusters:
cluster_spec = self._get_default_cluster_spec(cluster)
cluster_spec["cluster_name"] = cluster.get("name")
cluster_spec["cluster_external_ip"] = cluster.get("cvm_vip", None)

if cluster_spec.get("cvm_ntp_servers"):
if cluster.get("cvm_ntp_servers"):
cluster_spec["cvm_ntp_servers"] = self._list2str(
cluster.get("cvm_ntp_servers")
)
if cluster_spec.get("cvm_dns_servers"):
if cluster.get("cvm_dns_servers"):
cluster_spec["cvm_dns_servers"] = self._list2str(
cluster.get("cvm_dns_servers")
)
if cluster_spec.get("hypervisor_ntp_servers"):
if cluster.get("hypervisor_ntp_servers"):
cluster_spec["hypervisor_ntp_servers"] = self._list2str(
cluster.get("hypervisor_ntp_servers")
)

if cluster.get("timezone"):
cluster_spec["timezone"] = cluster.get("timezone")

cluster_spec["cluster_members"] = cluster.get("cluster_members")

if len(cluster_spec["cluster_members"]) == 1:
if len(cluster["cluster_members"]) == 1:
cluster_spec["single_node_cluster"] = True

clusters.append(cluster_spec)
payload["clusters"] = clusters
cluster_specs.append(cluster_spec)
payload["clusters"] = cluster_specs
return payload, None

def _build_spec_hypervisor_iso(self, payload, value):
Expand Down