vagrant-proxyconf 2.0.3 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +12 -7
- data/CHANGELOG.md +141 -1
- data/Gemfile +1 -18
- data/Jenkinsfile +60 -0
- data/Makefile +33 -0
- data/README.md +22 -0
- data/deps/patches/lib/vagrant/bundler.rb.patch +14 -0
- data/jenkins/helper_functions +206 -0
- data/lib/vagrant-proxyconf/action/base.rb +20 -9
- data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +21 -21
- data/lib/vagrant-proxyconf/config/apt_proxy.rb +21 -2
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/spec/unit/support/shared/apt_proxy_config.rb +12 -0
- data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +23 -21
- data/spec/unit/vagrant-proxyconf/action/configure_svn_proxy_spec.rb +1 -0
- data/test/issues/172/README.md +2 -2
- data/test/issues/172/spec/docker_host/redhat_spec.rb +2 -2
- data/test/issues/180/spec/docker_host/redhat_spec.rb +2 -2
- data/test/issues/192/.rspec +2 -0
- data/test/issues/192/Dockerfile +47 -0
- data/test/issues/192/Dockerfile.bionic +40 -0
- data/test/issues/192/README.md +29 -0
- data/test/issues/192/Rakefile +27 -0
- data/test/issues/192/Vagrantfile +64 -0
- data/test/issues/192/entrypoint.sh +50 -0
- data/test/issues/192/spec/default/redhat_spec.rb +15 -0
- data/test/issues/192/spec/docker_host/ubuntu_spec.rb +3 -0
- data/test/issues/192/spec/spec_helper.rb +52 -0
- data/test/issues/192/tinyproxy.conf +333 -0
- data/test/issues/199/.rspec +2 -0
- data/test/issues/199/Dockerfile +47 -0
- data/test/issues/199/README.md +31 -0
- data/test/issues/199/Rakefile +27 -0
- data/test/issues/199/Vagrantfile +74 -0
- data/test/issues/199/entrypoint.sh +50 -0
- data/test/issues/199/spec/apt_host/ubuntu_spec.rb +135 -0
- data/test/issues/199/spec/default/redhat_spec.rb +15 -0
- data/test/issues/199/spec/spec_helper.rb +52 -0
- data/test/issues/199/tinyproxy.conf +333 -0
- metadata +49 -4
@@ -87,13 +87,17 @@ module VagrantPlugins
|
|
87
87
|
local_tmp = tempfile(config)
|
88
88
|
|
89
89
|
logger.debug "Configuration (#{path}):\n#{config}"
|
90
|
+
|
90
91
|
@machine.communicate.tap do |comm|
|
91
|
-
comm.sudo("rm -f #{tmp}", error_check: false)
|
92
92
|
comm.upload(local_tmp.path, tmp)
|
93
|
-
comm.
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
if comm.test("command -v sudo")
|
94
|
+
comm.sudo("chmod #{opts[:mode] || '0644'} #{tmp}")
|
95
|
+
comm.sudo("chown #{opts[:owner] || 'root:root'} #{tmp}")
|
96
|
+
comm.sudo("mkdir -p #{File.dirname(path)}")
|
97
|
+
comm.sudo("mv -f #{tmp} #{path}")
|
98
|
+
else
|
99
|
+
raise Vagrant::Errors::CommandUnavailable.new(file: "sudo")
|
100
|
+
end
|
97
101
|
end
|
98
102
|
end
|
99
103
|
|
@@ -104,11 +108,18 @@ module VagrantPlugins
|
|
104
108
|
|
105
109
|
# @return [Tempfile] a temporary file with the specified content
|
106
110
|
def tempfile(content)
|
107
|
-
Tempfile.new("vagrant")
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
+
tempfile = Tempfile.new("vagrant-proxyconf")
|
112
|
+
|
113
|
+
begin
|
114
|
+
tempfile.tap do |tmp|
|
115
|
+
tmp.binmode
|
116
|
+
tmp.write(content)
|
117
|
+
end
|
118
|
+
ensure
|
119
|
+
tempfile.close
|
111
120
|
end
|
121
|
+
|
122
|
+
tempfile
|
112
123
|
end
|
113
124
|
|
114
125
|
def cap_name
|
@@ -39,28 +39,28 @@ module VagrantPlugins
|
|
39
39
|
true
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
return @
|
42
|
+
def docker_client_config
|
43
|
+
return @docker_client_config if @docker_client_config
|
44
44
|
return if !supports_config_json?
|
45
45
|
|
46
|
-
@
|
46
|
+
@docker_client_config = tempfile(Hash.new)
|
47
47
|
|
48
48
|
@machine.communicate.tap do |comm|
|
49
49
|
if comm.test("[ -f /etc/docker/config.json ]")
|
50
50
|
logger.info('Downloading file /etc/docker/config.json')
|
51
51
|
comm.sudo("chmod 0644 /etc/docker/config.json")
|
52
|
-
comm.download("/etc/docker/config.json", @
|
53
|
-
logger.info("Downloaded /etc/docker/config.json to #{@
|
52
|
+
comm.download("/etc/docker/config.json", @docker_client_config.path)
|
53
|
+
logger.info("Downloaded /etc/docker/config.json to #{@docker_client_config.path}")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
@
|
57
|
+
@docker_client_config
|
58
58
|
end
|
59
59
|
|
60
60
|
def update_docker_client_config
|
61
|
-
return if !supports_config_json? || !
|
61
|
+
return if !supports_config_json? || !docker_client_config
|
62
62
|
|
63
|
-
content = File.read(@
|
63
|
+
content = File.read(@docker_client_config)
|
64
64
|
data = JSON.load(content)
|
65
65
|
|
66
66
|
if disabled?
|
@@ -92,20 +92,18 @@ module VagrantPlugins
|
|
92
92
|
|
93
93
|
config_json = JSON.pretty_generate(data)
|
94
94
|
|
95
|
-
@
|
95
|
+
@docker_client_config = tempfile(config_json)
|
96
96
|
|
97
97
|
@machine.communicate.tap do |comm|
|
98
|
-
comm.upload(@
|
98
|
+
comm.upload(@docker_client_config.path, "/tmp/vagrant-proxyconf-docker-config.json")
|
99
99
|
comm.sudo("mkdir -p /etc/docker")
|
100
|
-
comm.sudo("chown root:
|
100
|
+
comm.sudo("chown root:docker /etc/docker")
|
101
101
|
comm.sudo("mv /tmp/vagrant-proxyconf-docker-config.json /etc/docker/config.json")
|
102
|
-
comm.sudo("chown root:
|
102
|
+
comm.sudo("chown root:docker /etc/docker/config.json")
|
103
|
+
comm.sudo("chmod 0644 /etc/docker/config.json")
|
103
104
|
comm.sudo("rm -f /tmp/vagrant-proxyconf-docker-config.json")
|
104
105
|
|
105
106
|
comm.sudo("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
|
106
|
-
if !disabled?
|
107
|
-
comm.sudo("echo DOCKER_CONFIG=/etc/docker >> /etc/environment")
|
108
|
-
end
|
109
107
|
end
|
110
108
|
|
111
109
|
config_json
|
@@ -135,12 +133,12 @@ module VagrantPlugins
|
|
135
133
|
end
|
136
134
|
|
137
135
|
systemd_config = docker_systemd_config
|
138
|
-
@docker_systemd_config = tempfile(systemd_config)
|
136
|
+
@docker_systemd_config = tempfile(systemd_config)
|
139
137
|
|
140
138
|
@machine.communicate.tap do |comm|
|
141
139
|
|
142
140
|
comm.sudo("mkdir -p /etc/systemd/system/docker.service.d")
|
143
|
-
comm.upload(@docker_systemd_config, "/tmp/vagrant-proxyconf-docker-systemd-config")
|
141
|
+
comm.upload(@docker_systemd_config.path, "/tmp/vagrant-proxyconf-docker-systemd-config")
|
144
142
|
|
145
143
|
if comm.test("diff -Naur /etc/systemd/system/docker.service.d/http-proxy.conf /tmp/vagrant-proxyconf-docker-systemd-config")
|
146
144
|
# system config file is the same as the current config
|
@@ -154,6 +152,7 @@ module VagrantPlugins
|
|
154
152
|
end
|
155
153
|
|
156
154
|
comm.sudo('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
155
|
+
comm.sudo('touch /etc/systemd/system/docker.service.d/http-proxy.conf')
|
157
156
|
comm.sudo('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
158
157
|
|
159
158
|
if changed
|
@@ -197,10 +196,11 @@ module VagrantPlugins
|
|
197
196
|
|
198
197
|
# https://docs.docker.com/network/proxy/#configure-the-docker-client
|
199
198
|
# if docker version >= 17.07 it supports config.json
|
200
|
-
return true if major >= 17 && minor >= 7
|
201
|
-
|
202
199
|
# docker version < 17.07 so it does not support config.json
|
203
|
-
return false
|
200
|
+
return false if major <= 17 && minor < 7
|
201
|
+
|
202
|
+
# docker version must be >= 17.07 so we return true
|
203
|
+
return true
|
204
204
|
end
|
205
205
|
|
206
206
|
def supports_systemd?
|
@@ -234,7 +234,7 @@ module VagrantPlugins
|
|
234
234
|
|
235
235
|
# update config and restart docker when config changed
|
236
236
|
comm.sudo("chmod 0644 #{path}.new")
|
237
|
-
comm.sudo("chown root:
|
237
|
+
comm.sudo("chown root:docker #{path}.new")
|
238
238
|
comm.sudo("mv -f #{path}.new #{path}")
|
239
239
|
comm.sudo(service_restart_command)
|
240
240
|
end
|
@@ -20,6 +20,12 @@ module VagrantPlugins
|
|
20
20
|
# @return [String] the FTP proxy
|
21
21
|
key :ftp, env_var: 'VAGRANT_APT_FTP_PROXY'
|
22
22
|
|
23
|
+
# @return [String] whether APT should verify peer certificate
|
24
|
+
key :verify_peer, env_var: 'VAGRANT_APT_VERIFY_PEER'
|
25
|
+
|
26
|
+
# @return [String] whether APT should verify that certificate name matches server name
|
27
|
+
key :verify_host, env_var: 'VAGRANT_APT_VERIFY_HOST'
|
28
|
+
|
23
29
|
def finalize!
|
24
30
|
super
|
25
31
|
|
@@ -33,7 +39,15 @@ module VagrantPlugins
|
|
33
39
|
|
34
40
|
# (see KeyMixin#config_for)
|
35
41
|
def config_for(key, value)
|
36
|
-
|
42
|
+
if value
|
43
|
+
if key.name == :verify_host
|
44
|
+
%Q{Acquire::https::Verify-Host #{value.inspect};\n}
|
45
|
+
elsif key.name == :verify_peer
|
46
|
+
%Q{Acquire::https::Verify-Peer #{value.inspect};\n}
|
47
|
+
else
|
48
|
+
%Q{Acquire::#{key.name}::Proxy #{value.inspect};\n}
|
49
|
+
end
|
50
|
+
end
|
37
51
|
end
|
38
52
|
|
39
53
|
def finalize_uri(key, value)
|
@@ -55,7 +69,8 @@ module VagrantPlugins
|
|
55
69
|
end
|
56
70
|
|
57
71
|
def to_s
|
58
|
-
direct || "#{prefix}#{value}#{suffix}"
|
72
|
+
# direct || "#{prefix}#{value}#{suffix}"
|
73
|
+
direct || verify || "#{prefix}#{value}#{suffix}"
|
59
74
|
end
|
60
75
|
|
61
76
|
private
|
@@ -64,6 +79,10 @@ module VagrantPlugins
|
|
64
79
|
'DIRECT' if value.upcase == 'DIRECT'
|
65
80
|
end
|
66
81
|
|
82
|
+
def verify
|
83
|
+
value if ["true", "false"].to_set.include? value
|
84
|
+
end
|
85
|
+
|
67
86
|
# Hash of deprecation warning sentinels
|
68
87
|
@@warned = {}
|
69
88
|
|
@@ -8,6 +8,10 @@ end
|
|
8
8
|
def conf_line(proto, name, port = 3142)
|
9
9
|
if name == :direct
|
10
10
|
%Q{Acquire::#{proto}::Proxy "DIRECT";\n}
|
11
|
+
elsif proto == :verify_peer
|
12
|
+
%Q{Acquire::https::Verify-Peer "#{name}";\n}
|
13
|
+
elsif proto == :verify_host
|
14
|
+
%Q{Acquire::https::Verify-Host "#{name}";\n}
|
11
15
|
else
|
12
16
|
port = ":#{port}" if port
|
13
17
|
%Q{Acquire::#{proto}::Proxy "#{proto}://#{name}#{port}";\n}
|
@@ -65,6 +69,14 @@ shared_examples "apt proxy config" do |proto|
|
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
72
|
+
[:verify_peer, :verify_host].each do |verify|
|
73
|
+
context "with #{verify.inspect}" do
|
74
|
+
subject { config_with(verify => "false") }
|
75
|
+
its(:enabled?) { should be_truthy }
|
76
|
+
its(:to_s) { should eq conf_line(verify, "false") }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
68
80
|
[false, ""].each do |unset|
|
69
81
|
context "with #{unset.inspect}" do
|
70
82
|
subject { config_with(proto => unset) }
|
@@ -10,7 +10,7 @@ def mock_write_docker_config(machine)
|
|
10
10
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("cat /tmp/vagrant-proxyconf >> /etc/default/docker.new")
|
11
11
|
allow(machine).to receive_message_chain(:communicate, :test).with("diff /etc/default/docker.new /etc/default/docker")
|
12
12
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/default/docker.new")
|
13
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
13
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/default/docker.new")
|
14
14
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mv -f /etc/default/docker.new /etc/default/docker")
|
15
15
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("kill -HUP `pgrep -f 'docker'` || systemctl restart docker || service docker restart || /etc/init.d/docker restart")
|
16
16
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf /etc/default/docker.new")
|
@@ -19,12 +19,13 @@ end
|
|
19
19
|
def mock_update_docker_client_config(machine)
|
20
20
|
allow(machine).to receive_message_chain(:communicate, :upload)
|
21
21
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mv /tmp/vagrant-proxyconf-docker-config.json /etc/docker/config.json")
|
22
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
22
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker/config.json")
|
23
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/docker/config.json")
|
23
24
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf-docker-config.json")
|
24
25
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
|
25
26
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("echo DOCKER_CONFIG=/etc/docker >> /etc/environment")
|
26
27
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/docker")
|
27
|
-
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:
|
28
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker")
|
28
29
|
end
|
29
30
|
|
30
31
|
def mock_update_docker_systemd_config(machine)
|
@@ -71,9 +72,9 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
71
72
|
docker_proxy = described_class.new(app, env)
|
72
73
|
docker_proxy.instance_variable_set(:@machine, machine)
|
73
74
|
|
74
|
-
# #
|
75
|
+
# #docker_client_config mock
|
75
76
|
fixture = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
76
|
-
docker_proxy.instance_variable_set(:@
|
77
|
+
docker_proxy.instance_variable_set(:@docker_client_config, fixture)
|
77
78
|
|
78
79
|
# #supported? mock
|
79
80
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
@@ -123,9 +124,9 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
123
124
|
docker_proxy = described_class.new(app, env)
|
124
125
|
docker_proxy.instance_variable_set(:@machine, machine)
|
125
126
|
|
126
|
-
# #
|
127
|
+
# #docker_client_config mock
|
127
128
|
fixture = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
128
|
-
docker_proxy.instance_variable_set(:@
|
129
|
+
docker_proxy.instance_variable_set(:@docker_client_config, fixture)
|
129
130
|
|
130
131
|
# #supported? mock
|
131
132
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
@@ -163,6 +164,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
163
164
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/systemd/system/docker.service.d")
|
164
165
|
allow(machine).to receive_message_chain(:communicate, :upload).with(@docker_proxy.instance_variable_get(:@docker_systemd_config), "/tmp")
|
165
166
|
allow(machine).to receive_message_chain(:communicate, :sudo).with('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
167
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('touch /etc/systemd/system/docker.service.d/http-proxy.conf')
|
166
168
|
allow(machine).to receive_message_chain(:communicate, :sudo).with('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
167
169
|
allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(false)
|
168
170
|
allow(machine).to receive_message_chain(:communicate, :test).with('diff -Naur /etc/systemd/system/docker.service.d/http-proxy.conf /tmp/vagrant-proxyconf-docker-systemd-config').and_return(false)
|
@@ -181,7 +183,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
181
183
|
end
|
182
184
|
end
|
183
185
|
|
184
|
-
describe "#
|
186
|
+
describe "#docker_client_config" do
|
185
187
|
let(:machine) { double('machine') }
|
186
188
|
|
187
189
|
context "when not supported" do
|
@@ -195,7 +197,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
195
197
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
196
198
|
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_proxy_conf).and_return('/etc/default/docker')
|
197
199
|
|
198
|
-
docker_proxy.send(:
|
200
|
+
docker_proxy.send(:docker_client_config)
|
199
201
|
end
|
200
202
|
|
201
203
|
it { is_expected.to eq nil }
|
@@ -206,7 +208,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
206
208
|
subject do
|
207
209
|
docker_proxy = described_class.new(nil, nil)
|
208
210
|
docker_proxy.instance_variable_set(:@machine, machine)
|
209
|
-
docker_proxy.instance_variable_set(:@
|
211
|
+
docker_proxy.instance_variable_set(:@docker_client_config, nil)
|
210
212
|
|
211
213
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
212
214
|
|
@@ -214,27 +216,27 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
214
216
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/docker/config.json")
|
215
217
|
allow(machine).to receive_message_chain(:communicate, :download)
|
216
218
|
|
217
|
-
docker_proxy.send(:
|
219
|
+
docker_proxy.send(:docker_client_config)
|
218
220
|
end
|
219
221
|
|
220
|
-
it { expect(File.exists?(subject)).to eq true }
|
222
|
+
it { expect(File.exists?(subject.path)).to eq true }
|
221
223
|
end
|
222
224
|
|
223
225
|
context "when /etc/docker/config.json does not exist" do
|
224
226
|
subject do
|
225
227
|
docker_proxy = described_class.new(nil, nil)
|
226
228
|
docker_proxy.instance_variable_set(:@machine, machine)
|
227
|
-
docker_proxy.instance_variable_set(:@
|
229
|
+
docker_proxy.instance_variable_set(:@docker_client_config, nil)
|
228
230
|
|
229
231
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
230
232
|
|
231
233
|
allow(machine).to receive_message_chain(:communicate, :test).with("[ -f /etc/docker/config.json ]").and_return(false)
|
232
234
|
|
233
|
-
docker_proxy.send(:
|
235
|
+
docker_proxy.send(:docker_client_config)
|
234
236
|
end
|
235
237
|
|
236
238
|
it do
|
237
|
-
expect(File.exists?(subject)).to eq true
|
239
|
+
expect(File.exists?(subject.path)).to eq true
|
238
240
|
expect(File.read(subject)).to eq "{}"
|
239
241
|
end
|
240
242
|
end
|
@@ -263,14 +265,14 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
263
265
|
|
264
266
|
end
|
265
267
|
|
266
|
-
context "when #
|
268
|
+
context "when #docker_client_config returns nil" do
|
267
269
|
it 'return nil' do
|
268
270
|
docker_proxy = described_class.new(app, env)
|
269
271
|
docker_proxy.instance_variable_set(:@machine, machine)
|
270
272
|
|
271
273
|
# mock a result that looks like no proxy is configured for the config.json
|
272
274
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
273
|
-
allow(docker_proxy).to receive(:
|
275
|
+
allow(docker_proxy).to receive(:docker_client_config).and_return(nil)
|
274
276
|
|
275
277
|
# #supported? mock
|
276
278
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
@@ -292,7 +294,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
292
294
|
fixture_content = load_fixture(fixture)
|
293
295
|
config_path = docker_proxy.send(:tempfile, fixture_content).path
|
294
296
|
|
295
|
-
docker_proxy.instance_variable_set(:@
|
297
|
+
docker_proxy.instance_variable_set(:@docker_client_config, config_path)
|
296
298
|
|
297
299
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
298
300
|
allow(docker_proxy).to receive(:disabled?).and_return(true)
|
@@ -331,7 +333,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
331
333
|
fixture_content = load_fixture(fixture)
|
332
334
|
config_path = docker_proxy.send(:tempfile, fixture_content).path
|
333
335
|
|
334
|
-
docker_proxy.instance_variable_set(:@
|
336
|
+
docker_proxy.instance_variable_set(:@docker_client_config, config_path)
|
335
337
|
|
336
338
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
337
339
|
allow(docker_proxy).to receive(:disabled?).and_return(false)
|
@@ -390,7 +392,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
390
392
|
|
391
393
|
fixture = fixture_file("docker_client_config_json_enabled_proxy")
|
392
394
|
config_path = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
393
|
-
docker_proxy.instance_variable_set(:@
|
395
|
+
docker_proxy.instance_variable_set(:@docker_client_config, config_path)
|
394
396
|
|
395
397
|
# to isolate this test, we turn of support for systemd
|
396
398
|
allow(docker_proxy).to receive(:supports_systemd?).and_return(false)
|
@@ -439,7 +441,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
439
441
|
|
440
442
|
fixture = fixture_file("docker_client_config_json_enabled_proxy")
|
441
443
|
config_path = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
442
|
-
docker_proxy.instance_variable_set(:@
|
444
|
+
docker_proxy.instance_variable_set(:@docker_client_config, config_path)
|
443
445
|
|
444
446
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
445
447
|
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_proxy_conf).and_return('/etc/default/docker')
|
@@ -4,6 +4,7 @@ require 'vagrant-proxyconf/action/configure_svn_proxy'
|
|
4
4
|
def mock_write_config(machine)
|
5
5
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf", error_check: false)
|
6
6
|
allow(machine).to receive_message_chain(:communicate, :upload)
|
7
|
+
allow(machine).to receive_message_chain(:communicate, :test).with('command -v sudo').and_return(true)
|
7
8
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /tmp/vagrant-proxyconf")
|
8
9
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:root /tmp/vagrant-proxyconf")
|
9
10
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/subversion")
|
data/test/issues/172/README.md
CHANGED
@@ -10,7 +10,7 @@ bundle exec vagrant up default
|
|
10
10
|
## Expect
|
11
11
|
|
12
12
|
|
13
|
-
### Box `default
|
13
|
+
### Box `default`
|
14
14
|
|
15
15
|
- The box `default` is a docker container that will be a reverse
|
16
16
|
proxy. It should provision itself and work without errors.
|
@@ -21,7 +21,7 @@ bundle exec vagrant up default
|
|
21
21
|
- **NOTE**: You'll need to use `docker exec <hash> -it bash` to get into the container
|
22
22
|
|
23
23
|
|
24
|
-
### Box `
|
24
|
+
### Box `docker_host`
|
25
25
|
|
26
26
|
- Vagrant should automatically instally docker-ce.
|
27
27
|
- The box should come up and provision itself with the proxy settings
|
@@ -10,9 +10,9 @@ end
|
|
10
10
|
describe file('/etc/docker/config.json') do
|
11
11
|
it { should be_file }
|
12
12
|
it { should exist }
|
13
|
-
it { should be_mode
|
13
|
+
it { should be_mode 644 }
|
14
14
|
it { should be_owned_by "root" }
|
15
|
-
it { should be_grouped_into "
|
15
|
+
it { should be_grouped_into "docker" }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'when proxy is enabled' do
|
@@ -10,9 +10,9 @@ end
|
|
10
10
|
describe file('/etc/docker/config.json') do
|
11
11
|
it { should be_file }
|
12
12
|
it { should exist }
|
13
|
-
it { should be_mode
|
13
|
+
it { should be_mode 644 }
|
14
14
|
it { should be_owned_by "root" }
|
15
|
-
it { should be_grouped_into "
|
15
|
+
it { should be_grouped_into "docker" }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'when proxy is enabled' do
|