vagrant-ohai 0.1.4 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODhlMGZhZjAwMGMxNjQ2OWI5ZGNlZmIwYWYzZTU3MzM3NWVlOGJjMw==
4
+ ZjdmMDhkNjEwYmU2Yzg5ODM5ZGEzYWI1Y2Y2NDM5ZWM3ZDkzNWEzOA==
5
5
  data.tar.gz: !binary |-
6
- ZGYwNDIxYTFiMGM3NDlkNzlhOWQ5NzE1YTk5MmZlZjY5ZTI0YThhMA==
6
+ MmUwNDIwN2EwNDQ5ZDJjZWVmYmI3MDdmNTE3OGU2YzEwYWVlOWNlYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NzZlYzdiMmZkODA3NTFiYTU5YjM0ODk4MDdlOGNiM2E4NDgyYWE5ZGEzNGJk
10
- ZDE2ZjM1YzcwMzc3NjdmOGQ0NmFiOTQ0YjFlZDg0MTAxMzkzMGY0ZTcwZWYy
11
- YjhjNThiNWZjOGFkMmZiNDg5ZTU5ZTkzODQyZWJhZWM5MjFmODQ=
9
+ NzYxZjU0ZGFlMjdiMGUxNGUzZTE3MGIxOGRiYWRkNDMxM2E1NjMzMzk1YmE4
10
+ ZWE1NTA1MGQ4NGFlY2UxNmE2NDQwZDNjOTcwZWI0YThhZDNlMTI4YTIzYzEx
11
+ ZDU3NmY3YTBmNTVkYzE5MDAyNmQ2OGJhOGYwNzg5NDNiYjUyNDU=
12
12
  data.tar.gz: !binary |-
13
- NTQ2ZjEzY2I1OTNjZjM5OTUzZTYyNmZjZWUzM2RiZTQ4ZWI2ZWZiMDI0YTk5
14
- ODBlY2Y2NTAzZDExNDBjZGRhYTFlYTVlODRlNGJjZDBjN2Y2NmU0Mzg3NzEy
15
- YjQxZGQwMTcwMGMxZTJjNWI0MDFkMThmN2ViMTA1NTAyYWFmNzE=
13
+ NDZjYTFkYTVlZDlmZDFhY2I0OTlkZTRkYTQ1OWM1YmMyZDgxYThjMWVjYmE1
14
+ OGZlYjg1NzVkZDEyYmM4OGQ2YjQxNGZiYjgxMDExOWJkMWYzZTAwM2I0YjA3
15
+ MTIyNzdmYzFiZjZjOGNmNzJlZjRkOWUzZmE1Mjc3M2M2YTU4NmI=
data/README.md CHANGED
@@ -11,6 +11,9 @@ In particular, the ipaddress is set to the private network defined in vagrant, i
11
11
  ## Usage
12
12
 
13
13
  The plugin will automatcially activate when using the `:chef_solo` or `:chef_client` provisioners. If you want to disable it, put `config.ohai.enable = false` in your Vagrantfile.
14
+ If you wish to use a primary nic which is not a private network, e.g. when using a bridge, set the `primary_nic` option:
15
+
16
+ config.ohai.primary_nic = "eth1"
14
17
 
15
18
  ## Compatability
16
19
 
data/lib/ohai/vagrant.rb CHANGED
@@ -3,13 +3,15 @@ hints = hint?("vagrant")
3
3
  provides "vagrant"
4
4
  provides "cloud"
5
5
 
6
- vagrant Mash.new
6
+ vagrant Mash.new
7
7
  cloud Mash.new
8
8
 
9
9
  if hints
10
10
  vagrant.merge!(hints)
11
11
  require_plugin "cloud"
12
- if vagrant.has_key? :private_ipv4
12
+ if vagrant[:primary_nic]
13
+ ipaddress network[:interfaces][vagrant[:primary_nic]][:addresses].find{|addr, addr_opts| addr_opts[:family] == "inet"}.first
14
+ elsif vagrant[:private_ipv4]
13
15
  cloud[:local_ipv4] = vagrant[:private_ipv4]
14
16
  ipaddress vagrant[:private_ipv4]
15
17
  end
@@ -44,6 +44,7 @@ module VagrantPlugins
44
44
  info = {}
45
45
  info[:private_ipv4] = private_ipv4 if private_ipv4
46
46
  info[:box] = @machine.config.vm.box
47
+ info[:primary_nic] = @machine.config.ohai.primary_nic
47
48
  info
48
49
  end
49
50
 
@@ -2,15 +2,26 @@ module VagrantPlugins
2
2
  module Ohai
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
  attr_accessor :enable
5
+ attr_accessor :primary_nic
5
6
 
6
7
  def initialize
7
8
  @enable = UNSET_VALUE
9
+ @primary_nic = UNSET_VALUE
8
10
  end
9
11
  def finalize!
10
12
  @enable = true if @enable == UNSET_VALUE
13
+ @primary_nic = nil if @primary_nic == UNSET_VALUE
11
14
  end
12
15
 
13
16
  def validate(machine)
17
+ case @primary_nic
18
+ when /eth[0-9]+/
19
+ {}
20
+ when nil
21
+ {}
22
+ else
23
+ {"primary_nic" => ["primary_nic must match eth[0-9]+"]}
24
+ end
14
25
  case @enable
15
26
  when TrueClass, FalseClass
16
27
  {}
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Ohai
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avishai Ish-Shalom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler