Bug 1444806 - [3.5] Unable to run upgrade playbook
Summary: [3.5] Unable to run upgrade playbook
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Cluster Version Operator
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 3.5.z
Assignee: Russell Teague
QA Contact: liujia
: 1446471 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2017-04-24 11:09 UTC by Jonas Nordell
Modified: 2017-05-17 17:40 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, the playbooks would abort if a namespace had non ASCII characters in their descriptions. The playbooks have been updated to to properly decode unicode characters ensuring that upgrades to 3.5 work as expected.
Clone Of:
Last Closed: 2017-05-17 17:40:17 UTC
Target Upstream Version:

Attachments (Terms of Use)
inventory file (884 bytes, text/plain)
2017-04-24 13:23 UTC, Jonas Nordell
no flags Details

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1244 normal SHIPPED_LIVE Important: ansible and openshift-ansible security and bug fix update 2017-05-25 21:43:49 UTC

Description Jonas Nordell 2017-04-24 11:09:36 UTC
Description of problem:

When trying to run /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_5/upgrade.yml it fail with the following error message

TASK [Check for invalid namespaces and SDN errors] *****************************
fatal: [osemaster1.somedomain.org]: FAILED! => {
    "changed": false,
    "failed": true,
    "module_stderr": "Shared connection to osemaster1.somedomain.org closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1420, in <module>\r\n    main()\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1413, in main\r\n    rval = OCObjectValidator.run_ansible(module.params)\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1375, in run_ansible\r\n    success, rval, invalid = objectvalidator.get_invalid(resource, invalid_filter)\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1324, in get_invalid\r\n    rval = self._get(kind)\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 853, in _get\r\n    rval = self.openshift_cmd(cmd, output=True)\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 979, in openshift_cmd\r\n    returncode, stdout, stderr = self._run(cmds, input_data)\r\n  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 954, in _run\r\n    return proc.returncode, stdout.decode(), stderr.decode()\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13263: ordinal not in range(128)\r\n"

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


How reproducible:

If I run "ansible-playbook -i /etc/ansible/hosts /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_5/upgrade.yml" it fails every time.

Steps to Reproduce:

Actual results:

Expected results:

Additional info:

Comment 1 Russell Teague 2017-04-24 13:06:54 UTC
Do you have unicode characters in your inventory file?  This can be caused by unicode characters and in some cases the unicode characters are unintentionally added while using some editors.

An example for checking for unicode characters:
$ grep --color='auto' -P -n "[\x80-\xFF]" <inventory_file>

Comment 2 Russell Teague 2017-04-24 13:14:03 UTC
If unicode characters are required, we can backport this fix in master:

Comment 3 Jonas Nordell 2017-04-24 13:23:04 UTC
No there are no unicode characters that I can find. Attached is a copy of my inventory file

Comment 4 Jonas Nordell 2017-04-24 13:23:40 UTC
Created attachment 1273614 [details]
inventory file

Comment 5 Mo 2017-04-24 13:36:16 UTC

Traceback (most recent call last):
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1420, in <module>
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1413, in main
    rval = OCObjectValidator.run_ansible(module.params)
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1375, in run_ansible
    success, rval, invalid = objectvalidator.get_invalid(resource, invalid_filter)
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 1324, in get_invalid
    rval = self._get(kind)
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 853, in _get
    rval = self.openshift_cmd(cmd, output=True)
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 979, in openshift_cmd
    returncode, stdout, stderr = self._run(cmds, input_data)
  File \"/tmp/ansible_7h8xiP/ansible_module_oc_objectvalidator.py\", line 954, in _run
    return proc.returncode, stdout.decode(), stderr.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13263: ordinal not in range(128)

The `decode` calls in `return proc.returncode, stdout.decode(), stderr.decode()` need to be updated to either work correctly with unicode or (worst case) throw away the data.

Comment 7 Russell Teague 2017-05-04 18:50:11 UTC
Proposed: https://github.com/openshift/openshift-ansible/pull/4098

Comment 10 liujia 2017-05-10 06:09:01 UTC

1. install ocp3.4
# openshift version
openshift v3.4.1.18
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0
2. new-project test with non ascii character in description
# oc describe project test 
Name:			test
Namespace:		<none>
Created:		About an hour ago
Labels:			<none>
Annotations:		openshift.io/description=中文
Display Name:		<none>
Description:		中文
Status:			Active
Node Selector:		<none>
Quota:			<none>
Resource limits:	<none>

3. run upgrade playbook
Upgrade succeed.
# openshift version
openshift v3.5.5.8
kubernetes v1.5.2+43a9be4
etcd 3.1.0

Change bug's status to verify.

Comment 11 Russell Teague 2017-05-10 12:47:44 UTC
*** Bug 1446471 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2017-05-17 17:40:17 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.


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