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

(MODULES-4135) choco -v - Remove all extraneous messaging #52

Conversation

ferventcoder
Copy link

When determining the version of Chocolatey that is installed, the
module calls choco -v which will return the version in most versions
of Chocolatey (anything earlier than 0.9.8.24 or more than 4 years old
may not). However sometimes there is messaging that tends to be
presented as warnings that still end up being included in the output.
Instead of looking for specific wording, typically the chocolatey
version is going to be the last line in the output. So remove all of
the other lines and just use the last line available.

Using a simpler string.lines.last is out because it only splits
on $/ and doesn't allow multiple options. So split on CRLF, then LF,
then CR. This allows the output to be evaluated on different
platforms and not be subject to whatever Ruby believes $/ evaluates
to on that platform.

When determining the version of Chocolatey that is installed, the
module calls `choco -v` which will return the version in most versions
of Chocolatey (anything earlier than 0.9.8.24 or more than 4 years old
may not). However sometimes there is messaging that tends to be
presented as warnings that still end up being included in the output.
Instead of looking for specific wording, typically the chocolatey
version is going to be the last line in the output. So remove all of
the other lines and just use the last line available.

Using a simpler `string.lines.last` is out because it only splits
on `$/` and doesn't allow multiple options. So split on CRLF, then LF,
then CR. This allows the output to be evaluated on different
platforms and not be subject to whatever Ruby believes `$/` evaluates
to on that platform.
@jpogran jpogran merged commit fae9806 into puppetlabs:master Nov 28, 2016
@ferventcoder ferventcoder deleted the ticket/master/MODULES-4135-version_malformed branch November 28, 2016 23:02
ThoughtCrhyme pushed a commit to ThoughtCrhyme/puppetlabs-chocolatey that referenced this pull request Mar 20, 2017
…template_acceptance_indicies

(QA-2835) QAELK - enable acceptance elasticsearch index template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants