Bug 1404297

Summary: Candlepin Docker Images UTF8
Product: [Community] Candlepin Reporter: Filip Nguyen <fnguyen>
Component: candlepinAssignee: Alex Wood <awood>
Status: CLOSED WORKSFORME QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: medium    
Version: 2.0CC: awood, khowell, redakkan, skallesh
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
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: 2017-01-24 21:53:07 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:

Description Filip Nguyen 2016-12-13 14:55:29 UTC
Description of problem:
When I build Candlepin docker images, they don't have UTF8 locale. That breaks Candlepin checkstyle checks, linter and unit tests. 

This may be (pure speculation) caused by update to centos:7 base image that we use.

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

How reproducible:
always

Steps to Reproduce:
1. cd candlepin/docker/candlepin-base/
2. sudo ./build.sh
3. cd candlepin/docker/candlepin-postgresql/
4. sudo ./build.sh
5. sudo docker run -i -P --rm -t -v art:/artifacts/ candlepin/candlepin-postgresql /bin/bash
6. cp-test -l -b jenkins -c "5fc768b7bf82f6ffcc23d14c3138879928b1c07e"

Actual results:
Bundle complete! 18 Gemfile dependencies, 52 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Running linter...
Buildr aborted!
ArgumentError : invalid byte sequence in US-ASCII

Expected results:
linter and checkstyle checks go through without an error

Additional info:
I currently use a workaround. I added the following at the end of our setup-*.sh scripts in candlepin-postgresql and candlepin-mysql images:

 localedef --quiet -v -c -i en_US -f UTF-8 en_US.UTF-8 || true
 echo "Locale output: "
 locale

The first line generates the locale and the command 'locale' is for debugging output.

Comment 1 Alex Wood 2017-01-24 21:53:07 UTC
I spent a few hours on this to no avail.  The candlepin-base image has LANG set to en_US.utf8 in the Dockerfile and the base image had UTF-8 locales (English only though according to `locale -a`).  If I ran a shell in the container and exported LANG to something like "es_ES.utf8" (a locale which the container doesn't even show as available), then I would see the "invalid byte sequence in US-ASCII" error, but I wasn't able to reproduce it with en_US.

Incidentally, if I ran `localedef --quiet -v -c -i es_ES -f UTF-8 es_ES.UTF-8` prior to running cp-test, I avoided the "invalid byte sequence" error.

I'm closing this for now as WORKSFORME.  If others run into it, they should feel free to reopen.