Skip to content

Commit b72cc06

Browse files
author
Bharat Kunwar
committed
Working yaql query
[stack@bharat-devstack p3-appliances]$ openstack stack failures list euc-ral euc-ral.cluster_group.1.port_group.1: resource_type: Cluster::NodeNet2 physical_resource_id: 9a259a43-c343-451d-87b9-c483e5fb1ad6 status: UPDATE_FAILED status_reason: | resources[1]: "count" is not a valid keyword inside a resource definition
1 parent 748e3fd commit b72cc06

File tree

1 file changed

+4
-53
lines changed

1 file changed

+4
-53
lines changed

files/resources/instance.yaml

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,6 @@ parameters:
4141
type: number
4242
label: Resource group index of this node
4343

44-
conditions:
45-
ports_gt_1_yaql:
46-
yaql:
47-
data:
48-
group_node_ports: { get_param: group_node_ports }
49-
expression: $.data.group_node_ports[0].len() > 1
50-
ports_gt_1:
51-
not:
52-
equals:
53-
- ports_gt_1_yaql
54-
- False
55-
56-
ports_gt_2_yaql:
57-
yaql:
58-
data:
59-
group_node_ports: { get_param: group_node_ports }
60-
expression: $.data.group_node_ports[0].len() > 2
61-
ports_gt_2:
62-
not:
63-
equals:
64-
- ports_gt_2_yaql
65-
- False
66-
6744
resources:
6845

6946
instance:
@@ -73,36 +50,10 @@ resources:
7350
flavor: { get_param: flavor }
7451
image: { get_param: image }
7552
key_name: { get_param: key_name }
76-
# FIXME: I would like to do this but Heat does not parse it:
77-
networks: { get_param: [ group_node_ports, {get_param: node_idx} ] }
78-
#networks:
79-
# list_concat:
80-
# - []
81-
# - { get_param: [ group_node_ports, {get_param: node_idx} ] }
82-
#networks:
83-
# - { get_param: [ group_node_ports, {get_param: node_idx}, 0 ] }
84-
#networks:
85-
# yaql:
86-
# data:
87-
# group_node_ports: { get_param: group_node_ports }
88-
# node_idx: { get_param: node_idx }
89-
# expression: $.data.group_node_ports[$.data.node_idx]
90-
#
91-
# FIXME: this works but is obviously limited to one port:
92-
#networks:
93-
# - port: { get_param: [ group_node_ports, {get_param: node_idx}, 0, port ] }
94-
#networks:
95-
# list_concat:
96-
# - [port: { get_param: [ group_node_ports, {get_param: node_idx}, 0, port ] }]
97-
# - if:
98-
# - ports_gt_1_yaql
99-
# - [port: { get_param: [ group_node_ports, {get_param: node_idx}, 1, port ] }]
100-
# - []
101-
# - if:
102-
# - False
103-
# - [port: { get_param: [ group_node_ports, {get_param: node_idx}, 2, port ] }]
104-
# - []
105-
53+
networks:
54+
yaql:
55+
expression: "$.data != '' and $.data.select({'port' => $.port}) or []"
56+
data: {get_param: [group_node_ports, {get_param: node_idx}]}
10657
availability_zone: { get_param: availability_zone }
10758
config_drive: { get_param: config_drive }
10859

0 commit comments

Comments
 (0)