Bug 1663402

Summary: [ALL LANG][RHSM CLI] Unlocalized message in role module.
Product: Red Hat Enterprise Linux 8 Reporter: Lijun Li <lijli>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: jhnidek, jsefler, khowell, lmiksik, qe-i18n-bugs, redakkan, wpoteat
Target Milestone: rcKeywords: Reopened, Translation, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: subscription-manager-1.28.16-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1805619 (view as bug list) Environment:
Last Closed: 2021-11-09 19:37:12 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:
Bug Depends On: 1682763    
Bug Blocks: 1805619    

Description Lijun Li 2019-01-04 08:23:23 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
# subscription-manager role -h
使用:subscription-manager role [选项]

修改系统目的角色

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --set=SET             Set role of system purpose
  --unset               Unset role of system purpose
                        ^^^^^^^^^^^^^^^^^Unlocalized message.

# subscription-manager role --set "RHEL Server"
role set to "RHEL Server".
^^^^^^^^^^^^^^^Unlocalized message.

# subscription-manager role
Role not set.
^^^^^^Unlocalized message.


Expected results:
It should be localized.

Additional info:

Comment 1 Lijun Li 2019-07-01 03:41:34 UTC
This is also on latest rhel7.7 snapshot build.

Comment 2 Lijun Li 2019-10-15 07:14:08 UTC
Reproduced on latest rhel8.1 build.
# subscription-manager role -h
使用:subscription-manager role [选项]

Modify system purpose role

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --set=SET             Set role of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
  --unset               Unset role of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role --set "RHEL Server"
role set to "RHEL Server".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role
Current Role: RHEL Server
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role --unset
role unset.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.

Comment 3 Lijun Li 2019-10-15 07:14:52 UTC
# subscription-manager role -h
使用:subscription-manager role [选项]

Modify system purpose role
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --set=SET             Set role of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
  --unset               Unset role of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role --set "RHEL Server"
role set to "RHEL Server".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role
Current Role: RHEL Server
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
# subscription-manager role --unset
role unset.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.

Comment 7 John Sefler 2020-08-17 18:56:31 UTC
Testing with version....

[root@hpe-dl380pgen8-02-vm-15 ~]# rpm -q subscription-manager
subscription-manager-1.27.13-1.el8.x86_64
[root@hpe-dl380pgen8-02-vm-15 ~]# rpm -q subscription-manager --changelog | grep 1663402
- 1663116: 1663390: 1663402: 1663408: Update translations (wpoteat)
[root@hpe-dl380pgen8-02-vm-15 ~]# 



