nrpe relation: nrpe.add_check_haproxy fails because hooks/charmhelpers doesn't exist anymore

Bug #1796830 reported by Alvaro Uria
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Undecided
Unassigned
OpenStack Dashboard Charm
Fix Released
Undecided
Unassigned
OpenStack Keystone Charm
Fix Released
Undecided
Unassigned
OpenStack Nova Cloud Controller Charm
Fix Released
Undecided
Unassigned
OpenStack Swift Proxy Charm
Fix Released
Undecided
Unassigned

Bug Description

Starting on 18.02, CHARM_DIR/hooks/charmhelpers symlink has been removed.

When swift-proxy<->nrpe, update_nrpe_config calls nrpe.copy_nrpe_checks,
"""
    nrpe_files_dir = os.path.join(os.getenv('CHARM_DIR'), 'hooks',
                                  'charmhelpers', 'contrib', 'openstack',
                                  'files')
"""

The latest charmhelpers allow a parameter to be passed to copy_nrpe_checks:
https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/charmsupport/nrpe.py#L413

This issue affects new deployments, not upgraded ones because check_haproxy* scripts will already exist on /usr/local/lib/nagios/plugins (hence, "_locate_cmd(self, check_cmd)" would work).

Workaround: manually copy the checks to the local nagios plugins dir:
"""
juju run --application swift-proxy 'cp -a charmhelpers/contrib/openstack/files/check_haproxy* /usr/local/lib/nagios/plugins/'
juju run --application swift-proxy hooks/config-changed
"""

Alvaro Uria (aluria)
Changed in charm-helpers:
status: New → Invalid
Revision history for this message
Alvaro Uria (aluria) wrote :
tags: added: 4010 cpe-onsite
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-proxy (master)

Reviewed: https://review.openstack.org/608904
Committed: https://git.openstack.org/cgit/openstack/charm-swift-proxy/commit/?id=65c90e7c272e984ecc9cee7c936484fbe087fa1b
Submitter: Zuul
Branch: master

commit 65c90e7c272e984ecc9cee7c936484fbe087fa1b
Author: Alvaro Uria <email address hidden>
Date: Tue Oct 9 12:18:38 2018 +0200

    Fix haproxy nrpe checks

      From stable/18.02 onwards, charmhelpers symlink has been removed from
      the hooks directory. On fresh deploys, this caused check_haproxy*
      scripts not to be copied to /usr/local/lib/nagios/plugins.

      This change uses new copy_nrpe_checks arg available to choose a
      different location than the default.

    Change-Id: Ia0a78dd2ace60dd77e81382b8018c04bbc0e2ebf
    Closes-Bug: 1796830
    Signed-off-by: Alvaro Uria <email address hidden>

Changed in charm-swift-proxy:
status: New → Fix Committed
David Ames (thedac)
Changed in charm-swift-proxy:
milestone: none → 19.04
Revision history for this message
Alvaro Uria (aluria) wrote :
Changed in charm-helpers:
status: Invalid → Confirmed
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

The problem is in charm-helpers, specifically in charmhelpers.contrib.charmsupport.nrpe.copy_nrpe_checks(). It assumes that the charmhelpers directory will always be in hooks, which (probably) was a good assumption until the PY3 work makes it very hard in some charms to not root the python path in the charmdir.

The solution is to change copy_nrpe_checks so that it works out where the files are and copies them.

Changed in charm-helpers:
assignee: nobody → Alex Kavanagh (ajkavanagh)
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

After the (coming change) to charm-helpers, keystone, nova-cc and openstack-dashboard will require charm-helper syncs.

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :
Changed in charm-keystone:
status: New → In Progress
assignee: nobody → Alex Kavanagh (ajkavanagh)
Changed in charm-nova-cloud-controller:
assignee: nobody → Alex Kavanagh (ajkavanagh)
Changed in charm-openstack-dashboard:
assignee: nobody → Alex Kavanagh (ajkavanagh)
Changed in charm-helpers:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (master)

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

