Bug 1741847 - [Satellite6] satellite-change-hostname fails if locale is set to ja_JP.UTF-8
Summary: [Satellite6] satellite-change-hostname fails if locale is set to ja_JP.UTF-8
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: satellite-change-hostname
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.7.0
Assignee: satellite6-bugs
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-16 09:01 UTC by Stefan Nemeth
Modified: 2020-04-14 13:25 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-14 13:25:13 UTC
Target Upstream Version:


Attachments (Terms of Use)
hostname_change patch. executing hammer commands always under LANG=en_US.utf-8 (524 bytes, patch)
2019-09-05 15:10 UTC, Stefan Nemeth
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 27811 Normal Closed satellite-change-hostname fails if locale is set to ja_JP.UTF-8 2020-09-01 10:33:21 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:25:27 UTC

Description Stefan Nemeth 2019-08-16 09:01:17 UTC
Description of problem:

#satellite-change-hostname -u admin -p redhat satellite.jp.test

fails with 

Failed 'hammer -u admin -p redhat capsule update --id  --url https://satellite.jp.test:9090 --new-name satellite.jp.test 2> /dev/null' with exit code 64

if locale is set to LANG=ja_JP.UTF-8

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

6.5

How reproducible:

100%

Steps to Reproduce:
1. set system locale to LANG=ja_JP.UTF-8
2. try to change hostname

Actual results:

Failed 'hammer -u admin -p redhat capsule update --id  --url https://satellite.jp.test:9090 --new-name satellite.jp.test 2> /dev/null' with exit code 64


Expected results:

hostname changed

Additional info:

setting locale to LANG=zh_CN or possible any with special characters will make command fails. I have not tested all locales.

Comment 3 Oleh Fedorenko 2019-09-04 14:12:22 UTC
Hi,

This doesn't seem to be a hammer bug.

I've checked the script
> satellite-change-hostname
which uses hammer and it seems to be that the hammer is wrongly used.

I run your command 
> satellite-change-hostname -u admin -p redhat satellite.jp.test
and it printed the same error:
> Failed 'hammer -u admin -p changeme capsule update --id  --url https://satellite.jp.test:9090 --new-name satellite.jp.test 2> /dev/null' with exit code 64

Notice that the value for --id option is missing. I guess it is nil because the id wasn't fetch within the script, so it causes mentioned error.

Also, if you run the hammer command by hand, it works. Moving to sattelite-change-hostname component.

Comment 4 Marek Hulan 2019-09-05 08:35:31 UTC
Per discussion with the reporter, the missing id is caused by the fact the previous hammer command prints values in different language thanks to locale, so the id can't be detected in hammer output. So the sattelite-change-hostname script should make sure it uses hammer with english locale only or uses json (which I'm not sure whether it also tries to translate keys)

Comment 6 Stefan Nemeth 2019-09-05 15:10:18 UTC
Created attachment 1612028 [details]
hostname_change patch. executing hammer commands always under LANG=en_US.utf-8

Comment 7 Stefan Nemeth 2019-09-10 09:05:46 UTC
created upstream issue https://projects.theforeman.org/issues/27811

Comment 8 Bryan Kearney 2019-09-30 12:05:58 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27811 has been resolved.

Comment 10 Peter Ondrejka 2020-01-03 16:17:03 UTC
Verified on Sat 6.7 snap 7

Comment 13 errata-xmlrpc 2020-04-14 13:25:13 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/RHSA-2020:1454


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