tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Feature Request: Add Snap Proxy Support #216

Open AjkayAlan opened 4 years ago

AjkayAlan commented 4 years ago

The Problem

I am behind a corporate authenticated proxy which requires me to utilize this plugin (which works wonderfully by the way!). I am creating a vagrant based development environment, so installing things such as development IDEs, etc. One small gap I have - when using Ubuntu 18.04 with Snap, I get timeouts.

The Solution

Snap doesn't honor /etc/environment settings - we have to explicitly set them. What about doing something equivalent to the following?:

if [ -x "$(command -v snap)" ]; then
  sudo snap set system proxy.http=$http_proxy
  sudo snap set system proxy.https=$https_proxy
fi

$http_proxy and $https_proxy would be replaced by the value provided in the Vagrantfile, or through the defaults set.

codylane commented 4 years ago

Hi @AjkayAlan,

Thank you for your kind words and for attempting to address this problem with a solution.

However, I'm afraid it's not that simple to just implement a new feature given the current nature of this plugin. We would have to address quiet a few different edge cases for different operating systems and attempt to keep them up to date.

As I'm not familiar with Snap and how Snap is used in the community and or if the community has actually adopted it as a main deployment tool I'm not so sure that implementing this feature (given the current state of this plugin) would be beneficial. That said, it's not that we won't implement something, I'm just hesitant to implement new features outside the scope of what is already currently implemented. It's a fairly large undertaking as it stands now to maintain the current state of this plugin without worry that we might accidentally introduce a breaking change for others. You would also have to take care to ensure that this plugin is configured in the right place either before or after other services.

We do however, rely on the community for help and we will accept pull requests for new features as long as the feature has documentation, implementation and tests. We will do a small code review for each pull request as well to ensure that code is maintainable for others as we evolve in this ecosystem. Also TravisCI is used to test pull requests and code commits. If the Travis job is not successful, we won't merge this into master until the code passes all tests.

If you would like to help support this feature we will work with you to ensure that you have all the resources necessary to implement this behavior.

Here is a high level of what I think it would take in order to implement this. There may be additional steps needed to get this to work properly but this is a stab of what it would take.

I would also highly recommend that this feature can be both "configured" and "un-configured" and documented in the README of how to use and consume this feature.

AjkayAlan commented 4 years ago

Thanks for the well laid out response @codylane!

Snap is Canonical's next-gen package management system, meant to allow package authors a way to create one package which can be used on every version of Ubuntu, along with other distro's. For my specific use case, I am using vagrant to create a small developer environment with a GUI, which includes Microsoft's Visual Studio Code. VSCode is a snap package distributed by Microsoft.

Digging more into the problem, I believe snap should be honoring /etc/environment (which this plugin already sets), but for me specifically it wasn't.

Ultimately I believe the issue should be addressed with snap and not here, and as such we should probably close this for now unless the landscape changes. Thanks again for being receptive of the idea!

codylane commented 4 years ago

Thank you for the high level of what Snap is and will be used for. For what it's worth I've done a little micro deep dive of what Snap is and is used for and it seems to be pretty promising for the community especially since it's not locked down to a particular OS or package management tool.

That said, I do think this would be a useful feature to implement and the community would benefit from it so I'm going to re-open this request in hopes that someone with the time will help make this into our plugin ecosystem.

Also, to validate what you are saying about configuring environment variables behind a corprate proxy I've seen plenty of tools that say they support environment variables like _HTTPPROXY and _httpproxy example (curl, git, vagrant, wget, docker) that don't always work when using the environment variables (even though the tool claims env vars work) and sometimes I've found I have to use a special config file either global or per use basis in order for that particular tool to use the corporate proxy.

Hopefully one day we will be in a world that has a micro service that "auto" configures all services we use in development when behind a proxy.