Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1991439

Summary: Some hardcodes are detected at the code level in OpenShift console components
Product: OpenShift Container Platform Reporter: Xu Rui Li <xurl>
Component: Management ConsoleAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.8CC: aos-bugs, dtaylor, jokerman, rhamilto, spadgett, yapei
Target Milestone: ---Keywords: i18n, Translation
Target Release: 4.9.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1993999 1994094 1994098 1994117 (view as bug list) Environment:
Last Closed: 2021-10-18 17:45:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Some hardcodes list in the excel file.
none
unknown host translation none

Description Xu Rui Li 2021-08-09 07:19:12 UTC
Created attachment 1812280 [details]
Some hardcodes list in the excel file.

Description of problem:
Some hardcodes are detected at the code level in OpenShift console components

Version-Release number of selected component (if applicable):
4.8

How reproducible:

Steps to Reproduce:
By reviewing the source codes in OpenShift console with the Scan code tool, detect some hardcodes that list in OpenShiftHardCodelist.xlsx. Please double-check in the attached file OpenShiftHardCodelist.xlsx.
If they are the true hardcodes, please fix them.

Comment 2 Samuel Padgett 2021-08-16 13:39:21 UTC
Many of these instances are in dormant code that's not being used where we should simply remove the component (for instance, the service catalog components). prometheus.jsx and alert-manager.tsx are also legacy Tectonic resources that we can remove from console.

Comment 3 Robb Hamilton 2021-08-16 19:21:07 UTC
The code included in this bug actually spans multiple components and teams; therefore, I opened new bugs and assigned the relevant files to the associated component where appropriate:
* https://bugzilla.redhat.com/show_bug.cgi?id=1993999 for Console Storage Plugin
* https://bugzilla.redhat.com/show_bug.cgi?id=1994094 for Console Kubevirt Plugin

As Sam noted in https://bugzilla.redhat.com/show_bug.cgi?id=1991439#c2, several files are obsolete code that should be removed from the code base.  I opened https://bugzilla.redhat.com/show_bug.cgi?id=1994117 to address the removal of those files.

Finally, frontend/public/components/routes.tsx is the one file that will be updated to fix this bug.  PR to follow.

Comment 5 Yadan Pei 2021-08-23 07:37:57 UTC
Hi Robb,

return i18next.t('public~<unknown host>');

Why we return `<unknown host>` (with '<>') not simple string 'unknown host'(without <>)?

Comment 6 Yadan Pei 2021-08-23 07:39:01 UTC
Created attachment 1816711 [details]
unknown host translation

Comment 7 Robb Hamilton 2021-08-23 11:41:28 UTC
(In reply to Yadan Pei from comment #5)
> Hi Robb,
> 
> return i18next.t('public~<unknown host>');
> 
> Why we return `<unknown host>` (with '<>') not simple string 'unknown
> host'(without <>)?

That I do not know as that was the existing string.  It appears Dave Taylor added the string originally.  @dtaylor, any insight?

Comment 8 David Taylor 2021-08-23 13:38:52 UTC
Hi, orginally the string was 'return '<unknown host>', this was one of the orginal areas I worked on in 2018, so perhaps it was the standard at the time.   
Either way, we should be able to return just 'unknown host' without the <>.

Comment 9 Robb Hamilton 2021-08-23 14:48:29 UTC
Opened https://github.com/openshift/console/pull/9854 to remove `<>` from string.

Comment 12 Yadan Pei 2021-08-31 08:06:57 UTC
Moving to VERIFIED since now the string is updated to `unknown host` 

Verified on 4.9.0-0.nightly-2021-08-30-192239

Comment 15 errata-xmlrpc 2021-10-18 17:45:29 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 (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), 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/RHSA-2021:3759