Bug 1741847

Summary: [Satellite6] satellite-change-hostname fails if locale is set to ja_JP.UTF-8
Product: Red Hat Satellite Reporter: Stefan Nemeth <snemeth>
Component: satellite-change-hostnameAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: apatel, jomitsch, kgaikwad, mbacovsk, mshira, ofedoren, pcreech, rabajaj, vijsingh
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:25:13 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:
Attachments:
Description Flags
hostname_change patch. executing hammer commands always under LANG=en_US.utf-8 none

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