Skip to content

Commit

Permalink
Merge pull request #109 from grycap/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
micafer authored Mar 1, 2024
2 parents 7c10e2b + 6da056d commit 7bf8dee
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
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

0 comments on commit 7bf8dee

Please sign in to comment.