tempest-lib: can't recieve bytes output from ssh under pyhton3

Bug #1495181 reported by Andrey Pavlov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Undecided
Andrey Pavlov

Bug Description

I tried to run tests under python3 and got error from tempest_lib.common.ssh
This error occurs because channel returns binary_type under python3

(0):~/stackforge/ec2-api$ python3 -m subunit.run discover -t ./ ./ec2api/tests/functional/scenario/ | subunit-2to1 | tools/colorizer.py
ec2api.tests.functional.scenario.test_instances.InstancesTest
    test_userdata FAIL

Slowest 1 tests took 120.23 secs:
ec2api.tests.functional.scenario.test_instances.InstancesTest
    test_userdata 120.23

======================================================================
FAIL: ec2api.tests.functional.scenario.test_instances.InstancesTest.test_userdata
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: pythonlogging:'': {{{
2015-09-13 10:18:29,570 15182 WARNING [tempest_lib.common.ssh] Failed to establish authenticated ssh connection to cirros@172.24.4.34 ([Errno 113] No route to host). Number attempts: 1. Retry after 2 seconds.
2015-09-13 10:18:32,568 15182 WARNING [tempest_lib.common.ssh] Failed to establish authenticated ssh connection to cirros@172.24.4.34 ([Errno 113] No route to host). Number attempts: 2. Retry after 3 seconds.
2015-09-13 10:18:36,953 15182 WARNING [tempest_lib.common.ssh] Failed to establish authenticated ssh connection to cirros@172.24.4.34 ([Errno 111] Connection refused). Number attempts: 3. Retry after 4 seconds.
}}}

Traceback (most recent call last):
  File "/home/apavlov/stackforge/ec2-api/ec2api/tests/functional/scenario/test_instances.py", line 53, in test_userdata
    data = ssh_client.exec_command('curl %s/latest/user-data' % url)
  File "/usr/local/lib/python3.4/dist-packages/tempest_lib/common/ssh.py", line 147, in exec_command
    return ''.join(out_data)
TypeError: sequence item 0: expected str instance, bytes found

Ran 1 test in 121.986s

FAILED (failures=1)

Changed in tempest:
assignee: nobody → Andrey Pavlov (apavlov-e)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest-lib (master)

Reviewed: https://review.openstack.org/222901
Committed: https://git.openstack.org/cgit/openstack/tempest-lib/commit/?id=083f56ddc974beab4cd51e04ce25d38990151dad
Submitter: Jenkins
Branch: master

commit 083f56ddc974beab4cd51e04ce25d38990151dad
Author: Andrey Pavlov <email address hidden>
Date: Sun Sep 13 10:50:06 2015 +0300

    python3: converts binary data from channel

    paramiko returns chunk of binary type.
    So code must join all chunks with binary type and not as str.
    Also this patchset adds one more parameter 'encoding' for exec
    function to decode binary result to str.

    Closes-Bug: #1495181
    Change-Id: I886c9d0c143d3553876ece7b6d1ac2df7e49d701

Changed in tempest:
status: In Progress → Fix Committed
Changed in tempest:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.