stx-root: retag-images.sh: python error

Bug #1981107 reported by Davlet Panech
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Davlet Panech

Bug Description

Brief Description
-----------------
The script build-tools/build-docker-images/tag-management/retag-images.sh doesn't work. It seems to rely on an obsolete python2/yaml interface. It will probably work with older python 2.7.x versions.

Severity
--------
Major

Steps to Reproduce
------------------
Run "retag-images.sh image-tags --dryrun"

Expected Behavior
------------------
Script succeeds

Actual Behavior
----------------
Script fails:

Traceback (most recent call last):
  File "<string>", line 7, in <module>
AttributeError: 'module' object has no attribute 'FullLoader'

Reproducibility
---------------
Reproducible

System Configuration
--------------------
N/A

Branch/Pull Time/Commit
-----------------------
master/2022-07-06

Last Pass
---------
Unknown

Timestamp/Logs
--------------
$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

$ python --version
Python 2.7.5

$ pwd
/home/dpanech/git_work/cgcs-root/build-tools/build-docker-images/tag-management

$ ./retag-images.sh --dryrun image-tags.yaml
Traceback (most recent call last):
  File "<string>", line 7, in <module>
AttributeError: 'module' object has no attribute 'FullLoader'

Test Activity
-------------
N/A

Workaround
----------
Unknown

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to root (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/root/+/849729

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to root (master)

Reviewed: https://review.opendev.org/c/starlingx/root/+/849729
Committed: https://opendev.org/starlingx/root/commit/06d6a831b8df9bc976158e748f726639197850de
Submitter: "Zuul (22348)"
Branch: master

commit 06d6a831b8df9bc976158e748f726639197850de
Author: Davlet Panech <email address hidden>
Date: Wed Jul 13 15:17:20 2022 -0400

    retag-images: fix YAML module errors

    - Don't use yaml.FullLoader class. It's unsafe and doesn't exist in
      older versions of PyYAML

    - Fix code that tried to parse Docker REST JSON output using PyYAML. Use
      the json module instead.

    TESTS
    =======================================
    Run "retag-images.sh --dryrun" with both tags that already exist and
    tags that don't exist in DockerHub, and make sure there are no Python
    exceptions; in the following environments:

    * CentOS 7 / python 2.7.5
      - pyyaml 3.10 (centos)
      - pyyaml 5.4.1 (pypi.org)

    * Ubuntu 18 / python 2.7.17
      - pyyaml 3.12 (ubuntu)
      - pyyaml 5.4.1 (pypi.org)

    Closes-Bug: 1981107
    Signed-off-by: Davlet Panech <email address hidden>
    Change-Id: I9a7ecfd51ffb955f3ccc8f9b26ef610740fa400b

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.7.0 stx.build
Changed in starlingx:
assignee: nobody → Davlet Panech (dpanech)
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.