ohai 14.5.0 → 14.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/dsl/plugin.rb +3 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +11 -0
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/system.rb +9 -0
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43d635401a670d3a17696baedc004962bbabb702055df16763a8814f920fa3ce
|
4
|
+
data.tar.gz: 75d091cb7e4d9e8993224ed95b2dd19212293afb925e7b202325cacac2157105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532516c9be86772a63d5cdd33b6f6533e99a4861cead69cf67c5f3fa4695635731de6511e009b08f2930390908a3ed63ab249c5f42c3d7ff5b457a73537301b1
|
7
|
+
data.tar.gz: 05c0a5ea12747b483379734911f40c18cd17fb7cc22ef1484bf6d8ff97f90127631d543e5051bd9debbc4970696ee44a47ea486a226c8dea4a6457c8d10405c2
|
data/lib/ohai/dsl/plugin.rb
CHANGED
@@ -43,6 +43,7 @@ module Ohai
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# @param name [String]
|
46
47
|
def self.plugin(name, &block)
|
47
48
|
raise Ohai::Exceptions::InvalidPluginName, "#{name} is not a valid plugin name. A valid plugin name is a symbol which begins with a capital letter and contains no underscores" unless NamedPlugin.valid_name?(name)
|
48
49
|
|
@@ -61,6 +62,8 @@ module Ohai
|
|
61
62
|
end
|
62
63
|
|
63
64
|
# Cross platform /dev/null to support testability
|
65
|
+
#
|
66
|
+
# @return [String]
|
64
67
|
def self.dev_null
|
65
68
|
if RUBY_PLATFORM =~ /mswin|mingw|windows/
|
66
69
|
"NUL"
|
data/lib/ohai/hints.rb
CHANGED
@@ -26,7 +26,7 @@ module Ohai
|
|
26
26
|
@hints = {}
|
27
27
|
end
|
28
28
|
|
29
|
-
# parse the JSON
|
29
|
+
# parse the JSON contents of a hint file. Return an empty hash if the file has
|
30
30
|
# no JSON content
|
31
31
|
# @param filename [String] the hint file path
|
32
32
|
def self.parse_hint_file(filename)
|
data/lib/ohai/loader.rb
CHANGED
@@ -62,12 +62,18 @@ module Ohai
|
|
62
62
|
|
63
63
|
# Searches all plugin paths and returns an Array of PluginFile objects
|
64
64
|
# representing each plugin file.
|
65
|
+
#
|
66
|
+
# @param dir [Array, String] directory/directories to load plugins from
|
67
|
+
# @return [Array<Ohai::Loader::PluginFile>]
|
65
68
|
def plugin_files_by_dir(dir = Ohai.config[:plugin_path])
|
66
69
|
Array(dir).inject([]) do |plugin_files, plugin_path|
|
67
70
|
plugin_files + PluginFile.find_all_in(plugin_path)
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
74
|
+
# loads all plugin classes
|
75
|
+
#
|
76
|
+
# @return [Array<String>]
|
71
77
|
def load_all
|
72
78
|
plugin_files_by_dir.each do |plugin_file|
|
73
79
|
load_plugin_class(plugin_file.path, plugin_file.plugin_root)
|
@@ -76,6 +82,8 @@ module Ohai
|
|
76
82
|
collect_v7_plugins
|
77
83
|
end
|
78
84
|
|
85
|
+
# load additional plugins classes from a given directory
|
86
|
+
# @param from [String] path to a directory with additional plugins to load
|
79
87
|
def load_additional(from)
|
80
88
|
from = [ Ohai.config[:plugin_path], from].flatten
|
81
89
|
plugin_files_by_dir(from).collect do |plugin_file|
|
@@ -88,6 +96,9 @@ module Ohai
|
|
88
96
|
# Load a specified file as an ohai plugin and creates an instance of it.
|
89
97
|
# Not used by ohai itself, but can be used to load a plugin for testing
|
90
98
|
# purposes.
|
99
|
+
#
|
100
|
+
# @param plugin_path [String]
|
101
|
+
# @param plugin_dir_path [String]
|
91
102
|
def load_plugin(plugin_path, plugin_dir_path = nil)
|
92
103
|
plugin_class = load_plugin_class(plugin_path, plugin_dir_path)
|
93
104
|
return nil unless plugin_class.kind_of?(Class)
|
data/lib/ohai/log.rb
CHANGED
@@ -22,7 +22,7 @@ module Ohai
|
|
22
22
|
class Log
|
23
23
|
extend Mixlib::Log
|
24
24
|
|
25
|
-
# this class loading
|
25
|
+
# this class loading initialization is so that we don't lose early logger
|
26
26
|
# messages when run from the CLI?
|
27
27
|
init(STDERR)
|
28
28
|
level = :info # rubocop:disable Lint/UselessAssignment
|
data/lib/ohai/system.rb
CHANGED
@@ -29,6 +29,7 @@ require "ohai/provides_map"
|
|
29
29
|
require "ohai/hints"
|
30
30
|
require "mixlib/shellout"
|
31
31
|
require "ohai/config"
|
32
|
+
require "ffi_yajl"
|
32
33
|
|
33
34
|
module Ohai
|
34
35
|
class System
|
@@ -53,6 +54,10 @@ module Ohai
|
|
53
54
|
reset_system
|
54
55
|
end
|
55
56
|
|
57
|
+
# clears the current collected data, clears the provides map for plugins,
|
58
|
+
# refreshes hints, and reconfigures ohai. In short this gets Ohai into a first run state
|
59
|
+
#
|
60
|
+
# @return [void]
|
56
61
|
def reset_system
|
57
62
|
@data = Mash.new
|
58
63
|
@provides_map = ProvidesMap.new
|
@@ -73,6 +78,10 @@ module Ohai
|
|
73
78
|
@data[key]
|
74
79
|
end
|
75
80
|
|
81
|
+
# resets the system and loads then runs the plugins
|
82
|
+
#
|
83
|
+
# @param [Array<String>] attribute_filter
|
84
|
+
# @return [void]
|
76
85
|
def all_plugins(attribute_filter = nil)
|
77
86
|
# Reset the system when all_plugins is called since this function
|
78
87
|
# can be run multiple times in order to pick up any changes in the
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.5.
|
4
|
+
version: 14.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|