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

Use a guard and not .error? method for sensu_ctl #74

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

webframp
Copy link
Contributor

@webframp webframp commented Dec 13, 2019

I don't remember the reason for trying to use .error? to check the
output of the shell exec. What matters though is that the configure is
run once when needed and not every time once it's already configured.

This change switches to using a guard and a method to compare the
configured backend url.

The shortcoming of this approach is that as the resource is currently
written it supports a username and password property, however we do not
have an implementation that can safely handle reconfiguring these
values so they will only work the first time the resource is used.

Fixes #63


Pull Request Checklist

Is this in reference to an existing issue?

General

  • Update Changelog following the conventions laid out here

  • Update README with any necessary configuration snippets

  • Cookstyle (rubocop) passes

  • Foodcritic passes

  • Rspec (unit tests) passes

  • Inspec (integration tests) passes

New Features

  • Added a Testing Artifact as either an automated test or a manual artifact on the PR.

  • Adedd documentation for it to the README.md

Purpose

Known Compatibility Issues

I don't remember the reason for trying to use .error? to check the
output of the shell exec. What matters though is that the configure is
run once when needed and not every time once it's already configured.

This change switches to using a guard and a method to compare the
configured backend url.

The shortcoming of this approach is that as resource is currently
written it supports a username and password property, however we do not
have an implementation that can safely handle reconfiguring these
values so they will only work the first time the resource is used.
@webframp webframp requested a review from a team as a code owner December 13, 2019 22:40
@webframp webframp changed the title Use a guard and not .error? method for sensu_ctl WIP: Use a guard and not .error? method for sensu_ctl Dec 13, 2019
@webframp webframp added the Status: Do Not Merge Mark a PR as not ready to merge for any reason, WIP, requested chagne or otherwise label Dec 13, 2019
@webframp
Copy link
Contributor Author

@majormoses just a start here to experiment with an alternate approach

@webframp
Copy link
Contributor Author

webframp commented Jan 6, 2020

This one still needs work and isn’t ready to be included for #80 yet

execute 'configure sensuctl' do
command sensuctl_configure_cmd
sensitive true unless new_resource.debug
not_if { config['api-url'] == new_resource.backend_url }
Copy link
Contributor

@majormoses majormoses Jan 6, 2020

Choose a reason for hiding this comment

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

this still would not allow you to reconfigure the credentials using the same URL, I am wondering if we should perhaps have a configure and reconfigure actions with their own distinct logic (yes I realize this is very anti pattern) as I can't seem to find a good middle ground that gives us what we want for both scenarios.

@webframp webframp marked this pull request as draft October 17, 2020 20:28
@webframp webframp changed the title WIP: Use a guard and not .error? method for sensu_ctl Use a guard and not .error? method for sensu_ctl Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Do Not Merge Mark a PR as not ready to merge for any reason, WIP, requested chagne or otherwise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sensu_ctl resource is always skipped
2 participants