Bug 1319505 - 'dr', 'vr' and 'sr' options don't contain the check for the empty list of repos
Summary: 'dr', 'vr' and 'sr' options don't contain the check for the empty list of repos
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: Tools
Version: 2.1.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.0.0
Assignee: RHUI Bug List
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-20 18:19 UTC by Irina Gulina
Modified: 2017-03-01 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-01 22:11:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0367 0 normal SHIPPED_LIVE Red Hat Update Infrastructure 3.0 Release 2017-03-02 03:05:22 UTC

Description Irina Gulina 2016-03-20 18:19:18 UTC
Description of problem:
   dr  display repo sync summary
   vr  view the details of the last repository sync
   sr  sync an individual repository immediately
options don't check whether the list of repos is empty. And the user is offered to choose the repo from the empty list!

Version-Release number of selected component (if applicable):
RHEL-6.5-RHUI-2.1.3.1-20140912.1-Server-x86_64-DVD1.iso

>> rpm -qa "*rhui-tools*"
rh-rhui-tools-debug-script-2.1.39-1.el6_5.noarch
rh-rhui-tools-2.1.37-2.el6.noarch

How reproducible:
always

Steps to Reproduce:


             -= Red Hat Update Infrastructure Management Tool =-


-= Synchronization Status =-

   dr  display repo sync summary
   vr  view the details of the last repository sync
   sr  sync an individual repository immediately
   dc  display CDS sync summary
   vc  view the details of the last CDS sync
   sc  sync an individual CDS immediately
   sl  sync a CDS cluster immediately

   logout
       removes stored authentication credentials and exits

   <   move to the previous screen
   ^, home
       move to the home screen
   /, clear
       clears the screen
   ?, help
       display help
   q, quit, exit
       exit

                   Connected: XXX
------------------------------------------------------------------------------
rhui (sync) => vr

Select a repository: 
Enter value (1-0) or 'b' to abort: 
Enter value (1-0) or 'b' to abort: 
Enter value (1-0) or 'b' to abort: b


------------------------------------------------------------------------------
rhui (sync) => sr

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: 1

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: c


The following repositories will be scheduled for synchronization:
Proceed? (y/n) y



------------------------------------------------------------------------------
rhui (sync) => dr

-= Repository Synchronization Status =-

Last Refreshed: 14:12:39
(updated every 5 seconds, ctrl+c to exit)

Next Sync                    Last Sync                    Last Result         
------------------------------------------------------------------------------

                   Connected: XXX
------------------------------------------------------------------------------
^Crhui (sync) =>

Actual results:
The user is allowed to select a repository from the empty list!

Expected results:
A message: No repositories to schedule

Comment 3 Irina Gulina 2016-04-04 15:45:08 UTC
on RHUI3: 
>> rpm -qa *rhui*
rhui-installer-base-0.0.24-1.el7ui.noarch
rh-rhui-tools-libs-pre.3.0.16-1.el7ui.noarch
rhui-installer-0.0.24-1.el7ui.noarch
rh-rhui-tools-pre.3.0.16-1.el7ui.noarch
rhui-default-ca-1.0-1.noarch
rh-amazon-rhui-client-2.2.118-1.el7.noarch
rh-amazon-rhui-client-rhs30-2.2.124-1.el7.noarch

RHUI iso 20151013

rhui (sync) => vr

Select a repository:
Enter value (1-0) or 'b' to abort:
Enter value (1-0) or 'b' to abort: 1
Enter value (1-0) or 'b' to abort: 0


An unexpected error has occurred during the last operation.
More information can be found in /root/.rhui/rhui.log.


2016-04-04 11:33:32,652 - <type 'exceptions.IndexError'>
2016-04-04 11:33:32,652 - Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 88, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 122, in listen
    Shell.listen(self)
  File "/usr/lib/python2.7/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.7/site-packages/rhui/tools/screens/sync.py", line 106, in repo_details
    repo_id = repos[index]['id']
IndexError: list index out of range


sr

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: 1

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: c


The following repositories will be scheduled for synchronization:
Proceed? (y/n) y



------------------------------------------------------------------------------
rhui (sync) => sr  

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: 0

Select one or more repositories to schedule to be synchronized before its scheduled time.
The sync will happen as soon as possible depending on other tasks that may be executing
in the RHUI. Only repositories that are not currently synchronizing are displayed.

         Last Result         Next Sync         Repository
         ------------------------------------------

Enter value (1-0) to toggle selection, 'c' to confirm selections, or '?' for more commands: c



An unexpected error has occurred during the last operation.
More information can be found in /root/.rhui/rhui.log.

2016-04-04 11:42:06,019 - <type 'exceptions.IndexError'>
2016-04-04 11:42:06,020 - Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 88, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 122, in listen
    Shell.listen(self)
  File "/usr/lib/python2.7/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.7/site-packages/rhui/tools/screens/sync.py", line 176, in repo_sync
    selected_repos = [repos[index] for index in selected_repo_indices]
IndexError: list index out of range

Comment 5 bizhang 2016-10-24 15:54:04 UTC
Fixed functionality with 'sr' and 'vr'

The functionality 'dr' is correct in displaying a report with nothing in it if there is nothing to report.

Comment 6 Irina Gulina 2016-10-26 10:13:59 UTC
RHEL6 and 7 ISO's 20161025

                                                   Connected: rhua.example.com
------------------------------------------------------------------------------
rhui (sync) => vr

There are no synced repository records.

------------------------------------------------------------------------------
rhui (sync) => sr

There are no repositories available to be synced.

Comment 7 errata-xmlrpc 2017-03-01 22:11:46 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-2017:0367


Note You need to log in before you can comment on or make changes to this bug.