summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Batye <gbatye@gmail.com>2022-10-11 12:29:13 -0700
committerGitHub <noreply@github.com>2022-10-11 15:29:13 -0400
commitd3c47755850e576f3d37720a18b6e73ec0faafde (patch)
tree56f3bd926dca8d67d408db82a37dec8f43c082c6
parent3855db320bf14766e37eaeb1bb61ba87c2542ac8 (diff)
downloadohai-d3c47755850e576f3d37720a18b6e73ec0faafde.tar.gz
[ohai][ec2][looks_like_ec2] Do not depend on metadata endpoint (#1768)
Do not depend metadata endpoint For environments where full tunnel VPN is used, requiring a connection to the local metadata endpoint causes node['cloud'] = nil. At a minimum node['cloud']['provided'] attribute should be populated even if metadata can not be fetched. Signed-off-by: Greg Batye <gbatye@gmail.com>
-rw-r--r--lib/ohai/plugins/ec2.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb
index 5799d838..1a7c1690 100644
--- a/lib/ohai/plugins/ec2.rb
+++ b/lib/ohai/plugins/ec2.rb
@@ -28,10 +28,8 @@
Ohai.plugin(:EC2) do
require_relative "../mixin/ec2_metadata"
- require_relative "../mixin/http_helper"
include Ohai::Mixin::Ec2Metadata
- include Ohai::Mixin::HttpHelper
provides "ec2"
@@ -107,11 +105,7 @@ Ohai.plugin(:EC2) do
# @return [Boolean] Does the system appear to be on EC2
def looks_like_ec2?
return true if hint?("ec2")
-
- # Even if it looks like EC2 try to connect first
- if has_ec2_xen_uuid? || has_ec2_amazon_dmi? || has_ec2_xen_dmi? || has_ec2_identifying_number?
- return true if can_socket_connect?(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
- end
+ return true if has_ec2_xen_uuid? || has_ec2_amazon_dmi? || has_ec2_xen_dmi? || has_ec2_identifying_number?
end
collect_data do