Debian: sw-patch report-app-dependencies not working

Bug #1976535 reported by Al Bailey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Al Bailey

Bug Description

Brief Description
-----------------

 sw-patch report-app-dependencies fails silently

This is related to python3 bytes vs python2 string differences

ex:
 sw-patch report-app-dependencies --app cert-manager
(shows nothing)

logs show:
2022-06-01T16:46:16: sw-patch-controller-daemon[1498]: patch_controller.py(2089): INFO: Handling app dependencies report: app=cert-manager, patch_ids=
2022-06-01T16:46:16: sw-patch-controller-daemon[1498]: patch_controller.py(2110): ERROR: Failed in report_app_dependencies
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cgcs_patch/patch_controller.py", line 2105, in report_app_dependencies
    os.write(tmpfile, json.dumps(self.app_dependencies))
TypeError: a bytes-like object is required, not 'str'

Note: at this time, the patching code is still being developed,
that particular CLI command is not considered to be suported yet on Debian

Severity
--------
Minor

Steps to Reproduce
------------------
Unlock a Debian AIO-SX and run:
sw-patch report-app-dependencies --app cert-manager

Expected Behavior
------------------
Should show something

Actual Behavior
----------------
Shows nothing (and logs a stacktrace)

Reproducibility
---------------
100%

System Configuration
--------------------
Debian AIO-SX

Branch/Pull Time/Commit
-----------------------
June 1, 2022

Last Pass
---------
N/A

Timestamp/Logs
--------------
2022-06-01T16:46:16: sw-patch-controller-daemon[1498]: patch_controller.py(2089): INFO: Handling app dependencies report: app=cert-manager, patch_ids=
2022-06-01T16:46:16: sw-patch-controller-daemon[1498]: patch_controller.py(2110): ERROR: Failed in report_app_dependencies
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cgcs_patch/patch_controller.py", line 2105, in report_app_dependencies
    os.write(tmpfile, json.dumps(self.app_dependencies))
T

Test Activity
-------------
Developer Testing

Workaround
----------
None.

Al Bailey (albailey1974)
Changed in starlingx:
assignee: nobody → Al Bailey (albailey1974)
Ghada Khalil (gkhalil)
tags: added: stx.debian stx.update
Revision history for this message
Al Bailey (albailey1974) wrote :

Note: report_app_dependencies is returning 200 even when an exception is raised.

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

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

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

Reviewed: https://review.opendev.org/c/starlingx/update/+/849437
Committed: https://opendev.org/starlingx/update/commit/abaea457e5288ffec91545aaeda5250469184951
Submitter: "Zuul (22348)"
Branch: master

commit abaea457e5288ffec91545aaeda5250469184951
Author: Al Bailey <email address hidden>
Date: Mon Jul 11 18:49:51 2022 +0000

    Debian: Minor sw-patch cleanup

    - Adding missing requirements for sw-patch
    - Cleaning up redundant dependencies
    - Invoke clean as part of debian build
    - Rename Starlingx to StarlingX
    - Display error details for failed sw-patch commands
    - Fix a python3 string comparison affecting duplex
    - Fix report-app-dependencies
    - Remove 'six' from sw-patch since the code is py3 only
    - Fix a KeyError if restart_script not found in metadata.
    - Allow bandit to ignore 'input' checks on python3 since
    it is considered safe

    Test Plan:
      PASS: Build/Bootstrap/Unlock AIO-SX Debian
      PASS: sw-patch report-app-dependencies --app foo
      PASS: Upload/Apply/Remove/Delete a patch on AIO-DX system
           host-install was not tested on AIO-DX as that
           capability is still under active developement.

    Closes-Bug: #1976535
    Signed-off-by: Al Bailey <email address hidden>
    Change-Id: I94ec47e2f2087989da26ebab0e05c3b0d8f303e6

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.7.0
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.