vagrant-proxyconf 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac37fdd26574b0bda6d18e20f6da96d3e0ef3fe4793dac9b89c850c65ff08f07
4
- data.tar.gz: 51b17d465cd2ccad3a0c8b59b7b81fc841462f071029352db6faf7cb65c700f5
3
+ metadata.gz: '09ccd0a2a51d1de18dc63c8355c6f6d4217faf1d31b470a0de6348c514a5c621'
4
+ data.tar.gz: 6384262695d6fffd759de258efb6c70ddd52a434fb1ead968ea0f0f8aa225ba3
5
5
  SHA512:
6
- metadata.gz: aeb84b8421bab091fb48ed298371e15c369ab4d2adbf69811d0458bcd9103a014444a1f82539bbc006197db8700d93c5f34adee479a9147f7db0d013d2cf4efd
7
- data.tar.gz: 6163910bf920cefb2edb163c09aa0575a322f167c3d3be5b1f9d3c292e54b455b454b5941a8bdc4552be8f577f79c21fd8770fe05b09b4130feebfa77bb72df2
6
+ metadata.gz: df0979eae22816e8a23ebddaf8e0874d0e6b5b8a9ae79e66499cb4bc418e47c300483dd1dc889e6324c7169636d4c4b2cffcfbc67c17e21170b3b178654211ce
7
+ data.tar.gz: ad5f86225dd89c3ce59c2fb50f72b10375e53f1b630de6e28ae53b3f4677507f26114ee991e467408b3c0cc612297cd87284400b2e7cdf50fdcc6007baf21658
@@ -1,15 +1,21 @@
1
+ ---
2
+
1
3
  language: ruby
2
4
  cache: bundler
3
5
  sudo: false
4
6
 
5
7
  before_install: ./travis/before_install
8
+ install: bundle install --path .bundle/gems
9
+ script: bundle exec rspec
6
10
  bundler_args: --without=development
7
11
 
8
12
  env:
9
13
  global:
10
14
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
11
15
 
12
- rvm: 2.4.4
16
+ rvm:
17
+ - 2.4.4
18
+
13
19
  matrix:
14
20
  include:
15
21
  - env: VAGRANT_VERSION=v2.2.4
@@ -1,4 +1,22 @@
1
- # 2.0.7 / NOT_RELEASED_YET
1
+ # 2.0.7 / 2019-11-14
2
+
3
+ This is a bug fix release.
4
+
5
+ - Addresses issues with docker proxy configuration and permissions.
6
+
7
+ #### Closed Issues
8
+
9
+ - https://github.com/tmatilai/vagrant-proxyconf/milestone/3
10
+
11
+
12
+ #### Credits
13
+
14
+ Thank you to these folks how identified the bugs and provided
15
+ workarounds.
16
+
17
+ - @antoinetran
18
+ - @tkang007
19
+
2
20
 
3
21
  # 2.0.6 / 2019-08-09
4
22
 
data/Gemfile CHANGED
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  gem 'vagrant',
21
21
  git: 'https://github.com/hashicorp/vagrant.git',
22
- ref: ENV.fetch('VAGRANT_VERSION', 'v2.2.4')
22
+ tag: ENV.fetch('VAGRANT_VERSION', 'v2.2.4')
23
23
 
24
24
  gem 'rake'
25
25
  gem 'rspec', '~> 3.1'
