Public bug reported:

When creating nested stacks using OS::Heat::ResourceGroup, I've found
that even if I set heat_template_version in the templates, the version
that gets picked up by the nested stack is always the Kilo version,
i.e., 2015-04-30.

The reason why this happens is because, upon creation of the nested
stack and depending on what settings you are using, either
_assemble_nested() or _assemble_for_rolling_update() are called and
these two functions have as default argument value
template_version=('heat_template_version','2015-04-30'), and I cannot
see anywhere in the code where these two functions are called that this
default is overwritten to pick the template file value.

This has not necessarily caused an issue (yet!) but does not seem to be
a correct or the expected behavior.

Here's a simple reproducer:

```
$ cat stack.yaml
heat_template_version: 2021-04-16

resources:
  test_port:
    type: OS::Heat::ResourceGroup
    update_policy:
      batch_create:
        max_batch_size: 1
      rolling_update:
        max_batch_size: 1

    properties:
      count: 1
      resource_def:
        type: nestedstack.yaml

$ cat nestedstack.yaml
heat_template_version: 2021-04-16

resources:
  port:
    type: OS::Neutron::Port
    properties:
      fixed_ips: []
      network: "e08dd8fd-b484-4d3c-864a-b96a2dad61e3"
      port_security_enabled: False
      security_groups: []
      binding:vnic_type: "normal"
      value_specs: {}
      allowed_address_pairs: []
```

This results in:

```
$ openstack stack resource list -n 10 testport
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+
| resource_name | physical_resource_id                 | resource_type          
                                         | resource_status | updated_time       
  | stack_name                                     |
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+
| test_port     | afe9fe8c-e684-411a-9676-3e8345b66a47 | 
OS::Heat::ResourceGroup                                         | 
CREATE_COMPLETE | 2024-10-22T13:54:19Z | testport                               
        |
| 0             | 9c09f178-6cd2-4b9a-b72a-864135a1c938 | 
file:///home/ubuntu/stsstack-bundles/openstack/nestedstack.yaml | 
CREATE_COMPLETE | 2024-10-22T13:54:21Z | testport-test_port-hzkmmuz2m2zz        
        |
| port          | 0336c090-768b-47f3-b47a-dc9c9a43909e | OS::Neutron::Port      
                                         | CREATE_COMPLETE | 
2024-10-22T13:54:22Z | testport-test_port-hzkmmuz2m2zz-0-4f4qqzga5qcv |
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+

$ openstack stack template show afe9fe8c-e684-411a-9676-3e8345b66a47 | grep 
heat_template_version
heat_template_version: '2015-04-30'
```

when it should have been heat_template_version: '2021-04-16'

** Affects: heat (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  When creating nested stacks using OS::Heat::ResourceGroup, I've found
  that even if I set heat_template_version in the templates, the version
  that gets picked up by the nested stack is always the Kilo version,
  i.e., 2015-04-30.
  
  The reason why this happens is because, upon creation of the nested
  stack and depending on what settings you are using, either
  _assemble_nested() or _assemble_for_rolling_update() are called and
  these two functions have as default argument value
  template_version=('heat_template_version','2015-04-30'), and I cannot
  see anywhere in the code where these two functions are called that this
  default is overwritten to pick the template file value.
  
  This has not necessarily caused an issue (yet!) but does not seem to be
  a correct or the expected behavior.
  
- 
  Here's a simple reproducer:
  
  ```
  $ cat stack.yaml
  heat_template_version: 2021-04-16
-  
+ 
  resources:
-   test_port:
-     type: OS::Heat::ResourceGroup
-     update_policy:
-       batch_create:
-         max_batch_size: 1
-       rolling_update:
-         max_batch_size: 1
-  
-     properties:
-       count: 1
-       resource_def:
-         type: nestedstack.yaml
+   test_port:
+     type: OS::Heat::ResourceGroup
+     update_policy:
+       batch_create:
+         max_batch_size: 1
+       rolling_update:
+         max_batch_size: 1
  
+     properties:
+       count: 1
+       resource_def:
+         type: nestedstack.yaml
  
  $ cat nestedstack.yaml
  heat_template_version: 2021-04-16
-  
+ 
  resources:
-   port:
-     type: OS::Neutron::Port
-     properties:
-       fixed_ips: []
-       network: "e08dd8fd-b484-4d3c-864a-b96a2dad61e3"
-       port_security_enabled: False
-       security_groups: []
-       binding:vnic_type: "normal"
-       value_specs: {}
-       allowed_address_pairs: []
+   port:
+     type: OS::Neutron::Port
+     properties:
+       fixed_ips: []
+       network: "e08dd8fd-b484-4d3c-864a-b96a2dad61e3"
+       port_security_enabled: False
+       security_groups: []
+       binding:vnic_type: "normal"
+       value_specs: {}
+       allowed_address_pairs: []
  ```
  
  This results in:
  
  ```
  $ openstack stack resource list -n 10 testport
  
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+
  | resource_name | physical_resource_id                 | resource_type        
                                           | resource_status | updated_time     
    | stack_name                                     |
  
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+
  | test_port     | afe9fe8c-e684-411a-9676-3e8345b66a47 | 
OS::Heat::ResourceGroup                                         | 
CREATE_COMPLETE | 2024-10-22T13:54:19Z | testport                               
        |
  | 0             | 9c09f178-6cd2-4b9a-b72a-864135a1c938 | 
file:///home/ubuntu/stsstack-bundles/openstack/nestedstack.yaml | 
CREATE_COMPLETE | 2024-10-22T13:54:21Z | testport-test_port-hzkmmuz2m2zz        
        |
  | port          | 0336c090-768b-47f3-b47a-dc9c9a43909e | OS::Neutron::Port    
                                           | CREATE_COMPLETE | 
2024-10-22T13:54:22Z | testport-test_port-hzkmmuz2m2zz-0-4f4qqzga5qcv |
  
+---------------+--------------------------------------+-----------------------------------------------------------------+-----------------+----------------------+------------------------------------------------+
  
- 
- $ openstack stack template show 4e695d82-ecd6-4e2d-a5a4-a5d6c588ef8e | grep 
heat_template_version
+ $ openstack stack template show afe9fe8c-e684-411a-9676-3e8345b66a47 | grep 
heat_template_version
  heat_template_version: '2015-04-30'
  ```
  
  when it should have been heat_template_version: '2021-04-16'

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2085413

Title:
  heat_template_version defaulting to Kilo despite being set in template
  files

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/heat/+bug/2085413/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to