vagrant-proxyconf 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
+ bundler_args: --without=development
2
3
  rvm:
3
4
  - 1.9.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
+ # 0.1.1 / 2013-06-27
2
+
3
+ - Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2])
4
+ * Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
5
+
1
6
  # 0.1.0 / 2013-06-27
2
7
 
3
8
  - Initial release
4
9
  - Support for Apt proxy configuration
5
10
  - Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
11
+
12
+
13
+ [GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
data/README.md CHANGED
@@ -27,7 +27,9 @@ vagrant plugin install vagrant-proxyconf
27
27
 
28
28
  ### Apt
29
29
 
30
- The proxy for Apt can be specified in the Vagrantfile:
30
+ The proxy for Apt can be specified in the Vagrantfile. You might want to set it to all boxes, in which case use _$HOME/.vagrant.d/Vagrantfile_. The configuration only triggers on Debian based machines, so there is no harm in setting it globally.
31
+
32
+ Example configuration:
31
33
  ```ruby
32
34
  Vagrant.configure("2") do |config|
33
35
 
@@ -39,11 +41,20 @@ end
39
41
 
40
42
  The proxy can be specified as an IP address, name or full URL, with optional port (defaults to 3142).
41
43
 
42
- You can also use `APT_PROXY_HTTP` and `APT_PROXY_HTTPS` environment variables. These override the Vagrantfile configuration. To disable or remove the proxy use "DIRECT" or an empty value.
44
+ You can also use `APT_PROXY_HTTP` and `APT_PROXY_HTTPS` environment variables. These override the Vagrantfile configuration. To disable or remove the proxy use "DIRECT" or an empty value. For example to spin up a VM while overriding a globally configured proxy, run:
45
+ ```sh
46
+ APT_PROXY_HTTP="10.5.5.200:8080" vagrant up
47
+ ```
43
48
 
44
49
  Proxy settings will be written to _/etc/apt/apt.conf.d/01proxy_ on the guest.
45
50
 
51
+ #### Running apt-cacher-ng on a Vagrant box
52
+
53
+ [Here](https://github.com/tmatilai/apt-cacher-box) is an example for setting up apt-cacher proxy server in a Vagrant VM.
54
+
46
55
  ## Related plugins and projects
47
56
 
48
- - [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier)
49
- - [vagrant-proxy](https://github.com/clintoncwolfe/vagrant-proxy)
57
+ - [apt-cacher-box](https://github.com/tmatilai/apt-cacher-box) (Vagrant setup for apt-cacher-ng)
58
+ - [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) (Vagrant plugin)
59
+ - [vagrant-httpproxy](https://github.com/juliandunn/vagrant-httpproxy) (Chef cookbook)
60
+ - [vagrant-proxy](https://github.com/clintoncwolfe/vagrant-proxy) (Vagrant plugin)
@@ -0,0 +1,2 @@
1
+ /.vagrant
2
+ /Vagrantfile
@@ -0,0 +1,17 @@
1
+ ## Testing the plugin
2
+
3
+ 1. Copy _Vagrantfile_ from the template:
4
+
5
+ cp Vagrantfile.example Vagrantfile
6
+
7
+ 2. Spin up the machine:
8
+
9
+ bundle exec vagrant up
10
+
11
+ 3. Test, hack, edit _Vagrantfile_ and test again:
12
+
13
+ VAGRANT_LOG=debug bundle exec vagrant reload
14
+ APT_PROXY_HTTP="foo:8080" bundle exec vagrant reload
15
+ # ...
16
+
17
+ 4. Goto 3.
@@ -0,0 +1,20 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ BOX = ENV.fetch('BOX', 'ubuntu-12.04')
5
+
6
+ Vagrant.require_plugin 'vagrant-proxyconf'
7
+
8
+ Vagrant.configure('2') do |config|
9
+ # Apt proxy
10
+ config.apt_proxy.http = '192.168.33.200'
11
+ config.apt_proxy.https = 'DIRECT'
12
+
13
+ # Disable the default share
14
+ config.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled: true
15
+
16
+ config.vm.box = BOX
17
+ if BOX == 'ubuntu-12.04'
18
+ ubuntu.vm.box_url = 'https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box'
19
+ end
20
+ end
@@ -1,3 +1,4 @@
1
+ require 'log4r'
1
2
  require 'tempfile'
2
3
 
3
4
  module VagrantPlugins
@@ -15,6 +16,12 @@ module VagrantPlugins
15
16
  @app.call env
16
17
 
17
18
  proxy_config = env[:machine].config.apt_proxy
19
+
20
+ # Vagrant does not seem to call `finalize!` if the configuration
21
+ # key is not used in Vagrantfiles.
22
+ # https://github.com/tmatilai/vagrant-proxyconf/issues/2
23
+ proxy_config.finalize!
24
+
18
25
  if !proxy_config.enabled?
19
26
  logger.debug "apt_proxy not enabled or configured"
20
27
  elsif !proxy_conf_capability?(env[:machine])
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ProxyConf
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -1,4 +1,2 @@
1
- require 'vagrant'
2
-
3
1
  require_relative 'vagrant-proxyconf/version'
4
2
  require_relative 'vagrant-proxyconf/plugin'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-proxyconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -26,6 +26,9 @@ files:
26
26
  - LICENSE.txt
27
27
  - README.md
28
28
  - Rakefile
29
+ - development/.gitignore
30
+ - development/README.md
31
+ - development/Vagrantfile.example
29
32
  - lib/vagrant-proxyconf.rb
30
33
  - lib/vagrant-proxyconf/action.rb
31
34
  - lib/vagrant-proxyconf/action/configure_apt_proxy.rb
@@ -52,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
55
  version: '0'
53
56
  segments:
54
57
  - 0
55
- hash: -4265757349911692365
58
+ hash: 4594869159718557476
56
59
  required_rubygems_version: !ruby/object:Gem::Requirement
57
60
  none: false
58
61
  requirements:
@@ -61,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
64
  version: '0'
62
65
  segments:
63
66
  - 0
64
- hash: -4265757349911692365
67
+ hash: 4594869159718557476
65
68
  requirements: []
66
69
  rubyforge_project:
67
70
  rubygems_version: 1.8.23