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

Upgrade/Downgrade url method #114

Closed
wants to merge 3 commits into from
Closed

Upgrade/Downgrade url method #114

wants to merge 3 commits into from

Conversation

aj-jester
Copy link

This allows us to upgrade/downgrade consul's if the installation method is URL.

# $ consul -v
# Consul v0.5.0
# Consul Protocol: 2 (Understands back to: 1)
consul_v = Facter::Util::Resolution.exec("consul -v")
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like it could be potentially brittle or hard to refactor.

Can you add a test for this to stub out exec with the example that your provided in the comments and assert the desired expected output?

Copy link
Author

Choose a reason for hiding this comment

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

Def, I can add a test for this.

Also, regarding refactoring, do you think its better to inject those values in a hash or something? So incase in the future we need more than just version or protocol it would be easily manageable? Or did you mean some other way to refactor? I can imagine adding more consul facts in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think just normal strings is ok.

I'm mostly concerned about guarding against consul not being available, string parsing, and timeouts. I've been bit by all those things.

There is another thing I would like to suggest in this refactor and that is to make it so it returns "unknown" when not available. This makes the fact easier to use in contexts when strict variables is enabled in puppet.

We do not currently test with strict variables on, but I think we should.

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