From 2ade17e2f5b9ac48f3e4330617a64adbd04adca4 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 3 Apr 2015 04:50:44 -0400 Subject: [PATCH] v2 changed empty inventory to warning that only localhost is available --- v2/bin/ansible | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v2/bin/ansible b/v2/bin/ansible index 8eb5c97a6f..2b2df3df8f 100755 --- a/v2/bin/ansible +++ b/v2/bin/ansible @@ -29,6 +29,7 @@ from ansible.inventory import Inventory from ansible.parsing import DataLoader from ansible.parsing.splitter import parse_kv from ansible.playbook.play import Play +from ansible.utils.display import Display from ansible.utils.cli import base_parser, validate_conflicts, normalize_become_options, ask_passwords from ansible.utils.vault import read_vault_file from ansible.vars import VariableManager @@ -98,7 +99,8 @@ class Cli(object): hosts = inventory.list_hosts(pattern) if len(hosts) == 0: - raise AnsibleError("provided hosts list is empty") + d = Display() + d.warning("provided hosts list is empty, only localhost is available") if options.listhosts: for host in hosts: