Debian Patching: Patch Remove fails with stacktrace if patch does not exist

Bug #2003821 reported by Jessica Castelino
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Jessica Castelino

Bug Description

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

An attempt to remove a patch that does not exist, causes sw-patch-controller-daemon to die. This error is unreadable as well.
We need better handling in this case.

sudo sw-patch remove BLAH
An internal error has occurred. Please check /var/log/patching.log for details

2023-01-24T21:58:35: sw-patch-controller-daemon[1813]: patch_controller.py(2344): ERROR: An uncaught exception has occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python3/dist-packages/cgcs_patch/api/app.py", line 43, in __call__
    return self.v1(environ, start_response)
  File "/usr/lib/python3/dist-packages/pecan/middleware/recursive.py", line 56, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python3/dist-packages/pecan/core.py", line 840, in __call__
    return super(Pecan, self).__call__(environ, start_response)
  File "/usr/lib/python3/dist-packages/pecan/core.py", line 683, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/usr/lib/python3/dist-packages/pecan/core.py", line 574, in invoke_controller
    result = controller(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cgcs_patch/api/controllers/root.py", line 72, in remove
    result = pc.patch_remove_api(list(args), **kwargs)
  File "/usr/lib/python3/dist-packages/cgcs_patch/patch_controller.py", line 1270, in patch_remove_api
    ver = self.patch_data.metadata[patch_id]["sw_version"]
KeyError: 'BLAH'
2023-01-24T21:58:53: sw-patch-controller-daemon[1813]: patch_controller.py(2521): INFO: Detected thread death. Terminating
2023-01-24T21:59:03: sw-patch-controller-daemon[65613]: patch_controller.py(673): INFO: patch_op_counter is: 1
2023-01-24T21:59:03: sw-patch-controller-daemon[65613]: patch_controller.py(2706): INFO: launching
2023-01-24T21:59:03: sw-patch-agent[1808]: patch_agent.py(211): INFO: Handling detailed query

Severity
--------
Minor

Steps to Reproduce
------------------
sw-patch remove <Patch-that-doesn't-exist>

Expected Behavior
------------------
Better error handling and readable error

Actual Behavior
----------------
sw-patch-controller-daemon dies and the error presented is not user friendly

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

System Configuration
--------------------
All

Branch/Pull Time/Commit
-----------------------
24th Jan, 2023

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

Timestamp/Logs
--------------
N/A

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

Workaround
----------
N/A

Changed in starlingx:
assignee: nobody → Jessica Castelino (jcasteli)
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/+/871670

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/+/871670
Committed: https://opendev.org/starlingx/update/commit/87bc5039701abae5c4f6fc59bcf246e0dc7a9440
Submitter: "Zuul (22348)"
Branch: master

commit 87bc5039701abae5c4f6fc59bcf246e0dc7a9440
Author: Jessica Castelino <email address hidden>
Date: Tue Jan 24 23:01:39 2023 +0000

    Patch Remove fails with stacktrace if patch does not exist

    An attempt to remove a patch that does not exist, causes
    sw-patch-controller-daemon to die. This commit fixes the
    issue.

    Test Plan:
    Verified that the sw-patch-controller-daemon process is not
    killed after removing a patch that does not exist.

    Closes-Bug: 2003821
    Signed-off-by: Jessica Castelino <email address hidden>
    Change-Id: I49c43aab37608da0e11a78413842bf791b09b2b2

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