Sandro Bonazzola has uploaded a new change for review.

Change subject: Added error handling on -H option
......................................................................

Added error handling on -H option

If an unknown host is specified using -H option, output an error
and exit with critical error code.

Change-Id: I4939cf66ba787c6970b7c457f2bdd605118a61c6
Bug-Url: https://bugzilla.redhat.com/918020
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/__main__.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector 
refs/changes/88/13788/1

diff --git a/src/__main__.py b/src/__main__.py
index 4010111..95177ef 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -897,6 +897,19 @@
                 (dc, cl, h) for dc, cl, h in self.conf['hosts']
                 if h in host_others
             ])
+            not_found = host_others - set(host[2] for host in host_filtered)
+            if not_found != set():
+                logging.error(
+                    _(
+                        'The following host are not listed as hypervisors: '
+                        '{not_listed}. Known hypervisors can be listed using '
+                        'the list command'
+                    ).format(
+                        not_listed=','.join(not_found)
+                    )
+                )
+                sys.exit(ExitCodes.CRITICAL)
+
         if host_patterns:
             for pattern in host_patterns:
                 host_filtered |= self._filter_hosts('host', pattern)


--
To view, visit http://gerrit.ovirt.org/13788
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4939cf66ba787c6970b7c457f2bdd605118a61c6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-log-collector
Gerrit-Branch: ovirt-log-collector-3.2
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to