Append to set object in nova_cc_utils.resolve_hosts_for

Bug #1992789 reported by Peter Colledge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Nova Cloud Controller Charm
Fix Committed
High
Unassigned

Bug Description

When cloud-compute-relation-changed hook's private-address relation attribute is a valid FQDN rather than an IP Address then the non-existent set().append() is called on the hosts variable -- it should probably be set().add(), or removed.

This is presumably caused by the use of `juju add-machine ssh:$fqdn` instead of by IP Address.

Log:

unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed Traceback (most recent call last):
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/cloud-compute-relation-changed", line 1428, in <module>
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed main()
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/cloud-compute-relation-changed", line 1420, in main
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed hooks.execute(sys.argv)
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/charmhelpers/core/hookenv.py", line 963, in execute
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed self._hooks[hook_name]()
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/cloud-compute-relation-changed", line 697, in cloud_compute_relation_changed
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed update_ssh_key(rid=None, unit=None)
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/cloud-compute-relation-changed", line 873, in update_ssh_key
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed resolved_hosts = ncc_utils.resolve_hosts_for(private_address, hostname)
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/nova_cc_utils.py", line 1384, in resolve_hosts_for
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed hosts.append(private_address.lower())
unit-nova-cloud-controller-0: 14:44:03 WARNING unit.nova-cloud-controller/0.cloud-compute-relation-changed AttributeError: 'set' object has no attribute 'append'
unit-nova-cloud-controller-0: 14:44:04 ERROR juju.worker.uniter.operation hook "cloud-compute-relation-changed" (via explicit, bespoke hook script) failed: exit status 1

Changed in charm-nova-cloud-controller:
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (master)
Changed in charm-nova-cloud-controller:
status: Triaged → In Progress
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

This will require backports through:

- stable/zed
- stable/yoga
- stable/xena
- stable/wallaby
- stable/victoria
- stable/ussuri
- stable/train

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (master)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/861544
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/007f9e33b0f111bcd22aebfa785bb5066832e802
Submitter: "Zuul (22348)"
Branch: master

commit 007f9e33b0f111bcd22aebfa785bb5066832e802
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789

Changed in charm-nova-cloud-controller:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/zed)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/yoga)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/wallaby)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/victoria)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/xena)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/ussuri)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/train)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/zed)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862240
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/97558972b829f613a72f41320a5f7a1772c63bcf
Submitter: "Zuul (22348)"
Branch: stable/zed

commit 97558972b829f613a72f41320a5f7a1772c63bcf
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-zed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/yoga)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862241
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/563828538b83ca70281e5de15f5cf1dd39c8a47a
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 563828538b83ca70281e5de15f5cf1dd39c8a47a
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-yoga
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862244
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/1d7fc0f13742b22cc5e949c08c68800ecbaaeccb
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 1d7fc0f13742b22cc5e949c08c68800ecbaaeccb
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-xena
tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862242
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/80a19d8b4237fc5514be648ac8f8535aee972998
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 80a19d8b4237fc5514be648ac8f8535aee972998
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862243
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/e2518f359ee2d4c28bafe4ed6c4e2211e6ad6547
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit e2518f359ee2d4c28bafe4ed6c4e2211e6ad6547
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862245
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/b40ea5d3eb65dd6d91f7cf1bdffdfd93705aa256
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit b40ea5d3eb65dd6d91f7cf1bdffdfd93705aa256
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (stable/train)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/862246
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/3e22bce2d9432497068785369a4b04e8c814ffdb
Submitter: "Zuul (22348)"
Branch: stable/train

commit 3e22bce2d9432497068785369a4b04e8c814ffdb
Author: Alex Kavanagh <email address hidden>
Date: Sun Oct 16 20:27:42 2022 +0100

    In nova_cc_utils.py:resolve_hosts_for: .append -> .add

    The method was refactored (in part) to use sets to enforce uniqueness of
    the hosts. Unfortunately, a list method (.append()) slipped through
    that should have been converted to .add(). This fixes that error.

    Change-Id: I248430cd1a9156efab745fe110a39441b503b3a5
    Closes-Bug: #1992789
    (cherry picked from commit 007f9e33b0f111bcd22aebfa785bb5066832e802)

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.