Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1313541

Summary: repeat for_each doesn't work as documented in the heat templates
Product: Red Hat OpenStack Reporter: Jeremy <jmelvin>
Component: openstack-heatAssignee: Zane Bitter <zbitter>
Status: CLOSED CURRENTRELEASE QA Contact: Amit Ugol <augol>
Severity: high Docs Contact:
Priority: high    
Version: 7.0 (Kilo)CC: mburns, rhel-osp-director-maint, sbaker, shardy, srevivo, zbitter
Target Milestone: ---Keywords: TestOnly, Unconfirmed, ZStream
Target Release: 7.0 (Kilo)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 17:38:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1339749    
Bug Blocks:    

Description Jeremy 2016-03-01 20:28:52 UTC
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 22:02:29 UTC
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 14:31:40 UTC
What is an estimated time  when this fix will be available?

Comment 4 Zane Bitter 2016-03-04 18:36:38 UTC
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-05 00:05:58 UTC
Better fix submitted upstream.

Comment 6 Mike McCune 2016-03-28 23:47:57 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 8 Amit Ugol 2016-06-21 12:33:19 UTC
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 05:44:05 UTC
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 14:26:48 UTC
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 06:59:38 UTC
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.