Stack create failed when non-string fields in CephAnsibleEnvironmentVariables json

Bug #1878720 reported by Zhu Shengli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Undecided
Zhu Shengli

Bug Description

Description
===========
When `CephAnsibleEnvironmentVariables` contains non-string type values,
such as {"ANSIBLE_DEBUG": true},
No function "#operator_+" matches supplied arguments error will occur.

Steps to reproduce
==================
1. Add the following fields to parameter_defaults

```
parameter_defaults:
  CephAnsibleEnvironmentVariables:
    ANSIBLE_DEBUG: true
```
2. Deploy overcloud with it.

Expected result
===============
Stack create successfully.

Actual result
=============

overcloud.CephStorageServiceChain:
  resource_type: OS::TripleO::CephStorageServices
  physical_resource_id: 51fd6f95-027b-4047-9132-763e1cb8150c
  status: UPDATE_FAILED
  status_reason: |
    resources.CephStorageServiceChain: Error in 4 output role_data: Error in CephBase output role_data: No function "#operator_+" matches supplied arguments

Environment
===========
OSP16

Revision history for this message
Zhu Shengli (akarei) wrote :

assign to myself.

description: updated
Changed in tripleo:
assignee: nobody → Zhu Shengli (akarei)
status: New → In Progress
description: updated
Revision history for this message
Zhu Shengli (akarei) wrote :

Root Cause:

CephAnsibleEnvironmentVariables data is supposed to be transformed into "KEY=VALUE" format by yaql expression.

```
ceph_ansible_environment_variables:
  yaql:
    data: {get_param: CephAnsibleEnvironmentVariables}
    expression: $.data.items().select($[0] + '=' + $[1])
```

However, the expression here use `+` to join the key($[0]) and value($[1]), which will cause syntax error when value is not string type.

Revision history for this message
Zhu Shengli (akarei) wrote :

CephAnsibleEnvironmentVariables should accept any reasonable json value type(String, Number, Boolean, etc) just like CephAnsibleExtraConfig does.

Revision history for this message
Zhu Shengli (akarei) wrote :

Weird enough, it's not automatically updated by the review system.

https://review.opendev.org/#/c/728361/

Changed in tripleo:
status: In Progress → Fix Committed
Zhu Shengli (akarei)
Changed in tripleo:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.opendev.org/728361
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=7c46fd01425a40818916aeca227ec1dbfa1ec348
Submitter: Zuul
Branch: master

commit 7c46fd01425a40818916aeca227ec1dbfa1ec348
Author: Zhu Sheng Li <email address hidden>
Date: Fri May 15 12:44:45 2020 +0800

    Add non-string value support for CephAnsibleEnvironmentVariables

    CephAnsibleEnvironmentVariables data is supposed to be transformed
    into "KEY=VALUE" format by yaql expression.

    ```
    ceph_ansible_environment_variables:
      yaql:
        data: {get_param: CephAnsibleEnvironmentVariables}
        expression: $.data.items().select($[0] + '=' + $[1])
    ```

    However, the expression here uses `+` to join the key($[0]) and
    value($[1]), which will cause syntax error when value is not string
    type.

    For example:

    If we use boolean or integer for environment values such as
    ```
    parameter_defaults:
      CephAnsibleEnvironmentVariables:
        ANSIBLE_DEBUG: true
    ```

    the following error will occour

    ```
    overcloud.CephStorageServiceChain:
      resource_type: OS::TripleO::CephStorageServices
      physical_resource_id: 51fd6f95-027b-4047-9132-763e1cb8150c
      status: UPDATE_FAILED
      status_reason: |
        resources.CephStorageServiceChain:
        Error in 4 output role_data:
        Error in CephBase output role_data:
        No function "#operator_+" matches supplied arguments
    ```

    Change-Id: I8394cec6bbaca9c89c848eaddf724c072bc36cb3
    Closes-Bug: #1878720

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/731198

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/ussuri)

Reviewed: https://review.opendev.org/731198
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=48d735e723d963edb63a85701a94be47f405d407
Submitter: Zuul
Branch: stable/ussuri

commit 48d735e723d963edb63a85701a94be47f405d407
Author: Zhu Sheng Li <email address hidden>
Date: Fri May 15 12:44:45 2020 +0800

    Add non-string value support for CephAnsibleEnvironmentVariables

    CephAnsibleEnvironmentVariables data is supposed to be transformed
    into "KEY=VALUE" format by yaql expression.

    ```
    ceph_ansible_environment_variables:
      yaql:
        data: {get_param: CephAnsibleEnvironmentVariables}
        expression: $.data.items().select($[0] + '=' + $[1])
    ```

    However, the expression here uses `+` to join the key($[0]) and
    value($[1]), which will cause syntax error when value is not string
    type.

    For example:

    If we use boolean or integer for environment values such as
    ```
    parameter_defaults:
      CephAnsibleEnvironmentVariables:
        ANSIBLE_DEBUG: true
    ```

    the following error will occour

    ```
    overcloud.CephStorageServiceChain:
      resource_type: OS::TripleO::CephStorageServices
      physical_resource_id: 51fd6f95-027b-4047-9132-763e1cb8150c
      status: UPDATE_FAILED
      status_reason: |
        resources.CephStorageServiceChain:
        Error in 4 output role_data:
        Error in CephBase output role_data:
        No function "#operator_+" matches supplied arguments
    ```

    Change-Id: I8394cec6bbaca9c89c848eaddf724c072bc36cb3
    Closes-Bug: #1878720
    (cherry picked from commit 7c46fd01425a40818916aeca227ec1dbfa1ec348)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/744861

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/train)

Reviewed: https://review.opendev.org/744861
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=ef76e92bb30169f8379a1963567f6bb22e49043d
Submitter: Zuul
Branch: stable/train

commit ef76e92bb30169f8379a1963567f6bb22e49043d
Author: Zhu Sheng Li <email address hidden>
Date: Fri May 15 12:44:45 2020 +0800

    Add non-string value support for CephAnsibleEnvironmentVariables

    CephAnsibleEnvironmentVariables data is supposed to be transformed
    into "KEY=VALUE" format by yaql expression.

    ```
    ceph_ansible_environment_variables:
      yaql:
        data: {get_param: CephAnsibleEnvironmentVariables}
        expression: $.data.items().select($[0] + '=' + $[1])
    ```

    However, the expression here uses `+` to join the key($[0]) and
    value($[1]), which will cause syntax error when value is not string
    type.

    For example:

    If we use boolean or integer for environment values such as
    ```
    parameter_defaults:
      CephAnsibleEnvironmentVariables:
        ANSIBLE_DEBUG: true
    ```

    the following error will occour

    ```
    overcloud.CephStorageServiceChain:
      resource_type: OS::TripleO::CephStorageServices
      physical_resource_id: 51fd6f95-027b-4047-9132-763e1cb8150c
      status: UPDATE_FAILED
      status_reason: |
        resources.CephStorageServiceChain:
        Error in 4 output role_data:
        Error in CephBase output role_data:
        No function "#operator_+" matches supplied arguments
    ```

    Change-Id: I8394cec6bbaca9c89c848eaddf724c072bc36cb3
    Closes-Bug: #1878720

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 11.4.0

This issue was fixed in the openstack/tripleo-heat-templates 11.4.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.