[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role -h
使用:subscription-manager role [选项]

修改系统目的角色                                            <====== PASSED

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         指定机构
  --set=SET             set role of system purpose       <====== FAILEDQA - CHANGED STRING (Set => set)
  --unset               unset role of system purpose     <====== FAILEDQA - CHANGED STRING (Unset => unset)
  --show                how this system's current role   <====== FAILEDQA - NEW UNTRANSLATED STRING
  --list                list all role available          <====== FAILEDQA - NEW UNTRANSLATED STRING



[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "RHEL Server"
Warning: Provided value "RHEL Server" is not included in the list of valid values  <====== FAILEDQA - NEW UNTRANSLATED STRING
 - Red Hat Enterprise Linux Workstation
 - Red Hat Enterprise Linux Server
 - Red Hat Enterprise Linux Compute Node
role 设置为 "RHEL Server"。                               <====== PASSED


[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role
Current Role: RHEL Server                                <====== FAILEDQA - UNTRANSLATED STRING "Current {name}: {val}" ???


[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role --unset
role 取消设置。                                           <====== PASSED



Moving back to NEW/FailedQA

Comment 9 John Sefler 2020-08-17 19:02:22 UTC
(In reply to John Sefler from comment #7)

> [root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role
> Current Role: RHEL Server                                <====== FAILEDQA - UNTRANSLATED STRING "Current {name}: {val}" ???


This appears to be working as expected - don't know why it failed for me the first time....

[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager role
Role 未设置。                               <====== PASSED

Comment 10 John Sefler 2020-08-17 20:04:01 UTC
Also note the typo in the msgstr...

[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager role -h | grep "this system's current"
  --show                how this system's current role
                        ^^^
                        FAILEDQA - EXPECTED "show"

Comment 12 Lijun Li 2020-09-07 09:00:17 UTC
Reproduced on latest rhel8.3 build.

[root@localhost ~]# subscription-manager role -h
使用:8 role [选项]

修改系统目的角色

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         指定机构
  --set=SET             set role of system purpose                     <====== FAILEDQA
  --unset               unset role of system purpose                     <====== FAILEDQA
  --show                how this system's current role                   <====== FAILEDQA & Typo how->show 
  --list                list all role available                     <====== FAILEDQA
[root@localhost ~]# subscription-manager role --set=test
Warning: Provided value "test" is not included in the list of valid values                     <====== FAILEDQA
 - Red Hat Enterprise Linux Server
role 设置为 "test"。
[root@localhost ~]# subscription-manager role --show
Current Role: Red Hat Enterprise Linux Server                     <====== FAILEDQA
[root@localhost ~]# subscription-manager role --list
+-------------------------------------------+
               Available role                     <====== FAILEDQA
+-------------------------------------------+
 - Red Hat Enterprise Linux Server
[root@localhost ~]# subscription-manager role
Current Role: Red Hat Enterprise Linux Server                     <====== FAILEDQA
[root@localhost ~]# rpm -q subscription-manager 
subscription-manager-1.27.15-1.el8.x86_64

Comment 17 RHEL Program Management 2021-02-01 07:31:37 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 18 John Sefler 2021-04-07 20:07:53 UTC
Re-testing with subscription-manager targeted for RHEL8.4...

[root@hpe-dl380pgen8-02-vm-2 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.4 Beta (Ootpa)
[root@hpe-dl380pgen8-02-vm-2 ~]# rpm -q subscription-manager
subscription-manager-1.28.13-2.el8.x86_64
[root@hpe-dl380pgen8-02-vm-2 ~]# rpm -q subscription-manager --changelog | grep 1899677 
- 1899677: Extract of strings for translations (#2399) (wpoteat)
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role -h
使用:subscription-manager role [选项]

修改系统目的角色

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         指定机构
  --set=SET             设置系统目的 role
  --unset               取消设置系统目的 role
  --show                显示本系统目前的 role
  --list                列出所有可用的 role
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "RHEL Server"
警告:所提供的值 "RHEL Server" 没有包括在有效值列表中
 - Red Hat Enterprise Linux Workstation
 - SP Server
 - Red Hat Enterprise Linux Server
 - Red Hat Enterprise Linux Compute Node
role 设置为 "RHEL Server"。
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role
Current Role: RHEL Server                                           <============ FAILED QA
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role --unset
role 取消设置。
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role --list
+-------------------------------------------+
                   可用 role
+-------------------------------------------+
 - Red Hat Enterprise Linux Workstation
 - SP Server
 - Red Hat Enterprise Linux Server
 - Red Hat Enterprise Linux Compute Node


[root@hpe-dl380pgen8-02-vm-2 ~]# msgunfmt --no-wrap  /usr/share/locale/zh_CN/LC_MESSAGES/rhsm.mo | grep -A1 "Current "
msgid "Current service level: %s"
msgstr "当前服务等级:%s"
--
msgid "Current {name}: {val}"
msgstr "当前 {name}: {val}"                       <========== EXPECTED THIS TRANSLATION TO BE USED
--
msgid "Installed Product Current Status:"
msgstr "已安装的产品的当前状态:"

Comment 19 Pino Toscano 2021-04-08 05:56:24 UTC
(In reply to John Sefler from comment #18)
> [root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager role
> Current Role: RHEL Server                                          <============ FAILED QA

> [root@hpe-dl380pgen8-02-vm-2 ~]# msgunfmt --no-wrap 
> msgid "Current {name}: {val}"
> msgstr "当前 {name}: {val}"                       <========== EXPECTED THIS TRANSLATION TO BE USED

Indeed, I can confirm this. The string is properly extracted and translated in some languages, however it is not translated properly at runtime due to a logic error:

            print(_("Current {name}: {val}".format(name=self.name.capitalize(),
                                                   val=values)))

(i.e. format() is applied on the English string, rather than the translated string.)

Thanks for testing, I'm reopening this bug and fixing this for 8.5.

Comment 21 Shwetha Kallesh 2021-05-04 11:41:17 UTC
Pre-verification comments:

[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.11-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8


[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager role -h
使用:subscription-manager role [选项]
 
修改系统目的角色
 
选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         指定机构
  --set=SET             设置系统目的 role
  --unset               取消设置系统目的 role
  --show                显示本系统目前的 role
  --list                列出所有可用的 role


[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "SP Server"
role 设置为 "SP Server"。

root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager role
当前 Role: SP Server

[root@ibm-x3650m4-01-vm-14 ~]#  LANG=zh_CN.utf-8 subscription-manager role --unset
role 取消设置。

[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager role -h | grep "this system's current"
  --show                show this system's current role


The following failing case of unlocalised warning message is tracked by the bug https://bugzilla.redhat.com/show_bug.cgi?id=1956764

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "RHEL Server"
Warning: Provided value "RHEL Server" is not included in the list of valid values
 - SP Starter
 - SP Server
role 设置为 "RHEL Server"。

Comment 24 Shwetha Kallesh 2021-05-20 05:46:45 UTC
Verification comments:

[root@kvm-02-guest25 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.11-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8


root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager role -h
使用:subscription-manager role [选项]

修改系统目的角色

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         指定机构
  --set=SET             设置系统目的 role
  --unset               取消设置系统目的 role
  --show                显示本系统目前的 role
  --list                列出所有可用的 role
[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "SP Server"
role 设置为 "SP Server"。
[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager role
当前 Role: SP Server
[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager role --unset
role 取消设置。


The following failing case of unlocalised warning message is tracked by the bug https://bugzilla.redhat.com/show_bug.cgi?id=1956764

[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager role --set "RHEL Server"
Warning: Provided value "RHEL Server" is not included in the list of valid values
 - SP Starter
 - SP Server
role 设置为 "RHEL Server"。

Comment 27 errata-xmlrpc 2021-11-09 19:37:12 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 (subscription-manager bug fix and enhancement 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/RHBA-2021:4390