vagrant-ohai2 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/{ohai → ohai2}/vagrant.rb +4 -4
- data/lib/vagrant-ohai2.rb +1 -0
- data/lib/{vagrant-ohai → vagrant-ohai2}/action_configure_chef.rb +7 -7
- data/lib/{vagrant-ohai/action_install_ohai_plugin.rb → vagrant-ohai2/action_install_ohai2_plugin.rb} +13 -13
- data/lib/{vagrant-ohai → vagrant-ohai2}/config.rb +1 -1
- data/lib/{vagrant-ohai → vagrant-ohai2}/helpers.rb +1 -1
- data/lib/{vagrant-ohai/ohai → vagrant-ohai2/ohai2}/version.rb +1 -1
- data/lib/{vagrant-ohai/vagrant-ohai.rb → vagrant-ohai2/vagrant-ohai2.rb} +7 -7
- data/lib/vagrant-ohai2/version.rb +5 -0
- data/{vagrant-ohai.gemspec → vagrant-ohai2.gemspec} +4 -4
- metadata +13 -13
- data/lib/vagrant-ohai.rb +0 -1
- data/lib/vagrant-ohai/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc5d75b7e1d544c8c335c948b517858d6cc22b4a
|
4
|
+
data.tar.gz: 9b4f0c3b779fdca3c7012fea95043c3a5a92ec24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b62ff9fcb55e9d1f9024165be29c1a44c3a9ae857064eb69865746dd9f8254ae4c798501f87767040ebae8213b3a14193533afc5c022500bec96add136c0c263
|
7
|
+
data.tar.gz: b671867178b94ce31f2faa90b23f8b3306a80fe74310d9e492e18f8a77cfc7d387646303299b1d40a125792c8517c8c2b4479b5c04c25e61d425d88e18473ecc
|
data/README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
# Vagrant::
|
1
|
+
# Vagrant::Ohai2
|
2
2
|
|
3
|
-
This is a [vagrant](http://vagrantup.com) plugin which installs an
|
3
|
+
This is a [vagrant](http://vagrantup.com) plugin which installs an Ohai2 plugin providing network information to Chef.
|
4
4
|
In particular, the ipaddress is set to the private network defined in vagrant, if one is present.
|
5
5
|
|
6
|
-
This is a fork of [Avishai Ish-Shalom](https://github.com/avishai-ish-shalom/vagrant-
|
6
|
+
This is a fork of [Avishai Ish-Shalom](https://github.com/avishai-ish-shalom/vagrant-ohai2).
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
-
vagrant plugin install vagrant-
|
10
|
+
vagrant plugin install vagrant-ohai2
|
11
11
|
|
12
12
|
## Usage
|
13
13
|
|
14
|
-
The plugin will automatically activate when using the `:chef_solo`, `:chef_zero`, `:chef_apply`, `:chef_client` or `:shell` provisioners. If you want to disable it, put `config.
|
14
|
+
The plugin will automatically activate when using the `:chef_solo`, `:chef_zero`, `:chef_apply`, `:chef_client` or `:shell` provisioners. If you want to disable it, put `config.ohai2.enable = false` in your Vagrantfile.
|
15
15
|
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:
|
16
16
|
|
17
|
-
config.
|
17
|
+
config.ohai2.primary_nic = "eth1"
|
18
18
|
|
19
|
-
To activate custom plugin support put `config.
|
19
|
+
To activate custom plugin support put `config.ohai2.plugins_dir = <full_path_to_plugins_dir>` in your Vagrantfile
|
20
20
|
|
21
|
-
config.
|
21
|
+
config.ohai2.plugins_dir = "/var/ohai2/custom_plugins"
|
22
22
|
|
23
23
|
## Compatibility
|
24
24
|
|
@@ -39,9 +39,9 @@ Ohai.plugin(:VboxIpaddress) do
|
|
39
39
|
depends 'etc/passwd'
|
40
40
|
|
41
41
|
collect_data(:default) do
|
42
|
-
#
|
42
|
+
# Ohai2 hint
|
43
43
|
unless File.exist?('/etc/chef/ohai_plugins/vagrant.json')
|
44
|
-
|
44
|
+
Ohai2::Log.fail('Ohai2 has not set :ipaddress (Missing vagrant.json)')
|
45
45
|
else
|
46
46
|
vagrant = read_json('/etc/chef/ohai_plugins/vagrant.json')
|
47
47
|
|
@@ -53,10 +53,10 @@ Ohai.plugin(:VboxIpaddress) do
|
|
53
53
|
nic, addr = lookup_address_by_ipaddress(network, vagrant['private_ipv4'])
|
54
54
|
else
|
55
55
|
nic, addr = nil, nil
|
56
|
-
|
56
|
+
Ohai2::Log.info("Neither nic nor private_ipv4 are set, skipping")
|
57
57
|
end
|
58
58
|
if addr
|
59
|
-
|
59
|
+
Ohai2::Log.info("Ohai2 override :ipaddress to #{addr} from #{nic}")
|
60
60
|
ipaddress addr
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'vagrant-ohai2/vagrant-ohai2.rb'
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'vagrant-
|
1
|
+
require 'vagrant-ohai2/helpers'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
|
-
module
|
4
|
+
module Ohai2
|
5
5
|
class ActionConfigureChef
|
6
|
-
include VagrantPlugins::
|
6
|
+
include VagrantPlugins::Ohai2::Helpers
|
7
7
|
|
8
8
|
def initialize(app, env)
|
9
9
|
@app = app
|
@@ -17,23 +17,23 @@ module VagrantPlugins
|
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
|
-
def
|
20
|
+
def ohai2_custom_config(current_conf)
|
21
21
|
tmp = Tempfile.new(["chef-custom-config", ".rb"])
|
22
|
-
tmp.puts '
|
22
|
+
tmp.puts 'ohai.plugin_path << "/etc/chef/ohai_plugins"'
|
23
23
|
tmp.write(File.read(current_conf)) if current_conf
|
24
24
|
tmp.close
|
25
25
|
tmp
|
26
26
|
end
|
27
27
|
|
28
28
|
def register_custom_chef_config
|
29
|
-
return unless @machine.config.
|
29
|
+
return unless @machine.config.ohai2.enable or @machine.config.ohai2.plugins_dir
|
30
30
|
chef_provisioners.each do |provisioner|
|
31
31
|
if provisioner.config.respond_to? :custom_config_path and not provisioner.config.custom_config_path == Plugin::UNSET_VALUE
|
32
32
|
current_custom_config_path = provisioner.config.custom_config_path
|
33
33
|
else
|
34
34
|
current_custom_config_path = nil
|
35
35
|
end
|
36
|
-
custom_config =
|
36
|
+
custom_config = ohai2_custom_config(current_custom_config_path)
|
37
37
|
provisioner.config.instance_variable_set("@custom_config_path", custom_config.path)
|
38
38
|
# retain a reference to prevent tempfile from being auto cleaned up
|
39
39
|
provisioner.config.instance_variable_set("@__custom_config_tempfile__", custom_config)
|
data/lib/{vagrant-ohai/action_install_ohai_plugin.rb → vagrant-ohai2/action_install_ohai2_plugin.rb}
RENAMED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'vagrant-
|
1
|
+
require 'vagrant-Ohai2/helpers'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
|
-
module
|
4
|
+
module Ohai2
|
5
5
|
class ActionInstallOhaiPlugin
|
6
|
-
OHAI_PLUGIN_PATH = File.expand_path("../../
|
6
|
+
OHAI_PLUGIN_PATH = File.expand_path("../../Ohai2/vagrant.rb", __FILE__)
|
7
7
|
|
8
|
-
include VagrantPlugins::
|
8
|
+
include VagrantPlugins::Ohai2::Helpers
|
9
9
|
|
10
10
|
def initialize(app, env)
|
11
11
|
@app = app
|
@@ -18,13 +18,13 @@ module VagrantPlugins
|
|
18
18
|
@app.call(env)
|
19
19
|
return unless @machine.communicate.ready?
|
20
20
|
|
21
|
-
if is_chef_used && @machine.config.
|
22
|
-
@machine.ui.info("Installing
|
21
|
+
if is_chef_used && @machine.config.ohai2.enable
|
22
|
+
@machine.ui.info("Installing Ohai2 plugin")
|
23
23
|
create_ohai_folders
|
24
24
|
copy_ohai_plugin
|
25
25
|
end
|
26
|
-
if is_chef_used && @machine.config.
|
27
|
-
@machine.ui.info("Installing Custom
|
26
|
+
if is_chef_used && @machine.config.ohai2.plugins_dir
|
27
|
+
@machine.ui.info("Installing Custom Ohai2 plugin")
|
28
28
|
create_ohai_folders
|
29
29
|
copy_ohai_custom_plugins
|
30
30
|
end
|
@@ -48,14 +48,14 @@ module VagrantPlugins
|
|
48
48
|
def vagrant_info
|
49
49
|
info = {}
|
50
50
|
info[:box] = @machine.config.vm.box
|
51
|
-
info[:primary_nic] = @machine.config.
|
51
|
+
info[:primary_nic] = @machine.config.Ohai2.primary_nic
|
52
52
|
info[:private_ipv4] = private_ipv4
|
53
53
|
info
|
54
54
|
end
|
55
55
|
|
56
56
|
def copy_ohai_plugin
|
57
57
|
|
58
|
-
hint_file = Tempfile.new(["vagrant-
|
58
|
+
hint_file = Tempfile.new(["vagrant-Ohai2", ".json"])
|
59
59
|
hint_file.write(vagrant_info.to_json)
|
60
60
|
hint_file.close
|
61
61
|
@machine.communicate.upload(hint_file.path, "/etc/chef/ohai_plugins/vagrant.json")
|
@@ -65,10 +65,10 @@ module VagrantPlugins
|
|
65
65
|
|
66
66
|
def copy_ohai_custom_plugins
|
67
67
|
|
68
|
-
files = Dir.entries(@machine.config.
|
68
|
+
files = Dir.entries(@machine.config.ohai2.plugins_dir).select { |e| e =~ /^[a-z]+\.rb/ }
|
69
69
|
files.each do |file|
|
70
|
-
|
71
|
-
@machine.communicate.upload(
|
70
|
+
custom_ohai2_plugin_path = File.expand_path("#{@machine.config.ohai2.plugins_dir}/#{file}", __FILE__)
|
71
|
+
@machine.communicate.upload(custom_ohai2_plugin_path, "/etc/chef/ohai_plugins/#{file}")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -1,25 +1,25 @@
|
|
1
|
-
require "vagrant-
|
1
|
+
require "vagrant-ohai2/version"
|
2
2
|
require "vagrant/plugin"
|
3
3
|
|
4
|
-
raise RuntimeError, "vagrant-
|
4
|
+
raise RuntimeError, "vagrant-Ohai2 will only work with Vagrant 1.2.3 and above!" if Vagrant::VERSION <= "1.2.3"
|
5
5
|
|
6
6
|
module VagrantPlugins
|
7
|
-
module
|
7
|
+
module Ohai2
|
8
8
|
class Plugin < Vagrant.plugin("2")
|
9
|
-
name "vagrant-
|
9
|
+
name "vagrant-ohai2"
|
10
10
|
description <<-DESC
|
11
11
|
This plugin ensures ipaddress and cloud attributes in Chef
|
12
12
|
correspond to Vagrant's private network
|
13
13
|
DESC
|
14
14
|
|
15
|
-
action_hook(:
|
16
|
-
require_relative '
|
15
|
+
action_hook(:install_ohai2_plugin, Plugin::ALL_ACTIONS) do |hook|
|
16
|
+
require_relative 'action_install_ohai2_plugin'
|
17
17
|
require_relative 'action_configure_chef'
|
18
18
|
hook.after(Vagrant::Action::Builtin::Provision, ActionInstallOhaiPlugin)
|
19
19
|
hook.before(Vagrant::Action::Builtin::ConfigValidate, ActionConfigureChef)
|
20
20
|
end
|
21
21
|
|
22
|
-
config(:
|
22
|
+
config(:ohai2) do
|
23
23
|
require_relative "config"
|
24
24
|
Config
|
25
25
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'vagrant-
|
4
|
+
require 'vagrant-Ohai2/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "vagrant-ohai2"
|
8
|
-
spec.version = VagrantPlugins::
|
8
|
+
spec.version = VagrantPlugins::Ohai2::VERSION
|
9
9
|
spec.authors = ["Jeremy Miller"]
|
10
10
|
spec.email = ["jmiller3346@gmail.com"]
|
11
|
-
spec.description = %q{Vagrant plugin which installs an
|
12
|
-
spec.summary = %q{Vagrant plugin which installs an
|
11
|
+
spec.description = %q{Vagrant plugin which installs an Ohai2 plugn to properly detect private ipaddress}
|
12
|
+
spec.summary = %q{Vagrant plugin which installs an Ohai2 plugn to properly detect private ipaddress}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-ohai2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Miller
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: Vagrant plugin which installs an
|
41
|
+
description: Vagrant plugin which installs an Ohai2 plugn to properly detect private
|
42
42
|
ipaddress
|
43
43
|
email:
|
44
44
|
- jmiller3346@gmail.com
|
@@ -51,16 +51,16 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
-
- lib/
|
55
|
-
- lib/vagrant-
|
56
|
-
- lib/vagrant-
|
57
|
-
- lib/vagrant-
|
58
|
-
- lib/vagrant-
|
59
|
-
- lib/vagrant-
|
60
|
-
- lib/vagrant-
|
61
|
-
- lib/vagrant-
|
62
|
-
- lib/vagrant-
|
63
|
-
- vagrant-
|
54
|
+
- lib/ohai2/vagrant.rb
|
55
|
+
- lib/vagrant-ohai2.rb
|
56
|
+
- lib/vagrant-ohai2/action_configure_chef.rb
|
57
|
+
- lib/vagrant-ohai2/action_install_ohai2_plugin.rb
|
58
|
+
- lib/vagrant-ohai2/config.rb
|
59
|
+
- lib/vagrant-ohai2/helpers.rb
|
60
|
+
- lib/vagrant-ohai2/ohai2/version.rb
|
61
|
+
- lib/vagrant-ohai2/vagrant-ohai2.rb
|
62
|
+
- lib/vagrant-ohai2/version.rb
|
63
|
+
- vagrant-ohai2.gemspec
|
64
64
|
homepage: ''
|
65
65
|
licenses:
|
66
66
|
- MIT
|
@@ -84,5 +84,5 @@ rubyforge_project:
|
|
84
84
|
rubygems_version: 2.6.13
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
|
-
summary: Vagrant plugin which installs an
|
87
|
+
summary: Vagrant plugin which installs an Ohai2 plugn to properly detect private ipaddress
|
88
88
|
test_files: []
|
data/lib/vagrant-ohai.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'vagrant-ohai/vagrant-ohai.rb'
|