From 99ff88b3ce4ae7130e335d574c8ecf91a7aaf115 Mon Sep 17 00:00:00 2001 From: Lazar Travica Date: Thu, 18 Feb 2016 11:46:40 +0100 Subject: [PATCH] Not outputting the global variables if no outputs are set. --- cli.go | 8 +++++--- fixtures/playbook.yml | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cli.go b/cli.go index f80529a..a8d7f85 100644 --- a/cli.go +++ b/cli.go @@ -22,9 +22,11 @@ func cmdList(stdout io.Writer, stderr io.Writer, s *state) int { } } - groups["all"] = make(map[string]string, 0) - for _, out := range s.outputs() { - groups["all"].(map[string]string)[out.keyName] = out.value + if(len(s.outputs()) > 0) { + groups["all"] = make(map[string]string, 0) + for _, out := range s.outputs() { + groups["all"].(map[string]string)[out.keyName] = out.value + } } return output(stdout, stderr, groups) diff --git a/fixtures/playbook.yml b/fixtures/playbook.yml index a4d802a..2cfbdec 100644 --- a/fixtures/playbook.yml +++ b/fixtures/playbook.yml @@ -1,5 +1,5 @@ - hosts: - - web-aws - - web-do + - alpha + - beta tasks: - command: "echo Hello, world!"