Bug 1808369

Summary: Upload-puppet-modules command if executed multiple times, then incorrectly creating the swift temp url
Product: Red Hat OpenStack Reporter: Rohini Diwakar <rdiwakar>
Component: openstack-tripleo-commonAssignee: Alan Bishop <abishop>
Status: CLOSED ERRATA QA Contact: Sasha Smolyak <ssmolyak>
Severity: medium Docs Contact:
Priority: medium    
Version: 16.0 (Train)CC: abishop, aschultz, jamsmith, jjoyce, jschluet, mburns, mgarciac, michele, pchavva, slinaber, tvignaud
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-tripleo-common-11.3.3-0.20200317125554.81d9792.el8ost Doc Type: Bug Fix
Doc Text:
This update fixes a bug that caused the `upload-puppet-modules` command to fail after the first invocation. A recent OpenStack command line interface update changed the OpenStack formats JSON data. That new format broke a script responsible for maintaining an internal URL used by the 'upload-puppet-modules' command. The script has been fixed to correctly handle the JSON data. Now the 'upload-puppet-modules' command functions correctly every time.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-14 12:16:10 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:    
Bug Blocks: 1824852    

Description Rohini Diwakar 2020-02-28 10:59:36 UTC
Description of problem:
upload-puppet-modules command if executed multiple times, then incorrectly creates the swift temp url. In the first run of upload puppet modules, it's creating the swift temp url correctly. But on subsequent runs, it is creating the url incorrectly. New temp url does not contain "temp_url_sig" field.

Version-Release number of selected component (if applicable):
Red Hat Openstack 16.0


Steps to Reproduce:

1. Run upload-puppet-modules command 
$ cp -r /usr/share/openstack-puppet/modules/tripleo ~/puppet-modules
$ upload-puppet-modules --directory puppet-modules

2. Check swift temp url created
It will look like following.

[stack@undercloud ~]$ cat /home/stack/.tripleo/environments/puppet-modules-url.yaml
# Heat environment to deploy artifacts via Swift Temp URL(s)
parameter_defaults:
    DeployArtifactURLs:
    - 'http://172.172.3.83:8080/v1/AUTH_2ba8739bd95040d38337e5ecbb68e620/overcloud-artifacts/puppet-modules.tar.gz?temp_url_sig=8790e72a801e8d8ad016b850c7fa0044f605f94f&temp_url_expires=1614329134

3. Now run upload-puppet-modules command again. It will throw a warning and will complete with incorrect swift temp url.

(undercloud) [stack@director ~]$ upload-puppet-modules --directory puppet-modules

Creating tarball...
Tarball created.
/usr/bin/upload-swift-artifacts: line 132: [: {'Temp-Url-Key':: binary operator expected
Creating heat environment file: /home/stack/.tripleo/environments/puppet-modules-url.yaml
Uploading file to swift: /tmp/puppet-modules-Nm6O2gc/puppet-modules.tar.gz
+-----------------------+---------------------+----------------------------------+
| object                | container           | etag                             |
+-----------------------+---------------------+----------------------------------+
| puppet-modules.tar.gz | overcloud-artifacts | 66f9c13bb4ee7f8fb20421dbb2dd3231 |
+-----------------------+---------------------+----------------------------------+
Upload complete.
sha1: Option -hmac needs a value
sha1: Use -help for summary.


(undercloud) [stack@director ~]$ cat /home/stack/.tripleo/environments/puppet-modules-url.yaml
# Heat environment to deploy artifacts via Swift Temp URL(s)
parameter_defaults:
    DeployArtifactURLs:
    - 'http://192.168.24.3:8080/v1/AUTH_0440bfe31e4d4d0b8b1f323cc52a8466/overcloud-artifacts/puppet-modules.tar.gz?temp_url_sig=&temp_url_expires=1614422474'

Actual results:
Subsequent upload of modules return invalid temp-url.

Expected results:
It should return valid temp-url as it does in first run of upload-puppet-modules command.

Additional info:
In RHOSP13, running upload-puppet-modules multiple times always returned a valid url.

Comment 1 Alan Bishop 2020-03-12 12:55:06 UTC
I fixed this on upstream master, and proposed the patches to stable/train.

Comment 14 errata-xmlrpc 2020-05-14 12:16:10 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:2114