Bug 1313541 - repeat for_each doesn't work as documented in the heat templates
repeat for_each doesn't work as documented in the heat templates
Status: CLOSED CURRENTRELEASE
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat (Show other bugs)
7.0 (Kilo)
Unspecified Unspecified
high Severity high
: ---
: 7.0 (Kilo)
Assigned To: Zane Bitter
Amit Ugol
: TestOnly, Unconfirmed, ZStream
Depends On: 1339749
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-01 15:28 EST by Jeremy
Modified: 2016-08-05 13:38 EDT (History)
6 users (show)

See Also:
Fixed In Version: openstack-heat-2015.1.4-1.el7ost
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-08-05 13:38:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1466748 None None None 2016-03-01 17:02 EST
Launchpad 1553306 None None None 2016-03-04 13:36 EST
OpenStack gerrit 291343 None None None 2016-03-10 14:54 EST

  None (edit)
Description Jeremy 2016-03-01 15:28:52 EST
Description of problem:Set up heat templates according to documentation and get the following error:

http://docs.openstack.org/developer/heat/template_guide/hot_spec.html

[root@undercloud ~]# heat stack-create -f b.yaml s5
ERROR: The values of the "for_each" argument to "repeat" must be lists
[root@undercloud ~]# cat b.yaml 
heat_template_version: 2015-04-30

parameters:
  ports:
    type: comma_delimited_list
    label: ports
    default: "80,443,8080"

resources:
  security_group:
    type: OS::Neutron::SecurityGroup
    properties:
      name: web_server_security_group
      rules:
        repeat:
          for_each:
            <%port%>: { get_param: ports }
          template:
            protocol: tcp
            port_range_min: <%port%>
            port_range_max: <%port%>

[root@undercloud ~]# heat stack-create -f b.yaml s5
ERROR: The values of the "for_each" argument to "repeat" must be lists


Version-Release number of selected component (if applicable):
[root@undercloud ~]# rpm -qa | grep heat
openstack-heat-api-2015.1.1-7.el7ost.noarch
openstack-heat-api-cfn-2015.1.1-7.el7ost.noarch
openstack-tripleo-heat-templates-0.8.6-71.el7ost.noarch
openstack-heat-api-cloudwatch-2015.1.1-7.el7ost.noarch
openstack-heat-templates-0-0.6.20150605git.el7ost.noarch
openstack-heat-common-2015.1.1-7.el7ost.noarch
openstack-heat-engine-2015.1.1-7.el7ost.noarch
python-heatclient-0.6.0-1.el7ost.noarch


How reproducible:
100%

Steps to Reproduce:
1. set up heat template according to http://docs.openstack.org/developer/heat/template_guide/hot_spec.html
2.heat stack-create -f name.yaml s5
3.note failure: ERROR: The values of the "for_each" argument to "repeat" must be lists

Actual results:
fails

Expected results:
works

Additional info:
Comment 1 Zane Bitter 2016-03-01 17:02:29 EST
This was fixed upstream in 2015.1.3. We should probably do a rebase to pick it up, as we have most but not all of those patches.
Comment 2 Jeremy 2016-03-04 09:31:40 EST
What is an estimated time  when this fix will be available?
Comment 4 Zane Bitter 2016-03-04 13:36:38 EST
In my view the upstream fix was flawed and will cause a regression. I've opened a second upstream bug and I'm working on a more comprehensive fix:

https://bugs.launchpad.net/heat/+bug/1553306
Comment 5 Zane Bitter 2016-03-04 19:05:58 EST
Better fix submitted upstream.
Comment 6 Mike McCune 2016-03-28 19:47:57 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 8 Amit Ugol 2016-06-21 08:33:19 EDT
using the same template as initial comment I see the exact error:

[stack@undercloud ~]$ heat stack-create -f 123.yml b5
ERROR: The values of the "for_each" argument to "repeat" must be lists
[stack@undercloud ~]$ cat 123.yml
heat_template_version: 2015-04-30

parameters:
  ports:
    type: comma_delimited_list
    label: ports
    default: "80,443,8080"

resources:
  security_group:
    type: OS::Neutron::SecurityGroup
    properties:
      name: web_server_security_group
      rules:
        repeat:
          for_each:
            <%port%>: { get_param: ports }
          template:
            protocol: tcp
            port_range_min: <%port%>
            port_range_max: <%port%>
[stack@undercloud ~]$ rpm -qa | grep heat
openstack-heat-api-2015.1.4-1.el7ost.noarch
openstack-heat-common-2015.1.4-1.el7ost.noarch
heat-cfntools-1.2.8-2.el7.noarch
python-heatclient-0.6.0-1.el7ost.noarch
openstack-heat-engine-2015.1.4-1.el7ost.noarch
openstack-heat-api-cloudwatch-2015.1.4-1.el7ost.noarch
openstack-tripleo-heat-templates-0.8.6-126.el7ost.noarch
openstack-heat-templates-0-0.8.20150605git.el7ost.noarch
openstack-heat-api-cfn-2015.1.4-1.el7ost.noarch
Comment 10 Amit Ugol 2016-07-21 01:44:05 EDT
Taking it back.
The way that CI installs things is by installing the most up-to-date build, but using the GA version images/rpms as a base to the overcloud nodes, and the fix is not in those (older heat version) but after a careful update the fix is indeed there.
Comment 11 Lon Hohberger 2016-07-25 10:26:48 EDT
According to our records, this should be resolved by openstack-heat-2015.1.4-1.el7ost.  This build is available now.
Comment 12 Amit Ugol 2016-07-26 02:59:38 EDT
This was already verified on the correct version. The customer needs that version on his overcloud and that depends on how it was installed/updated.
In any event, on the correct version the fix works so I'm re-tagging.

Note You need to log in before you can comment on or make changes to this bug.