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

Devel #109

Merged
merged 4 commits into from
Mar 1, 2024
Merged

Devel #109

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 templates/kafka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ metadata:
Kafka: kafka_.*
parents:
- kubernetes.yaml
- oscar.yaml

topology_template:

Expand Down
1 change: 1 addition & 0 deletions templates/nodered.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ metadata:
Node-RED: nodered_.*
parents:
- kubernetes.yaml
- oscar.yaml

topology_template:
inputs:
Expand Down
1 change: 1 addition & 0 deletions templates/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ metadata:
Grafana Data: .*
parents:
- kubernetes.yaml
- oscar.yaml

topology_template:
inputs:
Expand Down
1 change: 1 addition & 0 deletions templates/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
icon: images/registry.png
parents:
- kubernetes.yaml
- oscar.yaml

topology_template:

Expand Down
2 changes: 1 addition & 1 deletion templates/slurm_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Deploy a SLURM Virtual Cluster.

metadata:
template_name: SLURM
template_version: "1.0.1"
template_version: "1.1.0"
display_name: SLURM virtual cluster
icon: images/slurm.png
order: 4
Expand Down
6 changes: 3 additions & 3 deletions templates/tosca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ description: Deploy your own TOSCA template

metadata:
template_name: TOSCA
template_version: "1.0.0"
template_version: "1.0.1"
display_name: TOSCA Template
icon: images/tosca.png
tag: TOSCA
tag_color: orange
order: 6
tabs:
TOSCA:
- tosca
- tosca_url:
- tosca:
tag_type: textarea
- tosca_url

topology_template:

Expand Down
10 changes: 10 additions & 0 deletions tests/parse_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def _merge_templates(template, new_template):
for child in template["metadata"]["childs"]:
if not os.path.isfile(os.path.abspath(os.path.join(path, "..", "templates", child))):
raise Exception("Child template %s not found" % child)
with io.open(os.path.abspath(os.path.join(path, "..", "templates", child))) as cstream:
child_template = yaml.full_load(cstream)
# Check if the child template has this template as parent
if "metadata" in child_template and "parents" in child_template["metadata"]:
if name not in child_template["metadata"]["parents"]:
raise Exception("Child template %s does not have this template as parent" % child)
# Check all child templates meging with parents
if "metadata" in template and "parents" in template["metadata"]:
if "link" in template["metadata"]:
Expand All @@ -46,6 +52,10 @@ def _merge_templates(template, new_template):
print("Parent: " + parent)
with io.open(os.path.abspath(os.path.join(path, "..", "templates", parent))) as pstream:
parent_template = yaml.full_load(pstream)
# Check if the parent template has this template as child
if "metadata" in parent_template and "childs" in parent_template["metadata"]:
if name not in parent_template["metadata"]["childs"]:
raise Exception("Parent template %s does not have this template as child" % parent)
full_template = _merge_templates(parent_template, template)
ToscaTemplate(yaml_dict_tpl=full_template)
# Test also link templates
Expand Down