vagrant-ohai2 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dea985e2ede58fe7c113fe6a34d6edca8279c493
4
- data.tar.gz: df0404fd9b1a5b84a1781e883710beb48432a069
3
+ metadata.gz: fc5d75b7e1d544c8c335c948b517858d6cc22b4a
4
+ data.tar.gz: 9b4f0c3b779fdca3c7012fea95043c3a5a92ec24
5
5
  SHA512:
6
- metadata.gz: cc22f0bc06bc9f6be01f6bd92f2e93dc33c27c23826fe767ab030d75f7678566ee8ff13e07420e431f7039caeafede456e3c26f6f102f336a44ea581c86aa361
7
- data.tar.gz: 34c9bbd6be275cd8d93734bdbb64c79edde2e01ebe2329d2bf9968df4fdccbd76e1d46f9595e43e349d4c9a674e47d5eabd9274a0e5b23272c0dbf70768ccfe4
6
+ metadata.gz: b62ff9fcb55e9d1f9024165be29c1a44c3a9ae857064eb69865746dd9f8254ae4c798501f87767040ebae8213b3a14193533afc5c022500bec96add136c0c263
7
+ data.tar.gz: b671867178b94ce31f2faa90b23f8b3306a80fe74310d9e492e18f8a77cfc7d387646303299b1d40a125792c8517c8c2b4479b5c04c25e61d425d88e18473ecc
data/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # Vagrant::Ohai
1
+ # Vagrant::Ohai2
2
2
 
3
- This is a [vagrant](http://vagrantup.com) plugin which installs an Ohai plugin providing network information to Chef.
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-ohai).
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-ohai
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.ohai.enable = false` in your Vagrantfile.
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.ohai.primary_nic = "eth1"
17
+ config.ohai2.primary_nic = "eth1"
18
18
 
19
- To activate custom plugin support put `config.ohai.plugins_dir = <full_path_to_plugins_dir>` in your Vagrantfile
19
+ To activate custom plugin support put `config.ohai2.plugins_dir = <full_path_to_plugins_dir>` in your Vagrantfile
20
20
 
21
- config.ohai.plugins_dir = "/var/ohai/custom_plugins"
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
- # Ohai hint
42
+ # Ohai2 hint
43
43
  unless File.exist?('/etc/chef/ohai_plugins/vagrant.json')
44
- Ohai::Log.fail('Ohai has not set :ipaddress (Missing vagrant.json)')
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
- Ohai::Log.info("Neither nic nor private_ipv4 are set, skipping")
56
+ Ohai2::Log.info("Neither nic nor private_ipv4 are set, skipping")
57
57
  end
58
58
  if addr
59
- Ohai::Log.info("Ohai override :ipaddress to #{addr} from #{nic}")
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-ohai/helpers'
1
+ require 'vagrant-ohai2/helpers'
2
2
 
3
3
  module VagrantPlugins
4
- module Ohai
4
+ module Ohai2
5
5
  class ActionConfigureChef
6
- include VagrantPlugins::Ohai::Helpers
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 ohai_custom_config(current_conf)
20
+ def ohai2_custom_config(current_conf)
21
21
  tmp = Tempfile.new(["chef-custom-config", ".rb"])
22
- tmp.puts 'Ohai::config[:plugin_path] << "/etc/chef/ohai_plugins"'
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.ohai.enable or @machine.config.ohai.plugins_dir
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 = ohai_custom_config(current_custom_config_path)
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)
@@ -1,11 +1,11 @@
1
- require 'vagrant-ohai/helpers'
1
+ require 'vagrant-Ohai2/helpers'
2
2
 
3
3
  module VagrantPlugins
4
- module Ohai
4
+ module Ohai2
5
5
  class ActionInstallOhaiPlugin
6
- OHAI_PLUGIN_PATH = File.expand_path("../../ohai/vagrant.rb", __FILE__)
6
+ OHAI_PLUGIN_PATH = File.expand_path("../../Ohai2/vagrant.rb", __FILE__)
7
7
 
8
- include VagrantPlugins::Ohai::Helpers
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.ohai.enable
22
- @machine.ui.info("Installing Ohai plugin")
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.ohai.plugins_dir
27
- @machine.ui.info("Installing Custom Ohai plugin")
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.ohai.primary_nic
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-ohai", ".json"])
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.ohai.plugins_dir).select { |e| e =~ /^[a-z]+\.rb/ }
68
+ files = Dir.entries(@machine.config.ohai2.plugins_dir).select { |e| e =~ /^[a-z]+\.rb/ }
69
69
  files.each do |file|
70
- custom_ohai_plugin_path = File.expand_path("#{@machine.config.ohai.plugins_dir}/#{file}", __FILE__)
71
- @machine.communicate.upload(custom_ohai_plugin_path, "/etc/chef/ohai_plugins/#{file}")
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,5 +1,5 @@
1
1
  module VagrantPlugins
2
- module Ohai
2
+ module Ohai2
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
  attr_accessor :enable
5
5
  attr_accessor :primary_nic
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
- module Ohai
2
+ module Ohai2
3
3
  #
4
4
  module Helpers
5
5
  def chef_provisioners
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
- module Ohai
2
+ module Ohai2
3
3
  VERSION = "0.0.1"
4
4
  end
5
5
  end
@@ -1,25 +1,25 @@
1
- require "vagrant-ohai/version"
1
+ require "vagrant-ohai2/version"
2
2
  require "vagrant/plugin"
3
3
 
4
- raise RuntimeError, "vagrant-ohai will only work with Vagrant 1.2.3 and above!" if Vagrant::VERSION <= "1.2.3"
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 Ohai
7
+ module Ohai2
8
8
  class Plugin < Vagrant.plugin("2")
9
- name "vagrant-ohai"
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(:install_ohai_plugin, Plugin::ALL_ACTIONS) do |hook|
16
- require_relative 'action_install_ohai_plugin'
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(:ohai) do
22
+ config(:ohai2) do
23
23
  require_relative "config"
24
24
  Config
25
25
  end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Ohai2
3
+ VERSION = "0.1.15"
4
+ end
5
+ 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-ohai/version'
4
+ require 'vagrant-Ohai2/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "vagrant-ohai2"
8
- spec.version = VagrantPlugins::Ohai::VERSION
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 Ohai plugn to properly detect private ipaddress}
12
- spec.summary = %q{Vagrant plugin which installs an Ohai plugn to properly detect private ipaddress}
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.14
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 Ohai plugn to properly detect private
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/ohai/vagrant.rb
55
- - lib/vagrant-ohai.rb
56
- - lib/vagrant-ohai/action_configure_chef.rb
57
- - lib/vagrant-ohai/action_install_ohai_plugin.rb
58
- - lib/vagrant-ohai/config.rb
59
- - lib/vagrant-ohai/helpers.rb
60
- - lib/vagrant-ohai/ohai/version.rb
61
- - lib/vagrant-ohai/vagrant-ohai.rb
62
- - lib/vagrant-ohai/version.rb
63
- - vagrant-ohai.gemspec
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 Ohai plugn to properly detect private ipaddress
87
+ summary: Vagrant plugin which installs an Ohai2 plugn to properly detect private ipaddress
88
88
  test_files: []
@@ -1 +0,0 @@
1
- require 'vagrant-ohai/vagrant-ohai.rb'
@@ -1,5 +0,0 @@
1
- module VagrantPlugins
2
- module Ohai
3
- VERSION = "0.1.14"
4
- end
5
- end