@@ -0,0 +1,60 @@
1
+ pipeline {
2
+
3
+ agent { label 'virtualbox' }
4
+
5
+ options {
6
+ disableConcurrentBuilds()
7
+ }
8
+
9
+ parameters {
10
+
11
+ string(
12
+ name: 'VAGRANT_TEST_ISSUE',
13
+ defaultValue: '180',
14
+ description: 'The test/issues/# where "#" refers to the test environment to invoke'
15
+ )
16
+
17
+ string(
18
+ name: 'DEFAULT_RVM_RUBY',
19
+ defaultValue: '2.4.4',
20
+ description: 'The default ruby to use for RVM'
21
+ )
22
+
23
+ }
24
+
25
+ stages {
26
+
27
+ stage('test') {
28
+
29
+ environment {
30
+ VAGRANT_TEST_ISSUE = "${params.VAGRANT_TEST_ISSUE}"
31
+ DEFAULT_RVM_RUBY = "${params.DEFAULT_RVM_RUBY}"
32
+ }
33
+
34
+ steps {
35
+ timestamps {
36
+ ansiColor('xterm') {
37
+
38
+ dir("${WORKSPACE}") {
39
+
40
+ sh '''#!/usr/bin/env bash -l
41
+
42
+ set +x
43
+ tty
44
+ . jenkins/helper_functions
45
+
46
+ setup_test_env
47
+
48
+ set -e
49
+ run_all_tests
50
+
51
+ '''
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ } // stages
59
+
60
+ }
@@ -0,0 +1,206 @@
1
+ #!/usr/bin/env bash
2
+
3
+ DEFAULT_RVM_RUBY="${DEFAULT_RVM_RUBY:-2.4.4}"
4
+
5
+ RVM_HOME_DIR="${RVM_HOME_DIR:-${HOME}/.rvm/scripts/rvm}"
6
+
7
+ VAGRANT_TEST_ISSUE="${VAGRANT_TEST_ISSUE:-180}"
8
+
9
+ err() {
10
+
11
+ echo "ERR: $* exiting" >&2
12
+
13
+ reset_docker_perms || true
14
+
15
+ exit 1
16
+
17
+ }
18
+
19
+
20
+ bundle_exec() {
21
+
22
+ local run_dir="test/issues/${VAGRANT_TEST_ISSUE}"
23
+
24
+ pushd "${run_dir}" || err "The directory: '${run_dir}' does not exist" && true
25
+
26
+ bundle exec $@
27
+
28
+ popd >>/dev/null 2>&1
29
+
30
+ }
31
+
32
+
33
+ enable_rvm_ruby() {
34
+
35
+ local ruby_version="${1:-${DEFAULT_RVM_RUBY}}"
36
+
37
+ shift
38
+ local persist="${1:-persist}"
39
+
40
+
41
+ [ -f "${RVM_HOME_DIR}" ] && . "${RVM_HOME_DIR}" >> /dev/null || true
42
+
43
+ rvm use "ruby-${ruby_version}" || err "Unable to switch to ruby ${ruby_version}"
44
+
45
+ [ -z "${persist}" ] || echo "${DEFAULT_RVM_RUBY}" > .ruby-version
46
+
47
+ }
48
+
49
+
50
+ enable_rbenv_ruby() {
51
+
52
+ local ruby_version="${1:-${DEFAULT_RVM_RUBY}}"
53
+
54
+ shift
55
+ local persist="${1:-persist}"
56
+
57
+ eval "$(rbenv init -)"
58
+
59
+ rbenv_install "${DEFAULT_RVM_RUBY}"
60
+
61
+ if [ -n "${persist}" ]; then
62
+
63
+ echo "${DEFAULT_RVM_RUBY}" > .ruby-version
64
+
65
+ rbenv shell "${DEFAULT_RVM_RUBY}"
66
+
67
+ fi
68
+
69
+ rbenv versions
70
+
71
+ }
72
+
73
+ rbenv_install() {
74
+
75
+ rbenv versions | grep -q "${1}" || rbenv install "${1}"
76
+
77
+ }
78
+
79
+ vagrant_cmd() {
80
+
81
+ bundle_exec vagrant $@
82
+
83
+ }
84
+
85
+
86
+ install_gems() {
87
+
88
+ command -v bundle >>/dev/null 2>&1 || gem install bundler --no-doc
89
+ command -v rake >>/dev/null 2>&1 || gem install rake --no-doc
90
+
91
+ gem update --system --no-doc || err "Updating system gems"
92
+
93
+ rm -f Gemfile.lock
94
+ bundle install --path .bundle/gems
95
+
96
+ }
97
+
98
+
99
+ install_from_gemfile() {
100
+
101
+ [ -d ".bundle/gems" ] || install_gems
102
+
103
+ }
104
+
105
+
106
+ run_all_tests() {
107
+
108
+ set -e
109
+
110
+ vagrant_cmd status
111
+ bundle_exec rake spec
112
+
113
+ set +e
114
+
115
+ }
116
+
117
+
118
+ setup_test_env() {
119
+
120
+ set -e
121
+
122
+ whoami
123
+ env
124
+
125
+ ruby -v
126
+ gem list
127
+
128
+ install_from_gemfile
129
+
130
+ bundle show
131
+
132
+ update_docker_perms
133
+
134
+ vagrant_cmd plugin repair || true
135
+ vagrant_cmd status
136
+ vagrant_cmd up || err "Starting the virtual machine"
137
+ vagrant_cmd provision || err "Attempting to provision the virtual machine"
138
+
139
+ reset_docker_perms
140
+
141
+ set +e
142
+
143
+ }
144
+
145
+
146
+ reset_docker_perms() {
147
+
148
+ [ -L /var/run/docker.sock ] && sudo chmod 0770 "$(readlink /var/run/docker.sock)" || true
149
+
150
+ }
151
+
152
+ update_docker_perms() {
153
+
154
+ [ -L /var/run/docker.sock ] && sudo chmod 6770 "$(readlink /var/run/docker.sock)" || true
155
+
156
+ }
157
+
158
+
159
+ is_container_running() {
160
+
161
+ CONTAINER_ID=$(docker ps -a | grep ':8888' | awk '{print $1}')
162
+
163
+ [ -z "${CONTAINER_ID}" ] && return 0
164
+
165
+ echo "${CONTAINER_ID}"
166
+ return 1
167
+
168
+ }
169
+
170
+
171
+ initialize() {
172
+ reset_docker_perms
173
+
174
+ OS_TYPE="$(uname -s 2>>/dev/null)"
175
+
176
+ case "${OS_TYPE}" in
177
+
178
+ Darwin)
179
+ HOME_DIR_PREFIX="/Users"
180
+ ;;
181
+
182
+ *)
183
+ HOME_DIR_PREFIX="/home"
184
+ ;;
185
+
186
+ esac
187
+
188
+ [ -f ${HOME_DIR_PREFIX}/jenkins/.bash_profile ] && . ${HOME_DIR_PREFIX}/jenkins/.bash_profile || true
189
+ [ -f ${HOME_DIR_PREFIX}/jenkins/.bashrc ] && . ${HOME_DIR_PREFIX}/jenkins/.bashrc || true
190
+
191
+ command -v rvm >>/dev/null 2>&1 && enable_rvm_ruby "${DEFAULT_RVM_RUBY}" "persist" || true
192
+ command -v rbenv >>/dev/null 2>&1 && enable_rbenv_ruby "${DEFAULT_RVM_RUBY}" "persist" || true
193
+
194
+ command -v docker || err "Docker must be installed on this host."
195
+ command -v bsdtar || err "Please install bsdtar"
196
+
197
+ id
198
+ groups
199
+
200
+ CONTAINER_ID=$(is_container_running)
201
+ [ $? -ne 0 ] && docker rm -vf "${CONTAINER_ID}"
202
+
203
+ reset_docker_perms
204
+ }
205
+
206
+ initialize
@@ -97,9 +97,9 @@ module VagrantPlugins
97
97
  @machine.communicate.tap do |comm|
98
98
  comm.upload(@docker_client_config_path.path, "/tmp/vagrant-proxyconf-docker-config.json")
99
99
  comm.sudo("mkdir -p /etc/docker")
100
- comm.sudo("chown root:root /etc/docker")
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:root /etc/docker/config.json")
102
+ comm.sudo("chown root:docker /etc/docker/config.json")
103
103
  comm.sudo("chmod 0644 /etc/docker/config.json")
104
104
  comm.sudo("rm -f /tmp/vagrant-proxyconf-docker-config.json")
105
105
 
@@ -155,6 +155,7 @@ module VagrantPlugins
155
155
  end
156
156
 
157
157
  comm.sudo('chown -R 0:0 /etc/systemd/system/docker.service.d/')
158
+ comm.sudo('touch /etc/systemd/system/docker.service.d/http-proxy.conf')
158
159
  comm.sudo('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
159
160
 
160
161
  if changed
@@ -236,7 +237,7 @@ module VagrantPlugins
236
237
 
237
238
  # update config and restart docker when config changed
238
239
  comm.sudo("chmod 0644 #{path}.new")
239
- comm.sudo("chown root:root #{path}.new")
240
+ comm.sudo("chown root:docker #{path}.new")
240
241
  comm.sudo("mv -f #{path}.new #{path}")
241
242
  comm.sudo(service_restart_command)
242
243
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ProxyConf
3
- VERSION = '2.0.6'
3
+ VERSION = '2.0.7'
4
4
  end
5
5
  end
@@ -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:root /etc/default/docker.new")
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,13 +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:root /etc/docker/config.json")
22
+ allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker/config.json")
23
23
  allow(machine).to receive_message_chain(:communicate, :sudo).with("chmod 0644 /etc/docker/config.json")
24
24
  allow(machine).to receive_message_chain(:communicate, :sudo).with("rm -f /tmp/vagrant-proxyconf-docker-config.json")
25
25
  allow(machine).to receive_message_chain(:communicate, :sudo).with("sed -i.bak -e '/^DOCKER_CONFIG/d' /etc/environment")
26
26
  allow(machine).to receive_message_chain(:communicate, :sudo).with("echo DOCKER_CONFIG=/etc/docker >> /etc/environment")
27
27
  allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/docker")
28
- allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:root /etc/docker")
28
+ allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:docker /etc/docker")
29
29
  end
30
30
 
31
31
  def mock_update_docker_systemd_config(machine)
@@ -164,6 +164,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
164
164
  allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/systemd/system/docker.service.d")
165
165
  allow(machine).to receive_message_chain(:communicate, :upload).with(@docker_proxy.instance_variable_get(:@docker_systemd_config), "/tmp")
166
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')
167
168
  allow(machine).to receive_message_chain(:communicate, :sudo).with('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
168
169
  allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(false)
169
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)
@@ -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 600 }
13
+ it { should be_mode 644 }
14
14
  it { should be_owned_by "root" }
15
- it { should be_grouped_into "root" }
15
+ it { should be_grouped_into "docker" }
16
16
  end
17
17
 
18
18
  context 'when proxy is enabled' do
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: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teemu Matilainen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-09 00:00:00.000000000 Z
11
+ date: 2019-11-14 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:
@@ -23,6 +23,7 @@ files:
23
23
  - CHANGELOG.md
24
24
  - Gemfile
25
25
  - Guardfile
26
+ - Jenkinsfile
26
27
  - LICENSE.txt
27
28
  - README.md
28
29
  - Rakefile
@@ -33,6 +34,7 @@ files:
33
34
  - development/install-c7.sh
34
35
  - development/install-debian.sh
35
36
  - development/tinyproxy.conf
37
+ - jenkins/helper_functions
36
38
  - lib/vagrant-proxyconf.rb
37
39
  - lib/vagrant-proxyconf/action.rb
38
40
  - lib/vagrant-proxyconf/action/base.rb
@@ -200,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
202
  - !ruby/object:Gem::Version
201
203
  version: '0'
202
204
  requirements: []
203
- rubygems_version: 3.0.4
205
+ rubygems_version: 3.0.6
204
206
  signing_key:
205
207
  specification_version: 4
206
208
  summary: A Vagrant plugin that configures the virtual machine to use proxy servers