Changed in charm-nova-cloud-controller:
status: New → In Progress
Changed in charm-openstack-dashboard:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-openstack-dashboard (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-swift-proxy (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-openstack-dashboard (stable/18.11)

Fix proposed to branch: stable/18.11
Review: https://review.openstack.org/620016

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-keystone (stable/18.11)

Fix proposed to branch: stable/18.11
Review: https://review.openstack.org/620021

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (stable/18.11)

Fix proposed to branch: stable/18.11
Review: https://review.openstack.org/620022

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-swift-proxy (stable/18.11)

Fix proposed to branch: stable/18.11
Review: https://review.openstack.org/620023

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-proxy (master)

Reviewed: https://review.openstack.org/619773
Committed: https://git.openstack.org/cgit/openstack/charm-swift-proxy/commit/?id=96741629b4d22d7102fe9a3fe6e3de3e45ab9df1
Submitter: Zuul
Branch: master

commit 96741629b4d22d7102fe9a3fe6e3de3e45ab9df1
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 17:03:23 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Note: the change in unit_tests/test_actions.py is to cope with a
    difference between how subprocess.CalledProcessError() formats strings
    when using str() between py35 and py36. Python3.6 adds a period/dot to
    the end of the sentence that Python3.5 didn't.

    Change-Id: I8ebb1d6d78f0804007a9f79f31b3b0c4e0c441bd
    Closes-Bug: #1796830

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

Reviewed: https://review.openstack.org/619762
Committed: https://git.openstack.org/cgit/openstack/charm-openstack-dashboard/commit/?id=882e78c5ad76df9232dfd4b741031c4b36341b9c
Submitter: Zuul
Branch: master

commit 882e78c5ad76df9232dfd4b741031c4b36341b9c
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 16:04:44 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: I95250d6624827eb159a450523e05284c9248ba07
    Closes-Bug: #1796830

Changed in charm-nova-cloud-controller:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (master)

Reviewed: https://review.openstack.org/619758
Committed: https://git.openstack.org/cgit/openstack/charm-nova-cloud-controller/commit/?id=ce389711da998ae44c90c31db96b7a466af9d400
Submitter: Zuul
Branch: master

commit ce389711da998ae44c90c31db96b7a466af9d400
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 15:59:30 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: Ib389885b6b95eced6c90fe95d831909c721ebc27
    Closes-Bug: #1796830

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

Reviewed: https://review.openstack.org/619752
Committed: https://git.openstack.org/cgit/openstack/charm-keystone/commit/?id=b77bc9cd1ed04df3a99e6324d82a91cd5ee535f5
Submitter: Zuul
Branch: master

commit b77bc9cd1ed04df3a99e6324d82a91cd5ee535f5
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 15:42:10 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: Ifc0baabee4e06b79015e02b95634bce879ae84af
    Closes-Bug: #1796830

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

Reviewed: https://review.openstack.org/620022
Committed: https://git.openstack.org/cgit/openstack/charm-nova-cloud-controller/commit/?id=cd915ee6f822af152379059a22ffbe1bdcc43313
Submitter: Zuul
Branch: stable/18.11

commit cd915ee6f822af152379059a22ffbe1bdcc43313
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 15:59:30 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: I5cd14bede21f53f196c630c7fdfcf521853e68da
    Closes-Bug: #1796830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-openstack-dashboard (stable/18.11)

Reviewed: https://review.openstack.org/620016
Committed: https://git.openstack.org/cgit/openstack/charm-openstack-dashboard/commit/?id=00642244587dc79f30ab31b8e56de0591a7976e5
Submitter: Zuul
Branch: stable/18.11

commit 00642244587dc79f30ab31b8e56de0591a7976e5
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 16:04:44 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: I583b7acbffb5560aba8313d30da77f4d8073ba9b
    Closes-Bug: #1796830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-keystone (stable/18.11)

Reviewed: https://review.openstack.org/620021
Committed: https://git.openstack.org/cgit/openstack/charm-keystone/commit/?id=b7f5d9c95493de81119cdcf4f015bb5047d13068
Submitter: Zuul
Branch: stable/18.11

commit b7f5d9c95493de81119cdcf4f015bb5047d13068
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 15:42:10 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Change-Id: Ibcd6faf38703639665428cd8c74f97ec4484cd2f
    Closes-Bug: #1796830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-proxy (stable/18.11)

Reviewed: https://review.openstack.org/620023
Committed: https://git.openstack.org/cgit/openstack/charm-swift-proxy/commit/?id=11cf61ba11041aad60b3fb5c4d949aa491fabcb5
Submitter: Zuul
Branch: stable/18.11

commit 11cf61ba11041aad60b3fb5c4d949aa491fabcb5
Author: Alex Kavanagh <email address hidden>
Date: Fri Nov 23 17:03:23 2018 +0000

    Sync c-h nrpe.py file to fix nrpe files copy issue

    Due to a change to PY3, the charmhelpers directory is not in the
    CHARMDIR rather than in CHARMDIR/hooks. This broke the
    copy_nrpe_checks() function in c-h. c-h has been updated, to look in
    both CHARMDIR and CHARMDIR/hooks for the charmhelpers directory, and
    this patchset includes the new function definition.

    Note: the change in unit_tests/test_actions.py is to cope with a
    difference between how subprocess.CalledProcessError() formats strings
    when using str() between py35 and py36. Python3.6 adds a period/dot to
    the end of the sentence that Python3.5 didn't.

    Change-Id: I845169c839bd2058e10076f24bf5393db0ec218a
    Closes-Bug: #1796830

Changed in charm-helpers:
status: In Progress → Fix Committed
Changed in charm-openstack-dashboard:
milestone: none → 19.04
Changed in charm-nova-cloud-controller:
milestone: none → 19.04
Changed in charm-keystone:
milestone: none → 19.04
David Ames (thedac)
Changed in charm-swift-proxy:
status: Fix Committed → Fix Released
Changed in charm-keystone:
status: Fix Committed → Fix Released
Changed in charm-openstack-dashboard:
status: Fix Committed → Fix Released
Changed in charm-nova-cloud-controller:
status: Fix Committed → Fix Released
Changed in charm-helpers:
status: Fix Committed → Fix Released
assignee: Alex Kavanagh (ajkavanagh) → nobody
Changed in charm-keystone:
assignee: Alex Kavanagh (ajkavanagh) → nobody
Changed in charm-nova-cloud-controller:
assignee: Alex Kavanagh (ajkavanagh) → nobody
Changed in charm-openstack-dashboard:
assignee: Alex Kavanagh (ajkavanagh) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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