Add a '-d' arg to the 'hosts' command to restrict the output to
only include hosts on which dockerfiles can be built
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
guests/lcitool | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/guests/lcitool b/guests/lcitool
index 35a6b68..374ba50 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -361,6 +361,11 @@ class Application:
formatter_class=argparse.RawDescriptionHelpFormatter)
hostsparser.set_defaults(func=self._action_hosts)
+ hostsparser.add_argument(
+ "-d", "--dockerfiles",
+ action="store_true",
+ help="Only list hosts supporting dockerfiles")
+
projectsparser = subparser.add_parser(
"projects", help="list all known projects",
formatter_class=argparse.RawDescriptionHelpFormatter)
@@ -435,6 +440,11 @@ class Application:
def _action_hosts(self, args):
for host in self._inventory.expand_pattern("all"):
+ if args.dockerfiles:
+ facts = self._inventory.get_facts(host)
+ package_format = facts["package_format"]
+ if package_format not in ["deb", "rpm"]:
+ continue
print(host)
def _action_projects(self, args):
--
2.20.1