Skip to content

Commit

Permalink
enhance cloud provider detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegory committed Jan 5, 2018
1 parent 6e961a3 commit b8e8243
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const (
func CloudProvider() (Provider, error) {
dataLen := 3
uuidFile, err := os.Open("/sys/hypervisor/uuid")
if err != nil {
uuidFile, err = os.Open("/sys/devices/virtual/dmi/id/product_uuid")
}
if err != nil {
// file does not exist, so we'll consider it's not a cloud deployment
return ProviderLocal, nil
Expand All @@ -40,7 +43,7 @@ func CloudProvider() (Provider, error) {
return ProviderLocal, nil
}
switch string(data) {
case "ec2":
case "ec2", "EC2":
return ProviderAWS, nil
default:
return ProviderUnknown, fmt.Errorf("found unexpected value in uuid file: %s", string(data))
Expand Down

0 comments on commit b8e8243

Please sign in to comment.