Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/lcitool | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/guests/lcitool b/guests/lcitool
index 3564eb8..1dd1ec8 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -237,6 +237,7 @@ class Application:
description = "libvirt CI guest management tool",
epilog = textwrap.dedent("""
supported actions:
+ list list all known hosts
"""),
)
self._parser.add_argument(
@@ -245,15 +246,25 @@ class Application:
required = True,
help = "action to perform (see below)",
)
+ self._parser.add_argument(
+ "-h",
+ metavar = "HOSTS",
+ help = "list of hosts to act on (glob patterns are supported)",
+ )
+
+ def _action_list(self, hosts):
+ for host in self._inventory.expand_pattern("all"):
+ print(host)
def run(self):
cmdline = self._parser.parse_args()
action = cmdline.a
+ hosts = cmdline.h
method = "_action_{}".format(action.replace("-",
"_"))
if hasattr(self, method):
- getattr(self, method).__call__()
+ getattr(self, method).__call__(hosts)
else:
raise Error("Invalid action '{}'".format(action))
--
2.17.1