summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2016-02-05 10:11:18 -0800
committerTim Smith <tsmith84@gmail.com>2016-02-05 10:11:18 -0800
commit0135f2e2deca0fafb4289b7b7c7ef8bc0151e74c (patch)
tree9361202bc29fab78ff6ce9dbb2ad34bc5aaa63dc
parent67d7d03e2085e56decb1855d3a2d1ba0c76aa83d (diff)
downloadohai-0135f2e2deca0fafb4289b7b7c7ef8bc0151e74c.tar.gz
Improve debug logging and consistent access
-rw-r--r--lib/ohai/plugins/azure.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb
index 852a556a..852bcd94 100644
--- a/lib/ohai/plugins/azure.rb
+++ b/lib/ohai/plugins/azure.rb
@@ -24,14 +24,14 @@ Ohai.plugin(:Azure) do
# project for details
azure_metadata_from_hints = hint?('azure')
if azure_metadata_from_hints
- Ohai::Log.debug("azure_metadata_from_hints is present.")
+ Ohai::Log.debug("azure plugin: azure_metadata_from_hints is present.")
azure Mash.new
azure_metadata_from_hints.each {|k, v| azure[k] = v }
elsif looks_like_azure?
- Ohai::Log.debug("No hints present, but system appears to be on azure.")
+ Ohai::Log.debug("azure plugin: No hints present, but system appears to be on azure.")
azure Mash.new
else
- Ohai::Log.debug("No hints present for azure and doesn't appear to be azure.")
+ Ohai::Log.debug("azure plugin: No hints present for azure and doesn't appear to be azure.")
false
end
end
@@ -39,13 +39,13 @@ Ohai.plugin(:Azure) do
# check for either the waagent or the unknown-245 DHCP option that Azure uses
# http://blog.mszcool.com/index.php/2015/04/detecting-if-a-virtual-machine-runs-in-microsoft-azure-linux-windows-to-protect-your-software-when-distributed-via-the-azure-marketplace/
def looks_like_azure?
- if ::File.exist?('/usr/sbin/waagent') || ::Dir.exist?('C:\WindowsAzure')
- Ohai::Log.debug("Found waagent used by MS Azure.")
+ if File.exist?('/usr/sbin/waagent') || Dir.exist?('C:\WindowsAzure')
+ Ohai::Log.debug("azure plugin: Found waagent used by MS Azure.")
return true
elsif File.exist?('/var/lib/dhcp/dhclient.eth0.leases')
File.open("/var/lib/dhcp/dhclient.eth0.leases").each do |line|
if line =~ /unknown-245/
- Ohai::Log.debug("Found unknown-245 DHCP option used by MS Azure.")
+ Ohai::Log.debug("azure plugin: Found unknown-245 DHCP option used by MS Azure.")
return true
end
end