nova_cell_v2_discover_host.py issues with python3

Bug #1813014 reported by Michele Baldessari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Michele Baldessari

Bug Description

        "Error running ['podman', 'run', '--name', 'nova_cellv2_discover_hosts', '--label', 'config_id=tripleo_step5', '--label', 'container_name=nova_cellv2_discover_hosts', '--label', 'managed_by=paunch', '--label', 'config_data={\"command\": \"/docker-config-scripts/pyshim.sh /docker-config-scripts/nova_cell_v2_discover_host.py\", \"detach\": false, \"image\": \"192.168.122.1:5000/fedora-binary-nova-compute:ospsprint\", \"net\": \"host\", \"start_order\": 0, \"user\": \"root\", \"volumes\": [\"/etc/hosts:/etc/hosts:ro\", \"/etc/localtime:/etc/localtime:ro\", \"/etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro\", \"/etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro\", \"/etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro\", \"/etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro\", \"/etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro\", \"/dev/log:/dev/log\", \"/etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro\", \"/etc/puppet:/etc/puppet:ro\", \"/var/lib/config-data/nova_libvirt/etc/nova/:/etc/nova/:ro\", \"/var/log/containers/nova:/var/log/nova\", \"/var/lib/docker-config-scripts/:/docker-config-scripts/\"]}', '--net=host', '--user=root', '--volume=/etc/hosts:/etc/hosts:ro', '--volume=/etc/localtime:/etc/localtime:ro', '--volume=/etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro', '--volume=/etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro', '--volume=/etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro', '--volume=/etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro', '--volume=/etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro', '--volume=/dev/log:/dev/log', '--volume=/etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro', '--volume=/etc/puppet:/etc/puppet:ro', '--volume=/var/lib/config-data/nova_libvirt/etc/nova/:/etc/nova/:ro', '--volume=/var/log/containers/nova:/var/log/nova', '--volume=/var/lib/docker-config-scripts/:/docker-config-scripts/', '192.168.122.1:5000/fedora-binary-nova-compute:ospsprint', '/docker-config-scripts/pyshim.sh', '/docker-config-scripts/nova_cell_v2_discover_host.py']. [1]",
        "",
        "stdout: ",
        "stderr: + command -v python3",
        "+ python3 /docker-config-scripts/nova_cell_v2_discover_host.py",
        "Traceback (most recent call last):",
        " File \"/docker-config-scripts/nova_cell_v2_discover_host.py\", line 75, in <module>",
        "TypeError: a bytes-like object is required, not 'str'"
    ]

This is because in python3 subprocess.check_output() will return bytes and trying to split it using a string '\n' will break with the error above.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (master)

Fix proposed to branch: master
Review: https://review.openstack.org/632717

Changed in tripleo:
assignee: nobody → Michele Baldessari (michele)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.openstack.org/632717
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=87a869a408b9732e9ff46e8fecfa1487b3699ffa
Submitter: Zuul
Branch: master

commit 87a869a408b9732e9ff46e8fecfa1487b3699ffa
Author: Michele Baldessari <email address hidden>
Date: Wed Jan 23 14:10:41 2019 +0100

    Fix nova_cell_v2_discover_host.py with python3

    When this script runs via python3 it fails with:

      "stdout: ",
      "stderr: + command -v python3",
      "+ python3 /docker-config-scripts/nova_cell_v2_discover_host.py",
      "Traceback (most recent call last):",
      " File \"/docker-config-scripts/nova_cell_v2_discover_host.py\", line 75, in <module>",
      " TypeError: a bytes-like object is required, not 'str'"

    This is because in python3 subprocess.check_output() will return bytes
    and trying to split it using a string '\n' will break with the error
    above. Let's just use the universal_newlines=True parameter which we
    have been using everywhere in tripleo so far.
    Also skip any empty lines that might show up in the output which would
    give the error:

      ValueError: not enough values to unpack (expected 2, got 0)

    Tested with a python3 deployment and got a successful deployment (rhel8
    os + f28 based-containers).

    Change-Id: Ic7904c4f3027cc5e7e05d52757e36dbc05f3d487
    Co-Authored-By: Damien Ciabrini <email address hidden>
    Closes-Bug: #1813014

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/639928

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

Reviewed: https://review.openstack.org/639928
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=e5d6b52c15349f88788f8fea42071ec9fd5dba5c
Submitter: Zuul
Branch: stable/rocky

commit e5d6b52c15349f88788f8fea42071ec9fd5dba5c
Author: Michele Baldessari <email address hidden>
Date: Wed Jan 23 14:10:41 2019 +0100

    Fix nova_cell_v2_discover_host.py with python3

    When this script runs via python3 it fails with:

      "stdout: ",
      "stderr: + command -v python3",
      "+ python3 /docker-config-scripts/nova_cell_v2_discover_host.py",
      "Traceback (most recent call last):",
      " File \"/docker-config-scripts/nova_cell_v2_discover_host.py\", line 75, in <module>",
      " TypeError: a bytes-like object is required, not 'str'"

    This is because in python3 subprocess.check_output() will return bytes
    and trying to split it using a string '\n' will break with the error
    above. Let's just use the universal_newlines=True parameter which we
    have been using everywhere in tripleo so far.
    Also skip any empty lines that might show up in the output which would
    give the error:

      ValueError: not enough values to unpack (expected 2, got 0)

    Tested with a python3 deployment and got a successful deployment (rhel8
    os + f28 based-containers).

    Change-Id: Ic7904c4f3027cc5e7e05d52757e36dbc05f3d487
    Co-Authored-By: Damien Ciabrini <email address hidden>
    Closes-Bug: #1813014
    (cherry picked from commit 87a869a408b9732e9ff46e8fecfa1487b3699ffa)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 10.4.0

This issue was fixed in the openstack/tripleo-heat-templates 10.4.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 9.4.0

This issue was fixed in the openstack/tripleo-heat-templates 9.4.0 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.