Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix directory /etc/nagios/nrpe.d/ issue #492

Merged
merged 3 commits into from Jul 16, 2020
Merged

Conversation

ajkavanagh
Copy link
Collaborator

Under certain deployment conditions, the charm can attempt to write to
the /etc/nagios/nrpe.d/ directory before it exists. This directory is
created by the nrpe charm, but if the hacluster gets installed first,
then it can be triggered to attempt to set up the nrpe entries before
the directory can be created by nrpe. This change (and the associated
charm-helpers change) ensures that the charm will delay the nrpe config
until the directory is available (and thus, the nrpe charm is fully
installed)

Related Bug: LP: #1882557

Copy link
Contributor

@thedac thedac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves the problem but a simpler solution would do.

The charm is running as root and even if it sets permissions as nagios it is capable of doing that if the directory exists. A simple directory check would do.


# check that the charm can write to the conf dir. If not, then nagios
# probably isn't installed, and we can defer.
if not self.can_write_nrpe_conf_dir():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not just do a directory check?

if os.path.exists(cls.nrpe_confdir):

thedac
thedac previously approved these changes Jul 15, 2020
Copy link
Contributor

@thedac thedac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, just waiting on the OSCI run for landing.

Under certain deployment conditions, the charm can attempt to write to
the /etc/nagios/nrpe.d/ directory before it exists.  This directory is
created by the nrpe charm, but if the hacluster gets installed first,
then it can be triggered to attempt to set up the nrpe entries before
the directory can be created by nrpe.  This change (and the associated
charm-helpers change) ensures that the charm will delay the nrpe config
until the directory is available (and thus, the nrpe charm is fully
installed)

Related Bug: LP: #1882557
Copy link
Contributor

@thedac thedac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Landing.

@thedac thedac merged commit 9e20a38 into juju:master Jul 16, 2020
openstack-mirroring pushed a commit to openstack/charm-hacluster that referenced this pull request Jul 16, 2020
Under certain deployment conditions, the charm can attempt to write to
the /etc/nagios/nrpe.d/ directory before it exists.  This directory is
created by the nrpe charm, but if the hacluster (this charm) gets
installed first, then it can be triggered to attempt to set up the nrpe
entries before the directory can be created by nrpe.  This change (and
the associated charm-helpers change) ensures that the charm will delay
the nrpe config until the directory is available (and thus, the nrpe
charm is fully installed)

Related charm-helpers: juju/charm-helpers#492

Change-Id: Ibcbb5f56205b72c475807e3c34c64a00844908f4
Closes-Bug: #1882557
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jul 16, 2020
* Update charm-hacluster from branch 'master'
  - Merge "Fix directory /etc/nagios/nrpe.d/  issue"
  - Fix directory /etc/nagios/nrpe.d/  issue
    
    Under certain deployment conditions, the charm can attempt to write to
    the /etc/nagios/nrpe.d/ directory before it exists.  This directory is
    created by the nrpe charm, but if the hacluster (this charm) gets
    installed first, then it can be triggered to attempt to set up the nrpe
    entries before the directory can be created by nrpe.  This change (and
    the associated charm-helpers change) ensures that the charm will delay
    the nrpe config until the directory is available (and thus, the nrpe
    charm is fully installed)
    
    Related charm-helpers: juju/charm-helpers#492
    
    Change-Id: Ibcbb5f56205b72c475807e3c34c64a00844908f4
    Closes-Bug: #1882557
@ajkavanagh ajkavanagh deleted the bug/1882557 branch July 27, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants