summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-08-16 10:09:37 -0700
committerTim Smith <tsmith@chef.io>2017-08-16 10:14:29 -0700
commit7a1a1e2d4e17da14eb9e0bc674f839cd83570d13 (patch)
tree4eeff9bd95e5534929808292f0ba51bce56aa467
parent74ae9b00ba4698a4097759506b3f844ee7f94e2d (diff)
downloadohai-7a1a1e2d4e17da14eb9e0bc674f839cd83570d13.tar.gz
Move all requires into the plugin definitions
Avoid requiring all these things if we're skipping these plugins Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/digital_ocean.rb6
-rw-r--r--lib/ohai/plugins/dragonflybsd/os.rb3
-rw-r--r--lib/ohai/plugins/ec2.rb8
-rw-r--r--lib/ohai/plugins/eucalyptus.rb8
-rw-r--r--lib/ohai/plugins/freebsd/os.rb3
-rw-r--r--lib/ohai/plugins/gce.rb6
-rw-r--r--lib/ohai/plugins/hostname.rb6
-rw-r--r--lib/ohai/plugins/linux/systemd_paths.rb7
-rw-r--r--lib/ohai/plugins/linux/virtualization.rb3
-rw-r--r--lib/ohai/plugins/network.rb5
-rw-r--r--lib/ohai/plugins/openstack.rb5
-rw-r--r--lib/ohai/plugins/os.rb3
-rw-r--r--lib/ohai/plugins/passwd.rb3
-rw-r--r--lib/ohai/plugins/rackspace.rb3
-rw-r--r--lib/ohai/plugins/shard.rb3
-rw-r--r--lib/ohai/plugins/softlayer.rb3
-rw-r--r--lib/ohai/plugins/solaris2/virtualization.rb3
-rw-r--r--lib/ohai/plugins/uptime.rb3
18 files changed, 34 insertions, 47 deletions
diff --git a/lib/ohai/plugins/digital_ocean.rb b/lib/ohai/plugins/digital_ocean.rb
index c1b3f891..35a81ca3 100644
--- a/lib/ohai/plugins/digital_ocean.rb
+++ b/lib/ohai/plugins/digital_ocean.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "ohai/mixin/do_metadata"
-require "ohai/mixin/http_helper"
-
Ohai.plugin(:DigitalOcean) do
+ require "ohai/mixin/do_metadata"
+ require "ohai/mixin/http_helper"
+
include Ohai::Mixin::DOMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/dragonflybsd/os.rb b/lib/ohai/plugins/dragonflybsd/os.rb
index 836ee25f..5fb896ea 100644
--- a/lib/ohai/plugins/dragonflybsd/os.rb
+++ b/lib/ohai/plugins/dragonflybsd/os.rb
@@ -18,9 +18,8 @@
# limitations under the License.
#
-require "ohai/mixin/os"
-
Ohai.plugin(:OS) do
+ require "ohai/mixin/os"
provides "os", "os_version"
collect_data(:dragonflybsd) do
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb
index f0e0f5eb..3c085920 100644
--- a/lib/ohai/plugins/ec2.rb
+++ b/lib/ohai/plugins/ec2.rb
@@ -24,11 +24,11 @@
# 3. DMI data mentions amazon. This catches HVM instances in a VPC
# 4. Kernel data mentioned Amazon. This catches Windows HVM & paravirt instances
-require "ohai/mixin/ec2_metadata"
-require "ohai/mixin/http_helper"
-require "base64"
-
Ohai.plugin(:EC2) do
+ require "ohai/mixin/ec2_metadata"
+ require "ohai/mixin/http_helper"
+ require "base64"
+
include Ohai::Mixin::Ec2Metadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/eucalyptus.rb b/lib/ohai/plugins/eucalyptus.rb
index 0481fe29..8c5b4c21 100644
--- a/lib/ohai/plugins/eucalyptus.rb
+++ b/lib/ohai/plugins/eucalyptus.rb
@@ -17,11 +17,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# eucalyptus metadata service is compatible with the ec2 service calls
-require "ohai/mixin/ec2_metadata"
-require "ohai/mixin/http_helper"
-
Ohai.plugin(:Eucalyptus) do
+ # eucalyptus metadata service is compatible with the ec2 service calls
+ require "ohai/mixin/ec2_metadata"
+ require "ohai/mixin/http_helper"
+
include Ohai::Mixin::Ec2Metadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/freebsd/os.rb b/lib/ohai/plugins/freebsd/os.rb
index ee1c9d0b..d679eaa9 100644
--- a/lib/ohai/plugins/freebsd/os.rb
+++ b/lib/ohai/plugins/freebsd/os.rb
@@ -18,10 +18,9 @@
# limitations under the License.
#
-require "ohai/mixin/os"
-
Ohai.plugin(:OS) do
provides "os", "os_version"
+ require "ohai/mixin/os"
collect_data(:freebsd) do
os collect_os
diff --git a/lib/ohai/plugins/gce.rb b/lib/ohai/plugins/gce.rb
index f8fdb3a5..e808ba0c 100644
--- a/lib/ohai/plugins/gce.rb
+++ b/lib/ohai/plugins/gce.rb
@@ -14,10 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "ohai/mixin/gce_metadata"
-require "ohai/mixin/http_helper"
-
Ohai.plugin(:GCE) do
+ require "ohai/mixin/gce_metadata"
+ require "ohai/mixin/http_helper"
+
include Ohai::Mixin::GCEMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/hostname.rb b/lib/ohai/plugins/hostname.rb
index 0c08c9b1..c7859415 100644
--- a/lib/ohai/plugins/hostname.rb
+++ b/lib/ohai/plugins/hostname.rb
@@ -25,10 +25,10 @@
# limitations under the License.
#
-require "socket"
-require "ipaddr"
-
Ohai.plugin(:Hostname) do
+ require "socket"
+ require "ipaddr"
+
provides "domain", "hostname", "fqdn", "machinename"
# hostname : short hostname
diff --git a/lib/ohai/plugins/linux/systemd_paths.rb b/lib/ohai/plugins/linux/systemd_paths.rb
index 320b984a..50f2d1b7 100644
--- a/lib/ohai/plugins/linux/systemd_paths.rb
+++ b/lib/ohai/plugins/linux/systemd_paths.rb
@@ -16,13 +16,12 @@
# limitations under the License.
#
-require "ohai/util/file_helper"
-
-include Ohai::Util::FileHelper
-
Ohai.plugin(:SystemdPaths) do
provides "systemd_paths"
+ require "ohai/util/file_helper"
+ include Ohai::Util::FileHelper
+
collect_data(:linux) do
systemd_path_path = which("systemd-path")
if systemd_path_path
diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb
index fa54057d..9a484680 100644
--- a/lib/ohai/plugins/linux/virtualization.rb
+++ b/lib/ohai/plugins/linux/virtualization.rb
@@ -16,9 +16,8 @@
# limitations under the License.
#
-require "ohai/mixin/dmi_decode"
-
Ohai.plugin(:Virtualization) do
+ require "ohai/mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
provides "virtualization"
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index 91547d19..f232ecae 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -16,10 +16,9 @@
# limitations under the License.
#
-require "ipaddress"
-require "ohai/mixin/network_constants"
-
Ohai.plugin(:NetworkAddresses) do
+ require "ipaddress"
+ require "ohai/mixin/network_constants"
include Ohai::Mixin::NetworkConstants
provides "ipaddress", "ip6address", "macaddress"
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb
index c8e6e91b..7d1c528c 100644
--- a/lib/ohai/plugins/openstack.rb
+++ b/lib/ohai/plugins/openstack.rb
@@ -16,10 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "ohai/mixin/ec2_metadata"
-require "ohai/mixin/http_helper"
-
Ohai.plugin(:Openstack) do
+ require "ohai/mixin/ec2_metadata"
+ require "ohai/mixin/http_helper"
include Ohai::Mixin::Ec2Metadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb
index 2016ff68..ff09eec3 100644
--- a/lib/ohai/plugins/os.rb
+++ b/lib/ohai/plugins/os.rb
@@ -16,9 +16,8 @@
# limitations under the License.
#
-require "ohai/mixin/os"
-
Ohai.plugin(:OS) do
+ require "ohai/mixin/os"
provides "os", "os_version"
depends "kernel"
diff --git a/lib/ohai/plugins/passwd.rb b/lib/ohai/plugins/passwd.rb
index 0775efe3..2539fa26 100644
--- a/lib/ohai/plugins/passwd.rb
+++ b/lib/ohai/plugins/passwd.rb
@@ -1,7 +1,6 @@
-require "etc"
-
Ohai.plugin(:Passwd) do
+ require "etc"
provides "etc", "current_user"
def fix_encoding(str)
diff --git a/lib/ohai/plugins/rackspace.rb b/lib/ohai/plugins/rackspace.rb
index aa6a511b..0648a934 100644
--- a/lib/ohai/plugins/rackspace.rb
+++ b/lib/ohai/plugins/rackspace.rb
@@ -14,9 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "resolv"
-
Ohai.plugin(:Rackspace) do
+ require "resolv"
provides "rackspace"
depends "kernel", "network/interfaces"
diff --git a/lib/ohai/plugins/shard.rb b/lib/ohai/plugins/shard.rb
index 7cc14148..e8e55717 100644
--- a/lib/ohai/plugins/shard.rb
+++ b/lib/ohai/plugins/shard.rb
@@ -16,9 +16,8 @@
# limitations under the License.
#
-require "digest/md5"
-
Ohai.plugin(:ShardSeed) do
+ require "digest/md5"
depends "hostname", "dmi", "machine_id", "machinename"
provides "shard_seed"
diff --git a/lib/ohai/plugins/softlayer.rb b/lib/ohai/plugins/softlayer.rb
index 2165a822..24ab0d6d 100644
--- a/lib/ohai/plugins/softlayer.rb
+++ b/lib/ohai/plugins/softlayer.rb
@@ -18,9 +18,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "ohai/mixin/softlayer_metadata"
-
Ohai.plugin(:Softlayer) do
+ require "ohai/mixin/softlayer_metadata"
include ::Ohai::Mixin::SoftlayerMetadata
provides "softlayer"
diff --git a/lib/ohai/plugins/solaris2/virtualization.rb b/lib/ohai/plugins/solaris2/virtualization.rb
index c43dd3f2..3c15a1ef 100644
--- a/lib/ohai/plugins/solaris2/virtualization.rb
+++ b/lib/ohai/plugins/solaris2/virtualization.rb
@@ -18,9 +18,8 @@
# limitations under the License.
#
-require "ohai/mixin/dmi_decode"
-
Ohai.plugin(:Virtualization) do
+ require "ohai/mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
provides "virtualization"
diff --git a/lib/ohai/plugins/uptime.rb b/lib/ohai/plugins/uptime.rb
index 01cbab8b..fce9eb0e 100644
--- a/lib/ohai/plugins/uptime.rb
+++ b/lib/ohai/plugins/uptime.rb
@@ -24,9 +24,8 @@
# limitations under the License.
#
-require "ohai/mixin/seconds_to_human"
-
Ohai.plugin(:Uptime) do
+ require "ohai/mixin/seconds_to_human"
provides "uptime", "uptime_seconds"
provides "idletime", "idletime_seconds" # linux only
depends "platform_version"