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

Vagrant 1.8.1 colors mess up vagrant_plugin_installed? #207

Closed
oifland opened this issue Feb 13, 2016 · 12 comments
Closed

Vagrant 1.8.1 colors mess up vagrant_plugin_installed? #207

oifland opened this issue Feb 13, 2016 · 12 comments

Comments

@oifland
Copy link

oifland commented Feb 13, 2016

Vagrant seems to have recently added ANSI colors to the output and that means extra characters are showing up. When vagrant_plugin_installed?is called, it's splitting on newlines and then checking to see if the plugin is at the beginning of the line (see

def winrm_plugin_installed?
)

The characters "\e[0m" are showing at the beginning of the line, which mess up the /^plugin-name\s+/ regex.

There are options for turning off the colors - see VAGRANT_NO_COLOR and --no-color https://www.vagrantup.com/docs/other/environmental-variables.html

Another option could be to make the regex more forgiving.

@oifland
Copy link
Author

oifland commented Feb 13, 2016

While it's not causing a problem with the current regex, the split("\n") should probably change to split(/\R/) for consistent results across platforms

@dougireton
Copy link

The bug causes this problem. Kitchen-vagrant doesn't think the vagrant-winrm Vagrant plugin is installed because the extra leading ANSI color sequences mess up the regex.

 kitchen list
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: WinRM Transport requires the vagrant-winrm Vagrant plugin to properly communicate with this Vagrant VM. Please install this plugin with: `vagrant plugin install vagrant-winrm' and try again.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

@dougireton
Copy link

I'm working on a PR for this.

@dougireton
Copy link

This appears to be a Windows-only issue.

@Kazark
Copy link

Kazark commented Apr 18, 2016

👍

@akemner
Copy link

akemner commented May 23, 2016

this is a really annoying bug, thanks for the link above to the ENV options @oifland . i'm going to post it directly here in case other people run into this.

work around is [Environment]::SetEnvironmentVariable("VAGRANT_NO_COLOR","false","Machine")

@dougireton
Copy link

@akemner Don't you wan't VAGRANT_NO_COLOR to be true?

@Kazark
Copy link

Kazark commented May 24, 2016

@akemner @dougireton Thanks guys. I did the ugly thing of actually editing the Ruby file. Very glad to see there is a better way.

@phillipbroberts
Copy link

@Kazark @akemner where are you guys placing this?

@Kazark
Copy link

Kazark commented Aug 15, 2016

@phillipbroberts I forget, sorry. It's been a while since I did it and if I recall, it has been fixed now.

@ghbrown60640
Copy link

bumping on this. I'm having this issue as well.

@cheeseplus
Copy link
Contributor

This should be covered by #309 but if not please open a new issue with current version of Vagrant, kitchen-vagrant, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants