Cannot use merge_configs module in python3

Bug #1820134 reported by Victor Coutellier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla-ansible
Fix Released
Undecided
Unassigned

Bug Description

Kolla-ansible is unusable in python3 since this commit https://github.com/openstack/kolla-ansible/commit/1db352f007e79f33d969361fa4997b60ef04e9a6 due to a wrong filemode when writing a file.

ansible/action_plugins/merge_configs.py#L179
try:
    result_file = os.path.join(local_tempdir, 'source')
    with open(result_file, 'wb') as f:
        f.write(full_source)

It result with this error :

The full traceback is:
Traceback (most recent call last):
  File "/Users/alistarle/venv/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/Users/alistarle/venv/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 612, in _execute
    result = self._handler.run(task_vars=variables)
  File "/Users/alistarle/Documents/Stage/kolla-ansible/ansible/action_plugins/merge_configs.py", line 180, in run
    f.write(full_source)
TypeError: a bytes-like object is required, not 'str'

As we are using six.StringIO for creating the file, I think we can use this code instead :
    result_file = os.path.join(local_tempdir, 'source')
    with open(result_file, 'w') as f:
        f.write(full_source)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla-ansible (master)

Reviewed: https://review.openstack.org/643479
Committed: https://git.openstack.org/cgit/openstack/kolla-ansible/commit/?id=85f7da979294d5bc18c6045465d2955945be3109
Submitter: Zuul
Branch: master

commit 85f7da979294d5bc18c6045465d2955945be3109
Author: Victor Coutellier <email address hidden>
Date: Thu Mar 14 23:33:08 2019 +0100

    Fix action_plugins python3 compatibility

    Fix filemode in the merge_configs and merge_yaml action plugin to
    be compatible with python3

    Change-Id: Ief64c5bdcd717141281e23c255a49ec02a96aef2
    Closes-Bug: #1820134

Changed in kolla-ansible:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla-ansible 8.0.0.0rc1

This issue was fixed in the openstack/kolla-ansible 8.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kolla-ansible (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/665193

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla-ansible (stable/rocky)

Reviewed: https://review.opendev.org/665193
Committed: https://git.openstack.org/cgit/openstack/kolla-ansible/commit/?id=f956996b61be089e815219ab30c19d39448f70ec
Submitter: Zuul
Branch: stable/rocky

commit f956996b61be089e815219ab30c19d39448f70ec
Author: Victor Coutellier <email address hidden>
Date: Thu Mar 14 23:33:08 2019 +0100

    Fix action_plugins python3 compatibility

    Fix filemode in the merge_configs and merge_yaml action plugin to
    be compatible with python3

    Change-Id: Ief64c5bdcd717141281e23c255a49ec02a96aef2
    Closes-Bug: #1820134
    (cherry picked from commit 85f7da979294d5bc18c6045465d2955945be3109)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla-ansible 7.1.2

This issue was fixed in the openstack/kolla-ansible 7.1.2 release.

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.