Replace custom netloc filters with ansible native urlsplit filter

Bug #1820830 reported by Jesse Pretorius
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Undecided
Georgina Shippey

Bug Description

In openstack-ansible-plugins we have several 'netloc' filters [1] which were useful prior to Ansible 2.4, but in Ansible 2.4 there is now the urlsplit filter [2] which can perform all the same functions.

We should replace the use of all the netloc filters in all repositories with the urlsplit filter, then remove the netloc filters from openstack-ansible-plugins.

Examples:

"{{ foo | get_netloc }}" -> "{{ foo | urlsplit('netloc') }}"

"{{ foo | get_netloc_no_port }}" -> "{{ foo | urlsplit('hostname') }}"

"{{ foo | get_netorigin }}" ->
    "{{ foo | urlsplit('scheme') ~ '://' ~ urlsplit('netloc') }}"

This reduces our technical debt.

[1] https://github.com/openstack/openstack-ansible-plugins/blob/44a8205f5e6773d166b10e71a73aa8d2cbb6296e/filter/osa-filters.py#L156-L214
[2] https://docs.ansible.com/ansible/2.4/playbooks_filters.html#url-split-filter

description: updated
summary: - Replace custom netloc filters with sensible native urlsplit filter
+ Replace custom netloc filters with ansible native urlsplit filter
tags: added: low-hanging-fruit
Changed in openstack-ansible:
assignee: nobody → Georgina Shippey (gshippey)
description: updated
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-repo_build (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/644811

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/645204

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-pip_install (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/645221

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-repo_build (master)

Reviewed: https://review.openstack.org/644811
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-repo_build/commit/?id=dcd9469411abad390c65657ebb7060d954f9eb25
Submitter: Zuul
Branch: master

commit dcd9469411abad390c65657ebb7060d954f9eb25
Author: Georgina Shippey <email address hidden>
Date: Wed Mar 20 10:16:56 2019 +0000

    Replace usage of netloc filters to urlsplit

    Remove the references to netorigin and netloc_no_port as they will
    be taken out from openstack-ansible-plugins

    Now using ansible 2.4's urlsplit filter as a replacement.

    Change-Id: I94302ced3e5d6faa4d8748590f323e89d9b7280c
    Related-Bug: #1820830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-repo_build (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/645556

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-repo_build (master)

Reviewed: https://review.openstack.org/645556
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-repo_build/commit/?id=e14e33328a765dd64b0817cd6403abfa100252ad
Submitter: Zuul
Branch: master

commit e14e33328a765dd64b0817cd6403abfa100252ad
Author: Dmitriy Rabotjagov <email address hidden>
Date: Fri Mar 22 14:32:44 2019 +0200

    Fix map filter usage with urlsplit

    As urlsplit is filter as well, so we need to quote it for applying
    to all items. Otherwise 'urlsplit' undefined variable error is raised.

    Change-Id: Ie4a51b177fb7f8e28c8c7dfb080960d6734ee21f
    Related-Bug: #1820830
    Co-Authored-By: Nicolas Bock <email address hidden>

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-pip_install (master)

Reviewed: https://review.openstack.org/645221
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-pip_install/commit/?id=79d2ab3f0b6a2ff676fa5df9c9848596ffe5c867
Submitter: Zuul
Branch: master

commit 79d2ab3f0b6a2ff676fa5df9c9848596ffe5c867
Author: Georgina Shippey <email address hidden>
Date: Thu Mar 21 15:58:32 2019 +0000

    Replace usage of netloc filters to urlsplit

    Removed references to netloc_no_port as it will be taken out from
    openstack-ansible-plugins. Now using ansible 2.4's urlsplit filter
    as a replacement.

    Change-Id: If28c8bf2856ebb9a1cab4759b3ddc5b6c4685abf
    Related-Bug: #1820830

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

Reviewed: https://review.openstack.org/645204
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=8dad0ddc04c98e89e5d5c9ed644b3c45561a2105
Submitter: Zuul
Branch: master

commit 8dad0ddc04c98e89e5d5c9ed644b3c45561a2105
Author: Georgina Shippey <email address hidden>
Date: Thu Mar 21 15:21:09 2019 +0000

    Replace usage of netloc filters to urlsplit

    Removed the reference to netloc_no_port
    as it will be taken out from
    openstack-ansible-plugins. Now using ansible 2.4's
    urlsplit filter as a replacement.

    Change-Id: Ib7c1a0a23ee73e355c39e4061aed05ce607cd839
    Related-Bug: #1820830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-repo_server (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/648186

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-os_cinder (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/648188

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-os_nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/648189

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-os_ironic (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/648190

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-os_ironic (master)

Reviewed: https://review.openstack.org/648190
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-os_ironic/commit/?id=78db69714b938caafa12febf8965a33df5689932
Submitter: Zuul
Branch: master

commit 78db69714b938caafa12febf8965a33df5689932
Author: Georgina Shippey <email address hidden>
Date: Wed Mar 27 17:31:32 2019 +0000

    Replace usage of netloc filters to urlsplit

    Removed the reference to netorigin as it will be taken out from openstack-ansible-plugins
    Now using ansible 2.4's urlsplit filter as a replacement.

    Change-Id: I4d8134e04d751e7506e21cd14424898c28200cb3
    Related-Bug: #1820830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-os_nova (master)

Reviewed: https://review.openstack.org/648189
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-os_nova/commit/?id=4645b4dd043eb9dc679941e7d7de0b6f74eae03f
Submitter: Zuul
Branch: master

commit 4645b4dd043eb9dc679941e7d7de0b6f74eae03f
Author: Georgina Shippey <email address hidden>
Date: Wed Mar 27 17:31:09 2019 +0000

    Replace usage of netloc filters to urlsplit

    Removed the reference to netorigin as it will be taken out from openstack-ansible-plugins
    Now using ansible 2.4's urlsplit filter as a replacement.

    Change-Id: I64495ec530245a6355a9f0b6c84bc047ea2687b1
    Related-Bug: #1820830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible-os_cinder (master)

Reviewed: https://review.openstack.org/648188
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-os_cinder/commit/?id=784494a4590f958724190af5df054dcb3421c021
Submitter: Zuul
Branch: master

commit 784494a4590f958724190af5df054dcb3421c021
Author: Georgina Shippey <email address hidden>
Date: Wed Mar 27 17:29:37 2019 +0000

    Replace usage of netloc filters to urlsplit

    Removed the reference to netorigin as it will be taken out from openstack-ansible-plugins
    Now using ansible 2.4's urlsplit filter as a replacement.

    Change-Id: I36ecd276ff1e4c16a7728658e8821bae1615916c
    Related-Bug: #1820830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-ansible-repo_server (master)

Change abandoned by Georgina Shippey (<email address hidden>) on branch: master
Review: https://review.openstack.org/648186
Reason: Made changes to code that is no longer necessary.

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

Fix proposed to branch: master
Review: https://review.opendev.org/655126

Changed in openstack-ansible:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-plugins (master)

Reviewed: https://review.opendev.org/655126
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-plugins/commit/?id=6482c25017b8d61d483acceee3505606c7487c53
Submitter: Zuul
Branch: master

commit 6482c25017b8d61d483acceee3505606c7487c53
Author: Georgina <email address hidden>
Date: Tue Apr 23 11:16:30 2019 +0000

    Removal of netloc filters

    The ansible urlsplit filter added in 2.4 means that maintaining the
    filters netloc, netloc_no_port and netorigin should no longer be
    necessary.
    All usages of these filters within other openstack repos have been
    updated to use urlsplit and merged.

    Change-Id: Ief1ec06e205bae7ec114fe0b9bd7d9c4973383dd
    Closes-Bug: #1820830

Changed in openstack-ansible:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins train-eol

This issue was fixed in the openstack/openstack-ansible-plugins train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins ussuri-eol

This issue was fixed in the openstack/openstack-ansible-plugins ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins yoga-eom

This issue was fixed in the openstack/openstack-ansible-plugins yoga-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins victoria-eom

This issue was fixed in the openstack/openstack-ansible-plugins victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins wallaby-eom

This issue was fixed in the openstack/openstack-ansible-plugins wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins xena-eom

This issue was fixed in the openstack/openstack-ansible-plugins xena-eom 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.