Project

General

Profile

action #117790

osc-plugin-qam: TypeError in qam my subcommand during incident priority fetch size:M

Added by jbaier_cz 4 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
Start date:
2022-10-10
Due date:
% Done:

0%

Estimated time:

Description

This issue seems to be data related, the functionality was added in https://github.com/openSUSE/osc-plugin-qam/pull/10.

chubykalo@localhost:~> rpm -q osc-plugin-qam 
osc-plugin-qam-0.51.0-qam.3.1.noarch
chubykalo@localhost:~> ibs qam my 
Traceback (most recent call last): 
 File "/usr/bin/osc", line 45, in <module> 
   r = babysitter.run(osccli) 
 File "/usr/lib/python3.6/site-packages/osc/babysitter.py", line 67, in run 
   return prg.main(argv) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 349, in main 
   return self.cmd(args) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 372, in cmd 
   retval = self.onecmd(argv) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 506, in onecmd 
   return self._dispatch_cmd(handler, argv) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 1237, in _dispatch_cmd 
   return handler(argv[0], opts, *args) 
 File "/usr/lib/osc-plugins/qam.py", line 652, in do_qam 
   ret = interp.onecmd(sys.argv[index + 1 :]) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 506, in onecmd 
   return self._dispatch_cmd(handler, argv) 
 File "/usr/lib/python3.6/site-packages/osc/cmdln.py", line 1237, in _dispatch_cmd 
   return handler(argv[0], opts, *args) 
 File "/usr/lib/osc-plugins/qam.py", line 363, in do_my 
   self.do_assigned(subcmd, opts) 
 File "/usr/lib/osc-plugins/qam.py", line 327, in do_assigned 
   self._list_requests(action, opts.tabular, keys) 
 File "/usr/lib/osc-plugins/qam.py", line 206, in _list_requests 
   listdata = action() 
 File "/usr/lib/python3.6/site-packages/oscqam/actions/oscaction.py", line 33, in __call__ 
   return self.action(*args, **kwargs) 
 File "/usr/lib/python3.6/site-packages/oscqam/actions/listaction.py", line 50, in action 
   self.group_sort_reports() 
 File "/usr/lib/python3.6/site-packages/oscqam/actions/listaction.py", line 39, in group_sort_reports 
   lambda l: l.request.incident_priority, 
 File "/usr/lib/python3.6/site-packages/oscqam/utils.py", line 30, in multi_level_sort 
   xss = sorted(xs, key=extractor) 
 File "/usr/lib/python3.6/site-packages/oscqam/actions/listaction.py", line 39, in <lambda> 
   lambda l: l.request.incident_priority, 
 File "/usr/lib/python3.6/site-packages/oscqam/models/request.py", line 51, in incident_priority 
   self._priority = self.remote.priorities.for_request(self) 
 File "/usr/lib/python3.6/site-packages/oscqam/remotes/priorityremote.py", line 54, in for_request 
   return self._priority(request) 
 File "/usr/lib/python3.6/site-packages/oscqam/remotes/priorityremote.py", line 33, in _priority 
   return Priority(value.text) 
 File "/usr/lib/python3.6/site-packages/oscqam/domains.py", line 30, in __init__ 
   self.priority = int(prio) 
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Please also see the related conversation: https://suse.slack.com/archives/C02CUAYSFDL/p1665391706095299

Acceptance criteria

  • AC1: Empty priority is treated like no data (fetched from smelt)

Suggestions

  • Extend tests to cover a case with no priority

History

#1 Updated by jbaier_cz 4 months ago

  • Description updated (diff)

#2 Updated by osukup 4 months ago

Looks like value isn't None but value.text is. Which means attribute is defined in IBS and found by xml query but text of attribute is empty -> it looks wrong but, unfortunately we don't have treated this case.

solution is extend if condition or extend except clausule in https://github.com/openSUSE/osc-plugin-qam/blob/master/oscqam/remotes/priorityremote.py#L32-L37

#3 Updated by okurz 4 months ago

  • Priority changed from Normal to High
  • Target version set to Ready

#4 Updated by okurz 4 months ago

  • Tags set to reactive work

#5 Updated by jbaier_cz 4 months ago

  • Status changed from New to In Progress
  • Assignee set to jbaier_cz

#6 Updated by cdywan 4 months ago

  • Subject changed from osc-plugin-qam: TypeError in qam my subcommand during incident priority fetch to osc-plugin-qam: TypeError in qam my subcommand during incident priority fetch size:M
  • Description updated (diff)

#7 Updated by jbaier_cz 4 months ago

  • Status changed from In Progress to Feedback

A new test case for this issue and its resolution have been added inside https://github.com/openSUSE/osc-plugin-qam/pull/15

#8 Updated by jbaier_cz 4 months ago

  • Status changed from Feedback to Resolved

Fixed in version 0.52.0

Also available in: Atom PDF