Bug 1724165 - ffwd-prepare fails with WorkflowActionError: Action tripleo.parameters.update execution failed: 400 Client Error: Bad Request for url: http://192.168.10.253:8080/home/stack/my_templates/network/scripts/run-os-net-config.sh
Summary: ffwd-prepare fails with WorkflowActionError: Action tripleo.parameters.update...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates
Version: 13.0 (Queens)
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Nate Johnston
QA Contact: Sasha Smolyak
URL:
Whiteboard:
Depends On:
Blocks: 1808025
TreeView+ depends on / blocked
 
Reported: 2019-06-26 11:32 UTC by Shatadru Bandyopadhyay
Modified: 2022-08-18 17:21 UTC (History)
7 users (show)

Fixed In Version: python-neutron-lib-1.13.0-2.el7ost openstack-tripleo-heat-templates-8.4.1-25.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1808025 (view as bug list)
Environment:
Last Closed: 2020-03-10 11:52:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
executor.log (4.75 MB, application/gzip)
2019-06-26 11:32 UTC, Shatadru Bandyopadhyay
no flags Details


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 678637 0 'None' MERGED Add ../network/scripts/ to search path for run-os-net-config.sh 2020-11-17 20:33:31 UTC
OpenStack gerrit 694400 0 'None' MERGED Add ../network/scripts/ to search path for run-os-net-config.sh 2020-11-17 20:33:30 UTC
Red Hat Issue Tracker OSP-3804 0 None None None 2022-08-18 17:21:04 UTC
Red Hat Product Errata RHBA-2020:0769 0 None None None 2020-03-10 11:53:28 UTC

Description Shatadru Bandyopadhyay 2019-06-26 11:32:36 UTC
Created attachment 1584770 [details]
executor.log

Description of problem:
ffwd-prepare fails with WorkflowActionError: Action tripleo.parameters.update execution failed: 400 Client Error: Bad Request for url: http://192.168.10.253:8080/home/stack/my_templates/network/scripts/run-os-net-config.sh

The issue is in get_file `/usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh` was getting hardcoded.
~~~
  OsNetConfigImpl:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
        str_replace:
          template:
            get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
~~~

After we changed this to below the `ffwd-upgrade prepare` worked fine:
~~~
  OsNetConfigImpl:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
        str_replace:
          template:
            get_file: ../network/scripts/run-os-net-config.sh
~~~

To be noted the config file was not generated manually but by  yaml-nic-config-2-script.py 

The issue is yaml-nic-config-2-script.py hardcode `/usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh` even if I am passing --script-dir

Version-Release number of selected component (if applicable):


How reproducible:

Always when a custom template dir is used for deoployment

Steps to Reproduce:

# /usr/share/openstack-tripleo-heat-templates/tools/yaml-nic-config-2-script.py --script-dir /home/stack/newtemp/ /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml 
Using script at /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
The yaml file will be overwritten and the original saved as /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml.20190626070510
Overwrite /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml? [y/n] y
Converting /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml

 grep -i get_file /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml
            get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh

After this ffwd-prepare fails. 

Actual results:
yaml-nic-config-2-script.py is hard coding the path and as a result ffwd-upgrade prepare fails.

Expected results:
yaml-nic-config-2-script.py should use relative path when --script-dir is used.




Additional info:
I see a similar bugreport where `--script-dir` option was suggested but that is not helping either.

Comment 3 Harald Jensås 2019-07-09 20:25:15 UTC
(In reply to Shatadru Bandyopadhyay from comment #0)

> Steps to Reproduce:
> 
> #
> /usr/share/openstack-tripleo-heat-templates/tools/yaml-nic-config-2-script.py --script-dir /home/stack/newtemp/ /home/stack/virt/network/three-nics-vlans/legacy/compute.yaml
                                                                                              ? That's not a path to run-os-net-config.sh, it's a path to a directory.

    parser.add_argument('--script-dir', metavar='<script directory>',
                        help="Relative path to run-os-net-config.sh",
                        default="network/scripts/run-os-net-config.sh")

It's supposed to take a relative path to the actual script.


 Some examples:

With a structure similar to what you find in THT, it just works
###############################################################

$ tree
.
└── network
    ├── config
    │   └── multiple-nics
    │       └── compute.yaml
    └── scripts
        └── run-os-net-config.sh

$ /tmp/bz1724165/tripleo-heat-templates/tools/yaml-nic-config-2-script.py network/config/multiple-nics/compute.yaml 

Using script at ../../scripts/run-os-net-config.sh
The yaml file will be overwritten and the original saved as /tmp/bz1724165/newtemp/network/config/multiple-nics/compute.yaml.20190709214724
Overwrite network/config/multiple-nics/compute.yaml? [y/n] y
Converting network/config/multiple-nics/compute.yaml

$ grep -i get_file network/config/multiple-nics/compute.yaml
            get_file: ../../scripts/run-os-net-config.sh


To use a different path for the run-os-net-config.sh script you need to specify a path relative to the nic config file itself
#############################################################################################################################

For example:

[hjensas@floke newtemp2]$ tree
.
├── nic-configs
│   └── compute.yaml
└── script
    └── run-os-net-config.sh

2 directories, 2 files
$ /tmp/bz1724165/tripleo-heat-templates/tools/yaml-nic-config-2-script.py --script-dir ../script/run-os-net-config.sh nic-configs/compute.yaml 
                                                                                       ^^ relative location looking from ^^

Using script at ../script/run-os-net-config.sh
The yaml file will be overwritten and the original saved as /tmp/bz1724165/newtemp2/nic-configs/compute.yaml.20190709221457
Overwrite nic-configs/compute.yaml? [y/n] y
Converting nic-configs/compute.yaml

$ grep -i get_file nic-configs/compute.yaml
            get_file: ../script/run-os-net-config.sh



NOTE, you can also use an absolute path, for example:

$ tree
.
└── nic-configs
    └── compute.yaml

$ /tmp/bz1724165/tripleo-heat-templates/tools/yaml-nic-config-2-script.py --script-dir /tmp/bz1724165/tripleo-heat-templates/network/scripts/run-os-net-config.sh nic-configs/compute.yaml 

Using script at /tmp/bz1724165/tripleo-heat-templates/network/scripts/run-os-net-config.sh
The yaml file will be overwritten and the original saved as /tmp/bz1724165/newtemp2/nic-configs/compute.yaml.20190709221845
Overwrite nic-configs/compute.yaml? [y/n] y
Converting nic-configs/compute.yaml

$ grep -i get_file nic-configs/compute.yaml
            get_file: /tmp/bz1724165/tripleo-heat-templates/network/scripts/run-os-net-config.sh

Comment 4 Nate Johnston 2019-08-26 19:01:20 UTC
Push change to add ../network/scripts/ to the search path.

Comment 5 Nate Johnston 2019-08-29 22:38:40 UTC
Upstream change approved, waiting for it to merge so I can backport.

Comment 16 errata-xmlrpc 2020-03-10 11:52:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0769


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