From 267afdd15dfb6d5a12fed988b3727cb7404280da Mon Sep 17 00:00:00 2001 From: Rompei Date: Sat, 16 Jul 2016 15:53:57 +0900 Subject: [PATCH] Fix platform detection. --- scan/base.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scan/base.go b/scan/base.go index de7cdbb0..5730fb69 100644 --- a/scan/base.go +++ b/scan/base.go @@ -163,7 +163,8 @@ func (l *base) detectPlatform() error { func (l base) detectRunningOnAws() (ok bool, instanceID string, err error) { if r := l.ssh("type curl", noSudo); r.isSuccess() { cmd := "curl --max-time 1 --retry 3 --noproxy 169.254.169.254 http://169.254.169.254/latest/meta-data/instance-id" - if r := l.ssh(cmd, noSudo); r.isSuccess() { + r := l.ssh(cmd, noSudo) + if r.isSuccess() { id := strings.TrimSpace(r.Stdout) if id == "not found" { @@ -184,7 +185,8 @@ func (l base) detectRunningOnAws() (ok bool, instanceID string, err error) { if r := l.ssh("type wget", noSudo); r.isSuccess() { cmd := "wget --tries=3 --timeout=1 --no-proxy -q -O - http://169.254.169.254/latest/meta-data/instance-id" - if r := l.ssh(cmd, noSudo); r.isSuccess() { + r := l.ssh(cmd, noSudo) + if r.isSuccess() { id := strings.TrimSpace(r.Stdout) return true, id, nil }