vagrant-proxyconf 0.6.0 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/Guardfile +1 -0
- data/README.md +47 -11
- data/lib/vagrant-proxyconf/action.rb +2 -0
- data/lib/vagrant-proxyconf/action/base.rb +1 -0
- data/lib/vagrant-proxyconf/action/configure_chef_proxy.rb +16 -13
- data/lib/vagrant-proxyconf/action/configure_yum_proxy.rb +44 -0
- data/lib/vagrant-proxyconf/cap/redhat/yum_proxy_conf.rb +15 -0
- data/lib/vagrant-proxyconf/config/proxy.rb +0 -31
- data/lib/vagrant-proxyconf/config/yum_proxy.rb +19 -0
- data/lib/vagrant-proxyconf/plugin.rb +10 -0
- data/lib/vagrant-proxyconf/resource.rb +17 -0
- data/lib/vagrant-proxyconf/userinfo_uri.rb +39 -0
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/locales/en.yml +8 -0
- data/resources/yum_config.awk +65 -0
- data/spec/unit/fixtures/empty +0 -0
- data/spec/unit/fixtures/yum_only_disabled_proxy.conf +4 -0
- data/spec/unit/fixtures/yum_only_main.conf +25 -0
- data/spec/unit/fixtures/yum_only_main_with_disabled_proxy.conf +28 -0
- data/spec/unit/fixtures/yum_only_main_with_proxy.conf +28 -0
- data/spec/unit/fixtures/yum_only_proxy.conf +4 -0
- data/spec/unit/fixtures/yum_only_proxy_and_userinfo.conf +4 -0
- data/spec/unit/fixtures/yum_with_repository.conf +7 -0
- data/spec/unit/fixtures/yum_with_repository_and_disabled_proxy.conf +10 -0
- data/spec/unit/fixtures/yum_with_repository_and_new_proxy.conf +10 -0
- data/spec/unit/fixtures/yum_with_repository_and_proxy.conf +10 -0
- data/spec/unit/fixtures/yum_with_repository_and_proxy_without_userinfo.conf +8 -0
- data/spec/unit/support/fixture.rb +9 -0
- data/spec/unit/vagrant-proxyconf/action/configure_chef_proxy_spec.rb +8 -11
- data/spec/unit/vagrant-proxyconf/action/configure_yum_proxy_spec.rb +35 -0
- data/spec/unit/vagrant-proxyconf/cap/redhat/yum_proxy_conf_spec.rb +11 -0
- data/spec/unit/vagrant-proxyconf/config/proxy_spec.rb +0 -62
- data/spec/unit/vagrant-proxyconf/config/yum_proxy_spec.rb +5 -0
- data/spec/unit/vagrant-proxyconf/resource_spec.rb +13 -0
- data/spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb +83 -0
- data/spec/unit/vagrant-proxyconf/userinfo_uri_spec.rb +64 -0
- metadata +48 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTE3NjFmYmRjMjI3OTUyZDY5OGRkZTc3MzZkY2RlNjY3ZmMyMjlhZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWEzOTY2NGNlMTE0Nzc4YTBhY2U3ZWZhMDQ4NDlkNzcyZWYwNGQ5Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2RmMTc1NWFmNWU5NzEyZTU5NGQyMjUyOGI1YzQ0NTIyNzhmZWJkNGYwNTNh
|
10
|
+
YmFmYzk3NjRjMzE0MjczN2Y2MmU4OWEyODljY2E3M2JkMmU1MjQ4ZGMzNGFm
|
11
|
+
NzI4OGM0ZjQ0ZDg3YzVhNGYxZDIwNzQwZWQyNGEyOGFjZWNmYjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjhjOTVmZjI5Yzg5MWMyNDQ2MmZjMWM5ZjE4NDgxYzEzNjM4ZGY4YWMwNGQy
|
14
|
+
OTIzOTU4ZDI5MjBjYjAxNTcyZGI1MDNlNjAwNmJlYzY0M2VjMGZiNTM5MDVk
|
15
|
+
OTQyNTg5NmQxZjJlNTIzOWQ5N2Y1NGViMzA1ZjVhNmFiZWE3ZmE=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 1.0.0.rc1 / 2013-10-30
|
2
|
+
|
3
|
+
- Add support for configuring Yum directly (not only via global env vars) ([GH-4][])
|
4
|
+
- Remove the target path before uploading files to VM to avoid permission problems ([GH-32][])
|
5
|
+
|
1
6
|
# 0.6.0 / 2013-10-15
|
2
7
|
|
3
8
|
- Add support for the [vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) plugin ([GH-30][])
|
@@ -60,6 +65,7 @@
|
|
60
65
|
|
61
66
|
|
62
67
|
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
|
68
|
+
[GH-4]: https://github.com/tmatilai/vagrant-proxyconf/issues/4 "Issue 4"
|
63
69
|
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
|
64
70
|
[GH-6]: https://github.com/tmatilai/vagrant-proxyconf/issues/6 "Issue 6"
|
65
71
|
[GH-7]: https://github.com/tmatilai/vagrant-proxyconf/issues/7 "Issue 7"
|
@@ -82,3 +88,4 @@
|
|
82
88
|
[GH-28]: https://github.com/tmatilai/vagrant-proxyconf/issues/28 "Issue 28"
|
83
89
|
[GH-29]: https://github.com/tmatilai/vagrant-proxyconf/issues/29 "Issue 29"
|
84
90
|
[GH-30]: https://github.com/tmatilai/vagrant-proxyconf/issues/30 "Issue 30"
|
91
|
+
[GH-32]: https://github.com/tmatilai/vagrant-proxyconf/issues/32 "Issue 32"
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gem 'rake'
|
|
7
7
|
gem 'rspec', '~> 2.11'
|
8
8
|
gem 'simplecov', '~> 0.7', :require => false
|
9
9
|
gem 'tailor', '~> 1.2'
|
10
|
-
gem 'vagrant', github: 'mitchellh/vagrant', ref: 'v1.3.
|
10
|
+
gem 'vagrant', github: 'mitchellh/vagrant', ref: 'v1.3.5'
|
11
11
|
|
12
12
|
group :development do
|
13
13
|
gem 'guard-rspec'
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -14,11 +14,12 @@
|
|
14
14
|
|
15
15
|
A [Vagrant](http://www.vagrantup.com/) plugin that configures the virtual machine to use specified proxies. This is useful for example in case you are behind a corporate proxy server, or you have a caching proxy (for example [polipo](https://github.com/tmatilai/polipo-box)).
|
16
16
|
|
17
|
-
|
17
|
+
The plugin can set:
|
18
18
|
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
19
|
+
* generic `http_proxy` etc. environment variables that many programs support
|
20
|
+
* default proxy configuration for all Chef provisioners
|
21
|
+
* proxy configuration for Apt
|
22
|
+
* proxy configuration for Yum
|
22
23
|
|
23
24
|
## Quick start
|
24
25
|
|
@@ -86,7 +87,7 @@ end
|
|
86
87
|
#### Possible values
|
87
88
|
|
88
89
|
* If all keys are unset or `nil`, no configuration is written.
|
89
|
-
* A proxy should be specified in the form of
|
90
|
+
* A proxy should be specified in the form of _http://[user:pass@]host:port_.
|
90
91
|
* Empty string (`""`) or `false` in any setting also force the configuration files to be written, but without configuration for that key. Can be used to clear the old configuration and/or override a global setting.
|
91
92
|
|
92
93
|
#### Environment variables
|
@@ -106,7 +107,7 @@ VAGRANT_HTTP_PROXY="http://proxy.example.com:8080" vagrant up
|
|
106
107
|
|
107
108
|
### Global `*_proxy` environment variables
|
108
109
|
|
109
|
-
Many programs (wget, curl, yum, etc.) can be configured to use proxies with
|
110
|
+
Many programs (wget, curl, yum, etc.) can be configured to use proxies with `http_proxy` or `HTTP_PROXY` etc. environment variables. This configuration will be written to _/etc/profile.d/proxy.sh_ on the guest.
|
110
111
|
|
111
112
|
Also sudo will be configured to preserve the variables. This requires that sudo in the VM is configured to support "sudoers.d", i.e. _/etc/sudoers_ contains line `#includedir /etc/sudoers.d`.
|
112
113
|
|
@@ -131,7 +132,7 @@ end
|
|
131
132
|
#### Possible values
|
132
133
|
|
133
134
|
* If all keys are unset or `nil`, no configuration is written.
|
134
|
-
* A proxy can be specified in the form of
|
135
|
+
* A proxy can be specified in the form of _http://[user:pass@]host:port_.
|
135
136
|
* The values are used as specified, so you can use for example variables that will be evaluated by the shell on the VM.
|
136
137
|
* Empty string (`""`) or `false` in any setting also force the configuration file to be written, but without configuration for that key. Can be used to clear the old configuration and/or override a global setting.
|
137
138
|
|
@@ -158,7 +159,7 @@ Configures Apt to use the specified proxy settings. The configuration will be wr
|
|
158
159
|
|
159
160
|
```ruby
|
160
161
|
Vagrant.configure("2") do |config|
|
161
|
-
config.apt_proxy.http = "192.168.33.1:3142"
|
162
|
+
config.apt_proxy.http = "http://192.168.33.1:3142"
|
162
163
|
config.apt_proxy.https = "DIRECT"
|
163
164
|
# ... other stuff
|
164
165
|
end
|
@@ -172,9 +173,9 @@ end
|
|
172
173
|
|
173
174
|
#### Possible values
|
174
175
|
|
175
|
-
* If all keys are unset or `nil`, no configuration is written.
|
176
|
-
* A proxy can be specified in the form of _[http://][user:pass@]host[:port]_. So all but the _host_ part are optional. The default port is 3142 and
|
177
|
-
* Empty string (`""`) or `false` in any
|
176
|
+
* If all keys are unset or `nil`, no configuration is written or modified.
|
177
|
+
* A proxy can be specified in the form of _[http://][user:pass@]host[:port]_. So all but the _host_ part are optional. The default port is 3142 and scheme is the same as the key.
|
178
|
+
* Empty string (`""`) or `false` in any key also force the configuration file to be written, but without configuration for that scheme. Can be used to clear the old configuration and/or override a global setting.
|
178
179
|
* `"DIRECT"` can be used to specify that no proxy should be used. This is mostly useful for disabling proxy for HTTPS URIs when HTTP proxy is set (as Apt defaults to the latter).
|
179
180
|
* Please refer to [apt.conf(5)](http://manpages.debian.net/man/5/apt.conf) manual for more information.
|
180
181
|
|
@@ -196,6 +197,41 @@ VAGRANT_APT_HTTP_PROXY="proxy.example.com:8080" vagrant up
|
|
196
197
|
|
197
198
|
[apt-cacher-box](https://github.com/tmatilai/apt-cacher-box) gives an example for setting up apt-cacher proxy server in a Vagrant VM.
|
198
199
|
|
200
|
+
### Yum
|
201
|
+
|
202
|
+
Configures Yum to use the specified proxy settings. The configuration will be inserted to _/etc/yum.conf_ on the guest.
|
203
|
+
|
204
|
+
#### Example Vagrantfile
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
Vagrant.configure("2") do |config|
|
208
|
+
config.yum_proxy.http = "http://192.168.33.1:3142"
|
209
|
+
# ... other stuff
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
213
|
+
#### Configuration keys
|
214
|
+
|
215
|
+
* `config.yum_proxy.http` - The proxy for yum
|
216
|
+
|
217
|
+
#### Possible values
|
218
|
+
|
219
|
+
* If the keys is unset or `nil`, the current configuration is not modified.
|
220
|
+
* A proxy can be specified in the form of _http://[user:pass@]host:port_.
|
221
|
+
* Empty string (`""`) or `false` disables the proxy from the configuration.
|
222
|
+
|
223
|
+
#### Environment variables
|
224
|
+
|
225
|
+
* `VAGRANT_YUM_HTTP_PROXY`
|
226
|
+
|
227
|
+
This also overrides the Vagrantfile configuration. To disable or remove the proxy use an empty value.
|
228
|
+
|
229
|
+
For example to spin up a VM, run:
|
230
|
+
|
231
|
+
```sh
|
232
|
+
VAGRANT_YUM_HTTP_PROXY="http://proxy.example.com:8123" vagrant up
|
233
|
+
```
|
234
|
+
|
199
235
|
## Related plugins and projects
|
200
236
|
|
201
237
|
* [apt-cacher-box](https://github.com/tmatilai/apt-cacher-box)<br/>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'action/configure_apt_proxy'
|
2
2
|
require_relative 'action/configure_chef_proxy'
|
3
3
|
require_relative 'action/configure_env_proxy'
|
4
|
+
require_relative 'action/configure_yum_proxy'
|
4
5
|
require_relative 'action/only_once'
|
5
6
|
|
6
7
|
module VagrantPlugins
|
@@ -24,6 +25,7 @@ module VagrantPlugins
|
|
24
25
|
builder.use ConfigureAptProxy
|
25
26
|
builder.use ConfigureChefProxy
|
26
27
|
builder.use ConfigureEnvProxy
|
28
|
+
builder.use ConfigureYumProxy
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -78,6 +78,7 @@ module VagrantPlugins
|
|
78
78
|
|
79
79
|
logger.debug "Configuration (#{path}):\n#{config}"
|
80
80
|
machine.communicate.tap do |comm|
|
81
|
+
comm.sudo("rm #{tmp}", error_check: false)
|
81
82
|
comm.upload(local_tmp.path, tmp)
|
82
83
|
comm.sudo("chmod #{opts[:mode] || '0644'} #{tmp}")
|
83
84
|
comm.sudo("chown #{opts[:owner] || 'root:root'} #{tmp}")
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../logger'
|
2
|
+
require_relative '../userinfo_uri'
|
2
3
|
|
3
4
|
module VagrantPlugins
|
4
5
|
module ProxyConf
|
@@ -51,23 +52,25 @@ module VagrantPlugins
|
|
51
52
|
chef_provisioners(machine).each { |prov| configure_chef(prov.config, config) }
|
52
53
|
end
|
53
54
|
|
54
|
-
# Configures proxies for
|
55
|
+
# Configures proxies for a Chef provisioner if they are not set
|
55
56
|
#
|
56
57
|
# @param chef [VagrantPlugins::Chef::Config::Base] the Chef provisioner configuration
|
57
58
|
# @param config [Config::Proxy] the default configuration
|
58
59
|
def configure_chef(chef, config)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
chef.
|
60
|
+
configure_chef_proxy(chef, 'http', config.http)
|
61
|
+
configure_chef_proxy(chef, 'https', config.https)
|
62
|
+
chef.no_proxy ||= config.no_proxy if config.no_proxy
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param chef [VagrantPlugins::Chef::Config::Base] the Chef provisioner configuration
|
66
|
+
# @param scheme [String] the http protocol (http or https)
|
67
|
+
# @param uri [String] the URI with optional userinfo
|
68
|
+
def configure_chef_proxy(chef, scheme, uri)
|
69
|
+
if uri && !chef.public_send("#{scheme}_proxy")
|
70
|
+
u = UserinfoURI.new(uri)
|
71
|
+
chef.public_send("#{scheme}_proxy_user=", u.user)
|
72
|
+
chef.public_send("#{scheme}_proxy_pass=", u.pass)
|
73
|
+
chef.public_send("#{scheme}_proxy=", u.uri)
|
71
74
|
end
|
72
75
|
end
|
73
76
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
require_relative '../resource'
|
3
|
+
require_relative '../userinfo_uri'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module ProxyConf
|
7
|
+
class Action
|
8
|
+
# Action for configuring Yum on the guest
|
9
|
+
class ConfigureYumProxy < Base
|
10
|
+
def config_name
|
11
|
+
'yum_proxy'
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def configure_machine(machine, config)
|
17
|
+
tmp = "/tmp/vagrant-proxyconf"
|
18
|
+
path = config_path(machine)
|
19
|
+
|
20
|
+
machine.communicate.tap do |comm|
|
21
|
+
comm.sudo("rm #{tmp}", error_check: false)
|
22
|
+
comm.upload(ProxyConf.resource("yum_config.awk"), tmp)
|
23
|
+
comm.sudo("touch #{path}")
|
24
|
+
comm.sudo("gawk -f #{tmp} #{proxy_params(config)} #{path} > #{path}.new")
|
25
|
+
comm.sudo("chmod 0644 #{path}.new")
|
26
|
+
comm.sudo("chown root:root #{path}.new")
|
27
|
+
comm.sudo("mv #{path}.new #{path}")
|
28
|
+
comm.sudo("rm #{tmp}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def proxy_params(config)
|
33
|
+
u = UserinfoURI.new(config.http)
|
34
|
+
"-v proxy=#{escape(u.uri)} -v user=#{escape(u.user)} -v pass=#{escape(u.pass)}"
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param value [String, nil] the string to escape for shell usage
|
38
|
+
def escape(value)
|
39
|
+
value.to_s.shellescape
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ProxyConf
|
3
|
+
module Cap
|
4
|
+
module Redhat
|
5
|
+
# Capability for Yum proxy configuration
|
6
|
+
module YumProxyConf
|
7
|
+
# @return [String] the path to the configuration file
|
8
|
+
def self.yum_proxy_conf(machine)
|
9
|
+
'/etc/yum.conf'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'uri'
|
2
1
|
require 'vagrant'
|
3
2
|
require_relative 'key_mixin'
|
4
3
|
|
@@ -23,36 +22,6 @@ module VagrantPlugins
|
|
23
22
|
|
24
23
|
# @return [String] a comma separated list of hosts or domains which do not use proxies
|
25
24
|
key :no_proxy, env_var: 'VAGRANT_NO_PROXY'
|
26
|
-
|
27
|
-
# @return [String] username for the HTTP proxy
|
28
|
-
def http_user
|
29
|
-
user(http)
|
30
|
-
end
|
31
|
-
|
32
|
-
# @return [String] password for the HTTP proxy
|
33
|
-
def http_pass
|
34
|
-
pass(http)
|
35
|
-
end
|
36
|
-
|
37
|
-
# @return [String] username for the HTTPS proxy
|
38
|
-
def https_user
|
39
|
-
user(https)
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [String] password for the HTTPS proxy
|
43
|
-
def https_pass
|
44
|
-
pass(https)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def user(uri)
|
50
|
-
URI.parse(uri).user if uri
|
51
|
-
end
|
52
|
-
|
53
|
-
def pass(uri)
|
54
|
-
URI.parse(uri).password if uri
|
55
|
-
end
|
56
25
|
end
|
57
26
|
end
|
58
27
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
require_relative 'key_mixin'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module ProxyConf
|
6
|
+
module Config
|
7
|
+
# Proxy configuration for Yum
|
8
|
+
#
|
9
|
+
# @!parse class YumProxy < Vagrant::Plugin::V2::Config; end
|
10
|
+
class YumProxy < Vagrant.plugin('2', :config)
|
11
|
+
include KeyMixin
|
12
|
+
# @!parse extend KeyMixin::ClassMethods
|
13
|
+
|
14
|
+
# @return [String] the HTTP proxy
|
15
|
+
key :http, env_var: 'VAGRANT_YUM_HTTP_PROXY'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -67,6 +67,11 @@ module VagrantPlugins
|
|
67
67
|
Config::Proxy
|
68
68
|
end
|
69
69
|
|
70
|
+
config 'yum_proxy' do
|
71
|
+
require_relative 'config/yum_proxy'
|
72
|
+
Config::YumProxy
|
73
|
+
end
|
74
|
+
|
70
75
|
guest_capability 'debian', 'apt_proxy_conf' do
|
71
76
|
require_relative 'cap/debian/apt_proxy_conf'
|
72
77
|
Cap::Debian::AptProxyConf
|
@@ -77,6 +82,11 @@ module VagrantPlugins
|
|
77
82
|
Cap::Linux::EnvProxyConf
|
78
83
|
end
|
79
84
|
|
85
|
+
guest_capability 'redhat', 'yum_proxy_conf' do
|
86
|
+
require_relative 'cap/redhat/yum_proxy_conf'
|
87
|
+
Cap::Redhat::YumProxyConf
|
88
|
+
end
|
89
|
+
|
80
90
|
action_hook 'proxyconf_configure' do |hook|
|
81
91
|
require_relative 'action'
|
82
92
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
# Base module for Vagrant Proxyconf plugin
|
3
|
+
module ProxyConf
|
4
|
+
# @param name [String] the resource file name
|
5
|
+
# @return [String] the absolute path to the resource file
|
6
|
+
def self.resource(name)
|
7
|
+
File.join(resource_root, name)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# @return [String] the absolute åath to the resource directory
|
13
|
+
def self.resource_root
|
14
|
+
File.expand_path('../../../resources', __FILE__)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ProxyConf
|
5
|
+
# Helper class that strips userinfo from the URI to separate attributes
|
6
|
+
class UserinfoURI
|
7
|
+
# @return [String] the URI without userinfo
|
8
|
+
attr_reader :uri
|
9
|
+
|
10
|
+
alias_method :to_s, :uri
|
11
|
+
|
12
|
+
# @return [String] the username
|
13
|
+
attr_reader :user
|
14
|
+
|
15
|
+
# @return [String] the password
|
16
|
+
attr_reader :pass
|
17
|
+
|
18
|
+
# @param uri [String] the URI including optional userinfo
|
19
|
+
def initialize(uri)
|
20
|
+
if uri
|
21
|
+
u = URI.parse(uri)
|
22
|
+
@uri = strip_userinfo(u)
|
23
|
+
@user = u.user
|
24
|
+
@pass = u.password
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
# @param uri [URI::Generic] the URI with optional userinfo
|
31
|
+
# @return [String] the URI without userinfo
|
32
|
+
def strip_userinfo(uri)
|
33
|
+
u = uri.dup
|
34
|
+
u.userinfo = ''
|
35
|
+
u.to_s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/locales/en.yml
CHANGED
@@ -24,6 +24,14 @@ en:
|
|
24
24
|
configuring: |-
|
25
25
|
Configuring proxy environment variables...
|
26
26
|
|
27
|
+
yum_proxy:
|
28
|
+
not_enabled: |-
|
29
|
+
yum_proxy not enabled or configured
|
30
|
+
not_supported: |-
|
31
|
+
Skipping Yum proxy config as the machine does not support it
|
32
|
+
configuring: |-
|
33
|
+
Configuring proxy for Yum...
|
34
|
+
|
27
35
|
errors:
|
28
36
|
vagrant_version: |-
|
29
37
|
vagrant-proxyconf plugin requires Vagrant %{min_version} or newer
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env gawk
|
2
|
+
#
|
3
|
+
# Adds or modifies proxy configuration for Yum
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
# yum_config.awk -v proxy=http://proxy:1234 -v user=foo -v pass=bar /etc/yum.comf
|
7
|
+
#
|
8
|
+
# License: MIT
|
9
|
+
# Copyright (c) 2013 Teemu Matilainen <teemu.matilainen@iki.fi>
|
10
|
+
#
|
11
|
+
|
12
|
+
BEGIN {
|
13
|
+
FS = OFS = "="
|
14
|
+
|
15
|
+
# [main] section:
|
16
|
+
# 0: not seen yet
|
17
|
+
# 1: inside of it
|
18
|
+
# 2: already on another section
|
19
|
+
main = 0
|
20
|
+
|
21
|
+
conf["proxy"] = (proxy ? proxy : "_none_")
|
22
|
+
conf["proxy_username"] = (proxy ? user : "")
|
23
|
+
conf["proxy_password"] = (proxy ? pass : "")
|
24
|
+
}
|
25
|
+
|
26
|
+
# Section headers
|
27
|
+
/^\[.*\]$/ {
|
28
|
+
if ($0 == "[main]") {
|
29
|
+
# entering [main] section
|
30
|
+
main = 1
|
31
|
+
} else if (main == 1) {
|
32
|
+
# [main] section ended
|
33
|
+
print_proxy_conf()
|
34
|
+
main = 2
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
# Old configuration
|
39
|
+
$1 ~ /^proxy(_username|_password)?$/ {
|
40
|
+
if (main == 1) {
|
41
|
+
$2 = conf[$1]
|
42
|
+
seen[$1] = 1
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
# Print every line by default
|
47
|
+
{ print $0 }
|
48
|
+
|
49
|
+
# Print missing configuration if needed
|
50
|
+
END {
|
51
|
+
if (main == 0) print "[main]"
|
52
|
+
if (main < 2) print_proxy_conf()
|
53
|
+
}
|
54
|
+
|
55
|
+
# Prints proxy* configuration not seen yet
|
56
|
+
function print_proxy_conf() {
|
57
|
+
print_key("proxy")
|
58
|
+
print_key("proxy_username")
|
59
|
+
print_key("proxy_password")
|
60
|
+
}
|
61
|
+
|
62
|
+
# Prints a proxy*=<value> line
|
63
|
+
function print_key(key) {
|
64
|
+
if (!seen[key]) print key, conf[key]
|
65
|
+
}
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
[main]
|
2
|
+
cachedir=/var/cache/yum/$basearch/$releasever
|
3
|
+
keepcache=0
|
4
|
+
debuglevel=2
|
5
|
+
logfile=/var/log/yum.log
|
6
|
+
exactarch=1
|
7
|
+
obsoletes=1
|
8
|
+
gpgcheck=1
|
9
|
+
plugins=1
|
10
|
+
installonly_limit=5
|
11
|
+
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
|
12
|
+
distroverpkg=centos-release
|
13
|
+
|
14
|
+
# This is the default, if you make this bigger yum won't see if the metadata
|
15
|
+
# is newer on the remote and so you'll "gain" the bandwidth of not having to
|
16
|
+
# download the new metadata and "pay" for it by yum not having correct
|
17
|
+
# information.
|
18
|
+
# It is esp. important, to have correct metadata, for distributions like
|
19
|
+
# Fedora which don't keep old packages around. If you don't like this checking
|
20
|
+
# interupting your command line usage, it's much better to have something
|
21
|
+
# manually check the metadata once an hour (yum-updatesd will do this).
|
22
|
+
# metadata_expire=90m
|
23
|
+
|
24
|
+
# PUT YOUR REPOS HERE OR IN separate files named file.repo
|
25
|
+
# in /etc/yum.repos.d
|
@@ -0,0 +1,28 @@
|
|
1
|
+
[main]
|
2
|
+
cachedir=/var/cache/yum/$basearch/$releasever
|
3
|
+
keepcache=0
|
4
|
+
debuglevel=2
|
5
|
+
logfile=/var/log/yum.log
|
6
|
+
exactarch=1
|
7
|
+
obsoletes=1
|
8
|
+
gpgcheck=1
|
9
|
+
plugins=1
|
10
|
+
installonly_limit=5
|
11
|
+
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
|
12
|
+
distroverpkg=centos-release
|
13
|
+
|
14
|
+
# This is the default, if you make this bigger yum won't see if the metadata
|
15
|
+
# is newer on the remote and so you'll "gain" the bandwidth of not having to
|
16
|
+
# download the new metadata and "pay" for it by yum not having correct
|
17
|
+
# information.
|
18
|
+
# It is esp. important, to have correct metadata, for distributions like
|
19
|
+
# Fedora which don't keep old packages around. If you don't like this checking
|
20
|
+
# interupting your command line usage, it's much better to have something
|
21
|
+
# manually check the metadata once an hour (yum-updatesd will do this).
|
22
|
+
# metadata_expire=90m
|
23
|
+
|
24
|
+
# PUT YOUR REPOS HERE OR IN separate files named file.repo
|
25
|
+
# in /etc/yum.repos.d
|
26
|
+
proxy=_none_
|
27
|
+
proxy_username=
|
28
|
+
proxy_password=
|
@@ -0,0 +1,28 @@
|
|
1
|
+
[main]
|
2
|
+
cachedir=/var/cache/yum/$basearch/$releasever
|
3
|
+
keepcache=0
|
4
|
+
debuglevel=2
|
5
|
+
logfile=/var/log/yum.log
|
6
|
+
exactarch=1
|
7
|
+
obsoletes=1
|
8
|
+
gpgcheck=1
|
9
|
+
plugins=1
|
10
|
+
installonly_limit=5
|
11
|
+
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
|
12
|
+
distroverpkg=centos-release
|
13
|
+
|
14
|
+
# This is the default, if you make this bigger yum won't see if the metadata
|
15
|
+
# is newer on the remote and so you'll "gain" the bandwidth of not having to
|
16
|
+
# download the new metadata and "pay" for it by yum not having correct
|
17
|
+
# information.
|
18
|
+
# It is esp. important, to have correct metadata, for distributions like
|
19
|
+
# Fedora which don't keep old packages around. If you don't like this checking
|
20
|
+
# interupting your command line usage, it's much better to have something
|
21
|
+
# manually check the metadata once an hour (yum-updatesd will do this).
|
22
|
+
# metadata_expire=90m
|
23
|
+
|
24
|
+
# PUT YOUR REPOS HERE OR IN separate files named file.repo
|
25
|
+
# in /etc/yum.repos.d
|
26
|
+
proxy=http://proxy.example.com:3128/
|
27
|
+
proxy_username=foo
|
28
|
+
proxy_password=bar
|
@@ -27,9 +27,8 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureChefProxy do
|
|
27
27
|
|
28
28
|
context "with specified default configurations" do
|
29
29
|
before :each do
|
30
|
-
config.http
|
31
|
-
config.
|
32
|
-
config.https = false
|
30
|
+
config.http = 'http://bar:baz@foo:1234'
|
31
|
+
config.https = false
|
33
32
|
|
34
33
|
configure_chef
|
35
34
|
end
|
@@ -37,7 +36,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureChefProxy do
|
|
37
36
|
it "configures chef" do
|
38
37
|
expect(chef.http_proxy).to eq 'http://foo:1234'
|
39
38
|
expect(chef.http_proxy_user).to eq 'bar'
|
40
|
-
expect(chef.http_proxy_pass).to
|
39
|
+
expect(chef.http_proxy_pass).to eq 'baz'
|
41
40
|
expect(chef.https_proxy).to be_nil
|
42
41
|
expect(chef.https_proxy_user).to be_nil
|
43
42
|
expect(chef.https_proxy_pass).to be_nil
|
@@ -46,13 +45,11 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureChefProxy do
|
|
46
45
|
|
47
46
|
context "with specified chef configurations" do
|
48
47
|
before :each do
|
49
|
-
chef.http_proxy
|
50
|
-
chef.no_proxy
|
48
|
+
chef.http_proxy = 'http://proxy:8080/'
|
49
|
+
chef.no_proxy = 'localhost'
|
51
50
|
|
52
|
-
config.http
|
53
|
-
config.
|
54
|
-
config.http_pass = false
|
55
|
-
config.https = 'http://sslproxy:3128/'
|
51
|
+
config.http = 'http://foo:@default:7070/'
|
52
|
+
config.https = 'http://sslproxy:3128/'
|
56
53
|
|
57
54
|
configure_chef
|
58
55
|
end
|
@@ -65,7 +62,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureChefProxy do
|
|
65
62
|
end
|
66
63
|
|
67
64
|
it "configures unset proxies" do
|
68
|
-
expect(chef.https_proxy).to
|
65
|
+
expect(chef.https_proxy).to eq 'http://sslproxy:3128/'
|
69
66
|
end
|
70
67
|
end
|
71
68
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-proxyconf/action/configure_yum_proxy'
|
3
|
+
|
4
|
+
describe VagrantPlugins::ProxyConf::Action::ConfigureYumProxy do
|
5
|
+
|
6
|
+
describe '#config_name' do
|
7
|
+
subject { described_class.new(double, double).config_name }
|
8
|
+
it { should eq 'yum_proxy' }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#proxy_params' do
|
12
|
+
subject { described_class.new(nil, nil).send(:proxy_params, config) }
|
13
|
+
let(:config) { OpenStruct.new(http: http) }
|
14
|
+
|
15
|
+
context "with `false`" do
|
16
|
+
let(:http) { false }
|
17
|
+
it { should eq %q{-v proxy='' -v user='' -v pass=''} }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "without userinfo" do
|
21
|
+
let(:http) { 'http://proxy:1234/' }
|
22
|
+
it { should eq %q{-v proxy=http://proxy:1234/ -v user='' -v pass=''} }
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with userinfo" do
|
26
|
+
let(:http) { 'http://foo:bar@myproxy:9876' }
|
27
|
+
it { should eq %q{-v proxy=http://myproxy:9876 -v user=foo -v pass=bar} }
|
28
|
+
end
|
29
|
+
|
30
|
+
context "with special characters" do
|
31
|
+
let(:http) { %q{http://x*y:a(b@proxy.com:8080} }
|
32
|
+
it { should eq %q{-v proxy=http://proxy.com:8080 -v user=x\\*y -v pass=a\\(b} }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-proxyconf/cap/redhat/yum_proxy_conf'
|
3
|
+
|
4
|
+
describe VagrantPlugins::ProxyConf::Cap::Redhat::YumProxyConf do
|
5
|
+
|
6
|
+
describe '.yum_proxy_conf' do
|
7
|
+
let(:subject) { described_class.yum_proxy_conf(double) }
|
8
|
+
it { should eq '/etc/yum.conf' }
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -2,66 +2,4 @@ require 'spec_helper'
|
|
2
2
|
require 'vagrant-proxyconf/config/proxy'
|
3
3
|
|
4
4
|
describe VagrantPlugins::ProxyConf::Config::Proxy do
|
5
|
-
before :each do
|
6
|
-
# Ensure tests are not affected by environment variables
|
7
|
-
%w[HTTP_PROXY HTTPS_PROXY FTP_PROXY NO_PROXY].each do |var|
|
8
|
-
ENV.delete("VAGRANT_#{var}")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
subject do
|
13
|
-
described_class.new.tap do |config|
|
14
|
-
config.http = http_proxy
|
15
|
-
config.https = https_proxy
|
16
|
-
end
|
17
|
-
end
|
18
|
-
let(:http_proxy) { nil }
|
19
|
-
let(:https_proxy) { nil }
|
20
|
-
|
21
|
-
context "defaults" do
|
22
|
-
its(:http_user) { should be_nil }
|
23
|
-
its(:http_pass) { should be_nil }
|
24
|
-
its(:https_user) { should be_nil }
|
25
|
-
its(:https_pass) { should be_nil }
|
26
|
-
end
|
27
|
-
|
28
|
-
context "without userinfo" do
|
29
|
-
let(:http_proxy) { 'http://proxy.example.com:8123/' }
|
30
|
-
let(:https_proxy) { '' }
|
31
|
-
|
32
|
-
its(:http_user) { should be_nil }
|
33
|
-
its(:http_pass) { should be_nil }
|
34
|
-
its(:https_user) { should be_nil }
|
35
|
-
its(:https_pass) { should be_nil }
|
36
|
-
end
|
37
|
-
|
38
|
-
context "with username" do
|
39
|
-
let(:http_proxy) { 'http://foo@proxy.example.com:8123/' }
|
40
|
-
let(:https_proxy) { 'http://bar@localhost' }
|
41
|
-
|
42
|
-
its(:http_user) { should eq 'foo' }
|
43
|
-
its(:http_pass) { should be_nil }
|
44
|
-
its(:https_user) { should eq 'bar' }
|
45
|
-
its(:https_pass) { should be_nil }
|
46
|
-
end
|
47
|
-
|
48
|
-
context "with userinfo" do
|
49
|
-
let(:http_proxy) { 'http://foo:bar@proxy.example.com:8123/' }
|
50
|
-
let(:https_proxy) { 'http://:baz@localhost' }
|
51
|
-
|
52
|
-
its(:http_user) { should eq 'foo' }
|
53
|
-
its(:http_pass) { should eq 'bar' }
|
54
|
-
its(:https_user) { should eq '' }
|
55
|
-
its(:https_pass) { should eq 'baz' }
|
56
|
-
end
|
57
|
-
|
58
|
-
context "with false" do
|
59
|
-
let(:http_proxy) { false }
|
60
|
-
let(:https_proxy) { false }
|
61
|
-
|
62
|
-
its(:http_user) { should be_nil }
|
63
|
-
its(:http_pass) { should be_nil }
|
64
|
-
its(:https_user) { should be_nil }
|
65
|
-
its(:https_pass) { should be_nil }
|
66
|
-
end
|
67
5
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-proxyconf/resource'
|
3
|
+
|
4
|
+
describe VagrantPlugins::ProxyConf do
|
5
|
+
describe ".resource" do
|
6
|
+
let(:root_dir) { File.expand_path('../../../..', __FILE__) }
|
7
|
+
|
8
|
+
it "returns path to the specified file" do
|
9
|
+
expect(described_class.resource('foo.txt').to_s).to eq File.join(root_dir, 'resources', 'foo.txt')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'unit/support/fixture'
|
3
|
+
require 'vagrant-proxyconf/resource'
|
4
|
+
|
5
|
+
describe 'resources/yum_config.awk' do
|
6
|
+
def configure(config = {})
|
7
|
+
cmd = "gawk -f #{VagrantPlugins::ProxyConf.resource('yum_config.awk')}"
|
8
|
+
cmd << %w[proxy user pass].map { |var| " -v #{var}=#{config[var.to_sym].to_s.shellescape}" }.join
|
9
|
+
cmd << " #{fixture_path(old_conf)}"
|
10
|
+
`#{cmd}`
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with empty old conf" do
|
14
|
+
let(:old_conf) { 'empty' }
|
15
|
+
|
16
|
+
it "adds the specified proxy" do
|
17
|
+
expect(configure(proxy: 'http://proxy:1234')).to eq fixture('yum_only_proxy.conf')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "adds proxy and userinfo" do
|
21
|
+
conf = { proxy: 'http://proxy.example.com:3128/', user: 'foo', pass: 'bar' }
|
22
|
+
expect(configure(conf)).to eq fixture('yum_only_proxy_and_userinfo.conf')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "adds disabled proxy if proxy not specified" do
|
26
|
+
expect(configure(user: 'foo')).to eq fixture('yum_only_disabled_proxy.conf')
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with only main section" do
|
32
|
+
let(:old_conf) { 'yum_only_main.conf' }
|
33
|
+
|
34
|
+
it "adds the specified proxy" do
|
35
|
+
conf = { proxy: 'http://proxy.example.com:3128/', user: 'foo', pass: 'bar' }
|
36
|
+
expect(configure(conf)).to eq fixture('yum_only_main_with_proxy.conf')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "adds disabled proxy if proxy not specified" do
|
40
|
+
expect(configure(pass: 'bar')).to eq fixture('yum_only_main_with_disabled_proxy.conf')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with main and repository sections" do
|
45
|
+
context "without old proxy conf" do
|
46
|
+
let(:old_conf) { 'yum_with_repository.conf' }
|
47
|
+
|
48
|
+
it "adds the specified proxy" do
|
49
|
+
conf = { proxy: 'http://proxy.example.com:3128/', user: 'foo', pass: 'bar' }
|
50
|
+
expect(configure(conf)).to eq fixture('yum_with_repository_and_proxy.conf')
|
51
|
+
end
|
52
|
+
|
53
|
+
it "adds disabled proxy if proxy not specified" do
|
54
|
+
expect(configure).to eq fixture('yum_with_repository_and_disabled_proxy.conf')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "with old proxy conf" do
|
59
|
+
let(:old_conf) { 'yum_with_repository_and_proxy.conf' }
|
60
|
+
|
61
|
+
it "replaces existing proxy" do
|
62
|
+
conf = { proxy: 'http://newproxy:9876', user: 'baz' }
|
63
|
+
expect(configure(conf)).to eq fixture('yum_with_repository_and_new_proxy.conf')
|
64
|
+
end
|
65
|
+
|
66
|
+
it "disables existing proxy" do
|
67
|
+
conf = { proxy: '', user: 'baz' }
|
68
|
+
expect(configure(conf)).to eq fixture('yum_with_repository_and_disabled_proxy.conf')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "without userinfo" do
|
73
|
+
let(:old_conf) { 'yum_with_repository_and_proxy_without_userinfo.conf' }
|
74
|
+
|
75
|
+
it "replaces existing proxy and adds userinfo" do
|
76
|
+
conf = { proxy: 'http://proxy.example.com:3128/', user: 'foo', pass: 'bar' }
|
77
|
+
expect(configure(conf)).to eq fixture('yum_with_repository_and_proxy.conf')
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-proxyconf/userinfo_uri'
|
3
|
+
|
4
|
+
describe VagrantPlugins::ProxyConf::UserinfoURI do
|
5
|
+
|
6
|
+
subject { described_class.new(uri) }
|
7
|
+
|
8
|
+
context "with nil" do
|
9
|
+
let(:uri) { nil }
|
10
|
+
its(:to_s) { should be_nil }
|
11
|
+
its(:uri) { should be_nil }
|
12
|
+
its(:user) { should be_nil }
|
13
|
+
its(:pass) { should be_nil }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "with false" do
|
17
|
+
let(:uri) { false }
|
18
|
+
its(:to_s) { should be_nil }
|
19
|
+
its(:uri) { should be_nil }
|
20
|
+
its(:user) { should be_nil }
|
21
|
+
its(:pass) { should be_nil }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "with empty" do
|
25
|
+
let(:uri) { '' }
|
26
|
+
its(:to_s) { should eq '' }
|
27
|
+
its(:uri) { should eq '' }
|
28
|
+
its(:user) { should be_nil }
|
29
|
+
its(:pass) { should be_nil }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "without userinfo" do
|
33
|
+
let(:uri) { 'http://proxy.example.com:8123/' }
|
34
|
+
its(:to_s) { should eq 'http://proxy.example.com:8123/' }
|
35
|
+
its(:uri) { should eq 'http://proxy.example.com:8123/' }
|
36
|
+
its(:user) { should be_nil }
|
37
|
+
its(:pass) { should be_nil }
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with username" do
|
41
|
+
let(:uri) { 'http://foo@proxy.example.com:8123/' }
|
42
|
+
its(:to_s) { should eq 'http://proxy.example.com:8123/' }
|
43
|
+
its(:uri) { should eq 'http://proxy.example.com:8123/' }
|
44
|
+
its(:user) { should eq 'foo' }
|
45
|
+
its(:pass) { should be_nil }
|
46
|
+
end
|
47
|
+
|
48
|
+
context "with password" do
|
49
|
+
let(:uri) { 'http://:bar@proxy.example.com:8123/' }
|
50
|
+
its(:to_s) { should eq 'http://proxy.example.com:8123/' }
|
51
|
+
its(:uri) { should eq 'http://proxy.example.com:8123/' }
|
52
|
+
its(:user) { should eq '' }
|
53
|
+
its(:pass) { should eq 'bar' }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "with userinfo" do
|
57
|
+
let(:uri) { 'http://foo:bar@proxy.example.com:8123/' }
|
58
|
+
its(:to_s) { should eq 'http://proxy.example.com:8123/' }
|
59
|
+
its(:uri) { should eq 'http://proxy.example.com:8123/' }
|
60
|
+
its(:user) { should eq 'foo' }
|
61
|
+
its(:pass) { should eq 'bar' }
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-proxyconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teemu Matilainen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Vagrant plugin that configures the virtual machine to use proxy servers
|
14
14
|
email:
|
@@ -35,34 +35,59 @@ files:
|
|
35
35
|
- lib/vagrant-proxyconf/action/configure_apt_proxy.rb
|
36
36
|
- lib/vagrant-proxyconf/action/configure_chef_proxy.rb
|
37
37
|
- lib/vagrant-proxyconf/action/configure_env_proxy.rb
|
38
|
+
- lib/vagrant-proxyconf/action/configure_yum_proxy.rb
|
38
39
|
- lib/vagrant-proxyconf/action/only_once.rb
|
39
40
|
- lib/vagrant-proxyconf/cap/debian/apt_proxy_conf.rb
|
40
41
|
- lib/vagrant-proxyconf/cap/linux/env_proxy_conf.rb
|
42
|
+
- lib/vagrant-proxyconf/cap/redhat/yum_proxy_conf.rb
|
41
43
|
- lib/vagrant-proxyconf/config/apt_proxy.rb
|
42
44
|
- lib/vagrant-proxyconf/config/env_proxy.rb
|
43
45
|
- lib/vagrant-proxyconf/config/key.rb
|
44
46
|
- lib/vagrant-proxyconf/config/key_mixin.rb
|
45
47
|
- lib/vagrant-proxyconf/config/proxy.rb
|
48
|
+
- lib/vagrant-proxyconf/config/yum_proxy.rb
|
46
49
|
- lib/vagrant-proxyconf/logger.rb
|
47
50
|
- lib/vagrant-proxyconf/plugin.rb
|
51
|
+
- lib/vagrant-proxyconf/resource.rb
|
52
|
+
- lib/vagrant-proxyconf/userinfo_uri.rb
|
48
53
|
- lib/vagrant-proxyconf/version.rb
|
49
54
|
- locales/en.yml
|
55
|
+
- resources/yum_config.awk
|
50
56
|
- spec/spec_helper.rb
|
57
|
+
- spec/unit/fixtures/empty
|
58
|
+
- spec/unit/fixtures/yum_only_disabled_proxy.conf
|
59
|
+
- spec/unit/fixtures/yum_only_main.conf
|
60
|
+
- spec/unit/fixtures/yum_only_main_with_disabled_proxy.conf
|
61
|
+
- spec/unit/fixtures/yum_only_main_with_proxy.conf
|
62
|
+
- spec/unit/fixtures/yum_only_proxy.conf
|
63
|
+
- spec/unit/fixtures/yum_only_proxy_and_userinfo.conf
|
64
|
+
- spec/unit/fixtures/yum_with_repository.conf
|
65
|
+
- spec/unit/fixtures/yum_with_repository_and_disabled_proxy.conf
|
66
|
+
- spec/unit/fixtures/yum_with_repository_and_new_proxy.conf
|
67
|
+
- spec/unit/fixtures/yum_with_repository_and_proxy.conf
|
68
|
+
- spec/unit/fixtures/yum_with_repository_and_proxy_without_userinfo.conf
|
69
|
+
- spec/unit/support/fixture.rb
|
51
70
|
- spec/unit/support/shared/apt_proxy_config.rb
|
52
71
|
- spec/unit/vagrant-proxyconf/action/configure_apt_proxy_spec.rb
|
53
72
|
- spec/unit/vagrant-proxyconf/action/configure_chef_proxy_spec.rb
|
54
73
|
- spec/unit/vagrant-proxyconf/action/configure_env_proxy_spec.rb
|
74
|
+
- spec/unit/vagrant-proxyconf/action/configure_yum_proxy_spec.rb
|
55
75
|
- spec/unit/vagrant-proxyconf/action/only_once_spec.rb
|
56
76
|
- spec/unit/vagrant-proxyconf/action_spec.rb
|
57
77
|
- spec/unit/vagrant-proxyconf/cap/debian/apt_proxy_conf_spec.rb
|
58
78
|
- spec/unit/vagrant-proxyconf/cap/linux/env_proxy_conf_spec.rb
|
79
|
+
- spec/unit/vagrant-proxyconf/cap/redhat/yum_proxy_conf_spec.rb
|
59
80
|
- spec/unit/vagrant-proxyconf/config/apt_proxy_spec.rb
|
60
81
|
- spec/unit/vagrant-proxyconf/config/env_proxy_spec.rb
|
61
82
|
- spec/unit/vagrant-proxyconf/config/key_mixin_spec.rb
|
62
83
|
- spec/unit/vagrant-proxyconf/config/key_spec.rb
|
63
84
|
- spec/unit/vagrant-proxyconf/config/proxy_spec.rb
|
85
|
+
- spec/unit/vagrant-proxyconf/config/yum_proxy_spec.rb
|
64
86
|
- spec/unit/vagrant-proxyconf/logger_spec.rb
|
65
87
|
- spec/unit/vagrant-proxyconf/plugin_spec.rb
|
88
|
+
- spec/unit/vagrant-proxyconf/resource_spec.rb
|
89
|
+
- spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb
|
90
|
+
- spec/unit/vagrant-proxyconf/userinfo_uri_spec.rb
|
66
91
|
- vagrant-proxyconf.gemspec
|
67
92
|
homepage: http://tmatilai.github.io/vagrant-proxyconf/
|
68
93
|
licenses:
|
@@ -79,9 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
104
|
version: '0'
|
80
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
106
|
requirements:
|
82
|
-
- - ! '
|
107
|
+
- - ! '>'
|
83
108
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
109
|
+
version: 1.3.1
|
85
110
|
requirements: []
|
86
111
|
rubyforge_project:
|
87
112
|
rubygems_version: 2.1.4
|
@@ -90,19 +115,38 @@ specification_version: 4
|
|
90
115
|
summary: A Vagrant plugin that configures the virtual machine to use proxy servers
|
91
116
|
test_files:
|
92
117
|
- spec/spec_helper.rb
|
118
|
+
- spec/unit/fixtures/empty
|
119
|
+
- spec/unit/fixtures/yum_only_disabled_proxy.conf
|
120
|
+
- spec/unit/fixtures/yum_only_main.conf
|
121
|
+
- spec/unit/fixtures/yum_only_main_with_disabled_proxy.conf
|
122
|
+
- spec/unit/fixtures/yum_only_main_with_proxy.conf
|
123
|
+
- spec/unit/fixtures/yum_only_proxy.conf
|
124
|
+
- spec/unit/fixtures/yum_only_proxy_and_userinfo.conf
|
125
|
+
- spec/unit/fixtures/yum_with_repository.conf
|
126
|
+
- spec/unit/fixtures/yum_with_repository_and_disabled_proxy.conf
|
127
|
+
- spec/unit/fixtures/yum_with_repository_and_new_proxy.conf
|
128
|
+
- spec/unit/fixtures/yum_with_repository_and_proxy.conf
|
129
|
+
- spec/unit/fixtures/yum_with_repository_and_proxy_without_userinfo.conf
|
130
|
+
- spec/unit/support/fixture.rb
|
93
131
|
- spec/unit/support/shared/apt_proxy_config.rb
|
94
132
|
- spec/unit/vagrant-proxyconf/action/configure_apt_proxy_spec.rb
|
95
133
|
- spec/unit/vagrant-proxyconf/action/configure_chef_proxy_spec.rb
|
96
134
|
- spec/unit/vagrant-proxyconf/action/configure_env_proxy_spec.rb
|
135
|
+
- spec/unit/vagrant-proxyconf/action/configure_yum_proxy_spec.rb
|
97
136
|
- spec/unit/vagrant-proxyconf/action/only_once_spec.rb
|
98
137
|
- spec/unit/vagrant-proxyconf/action_spec.rb
|
99
138
|
- spec/unit/vagrant-proxyconf/cap/debian/apt_proxy_conf_spec.rb
|
100
139
|
- spec/unit/vagrant-proxyconf/cap/linux/env_proxy_conf_spec.rb
|
140
|
+
- spec/unit/vagrant-proxyconf/cap/redhat/yum_proxy_conf_spec.rb
|
101
141
|
- spec/unit/vagrant-proxyconf/config/apt_proxy_spec.rb
|
102
142
|
- spec/unit/vagrant-proxyconf/config/env_proxy_spec.rb
|
103
143
|
- spec/unit/vagrant-proxyconf/config/key_mixin_spec.rb
|
104
144
|
- spec/unit/vagrant-proxyconf/config/key_spec.rb
|
105
145
|
- spec/unit/vagrant-proxyconf/config/proxy_spec.rb
|
146
|
+
- spec/unit/vagrant-proxyconf/config/yum_proxy_spec.rb
|
106
147
|
- spec/unit/vagrant-proxyconf/logger_spec.rb
|
107
148
|
- spec/unit/vagrant-proxyconf/plugin_spec.rb
|
149
|
+
- spec/unit/vagrant-proxyconf/resource_spec.rb
|
150
|
+
- spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb
|
151
|
+
- spec/unit/vagrant-proxyconf/userinfo_uri_spec.rb
|
108
152
|
has_rdoc:
|