[PATCH 06/11] esx: Don't overwrite virAuthGet{Username|Password} errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the virAuthGet*Path API's generate all the error messages
we can remove them from the callers. This means that we will no
longer overwrite the error from the API.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/esx/esx_driver.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index ef258a2ce2..b1af646155 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -635,20 +635,14 @@ esxConnectToHost(esxPrivate *priv,
         if (VIR_STRDUP(username, conn->uri->user) < 0)
             goto cleanup;
     } else {
-        username = virAuthGetUsername(conn, auth, "esx", "root", conn->uri->server);
-
-        if (!username) {
-            virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
+        if (!(username = virAuthGetUsername(conn, auth, "esx", "root",
+                                            conn->uri->server)))
             goto cleanup;
-        }
     }
 
-    password = virAuthGetPassword(conn, auth, "esx", username, conn->uri->server);
-
-    if (!password) {
-        virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
+    if (!(password = virAuthGetPassword(conn, auth, "esx", username,
+                                        conn->uri->server)))
         goto cleanup;
-    }
 
     if (virAsprintf(&url, "%s://%s:%d/sdk", priv->parsedUri->transport,
                     conn->uri->server, conn->uri->port) < 0)
@@ -733,20 +727,13 @@ esxConnectToVCenter(esxPrivate *priv,
         if (VIR_STRDUP(username, conn->uri->user) < 0)
             goto cleanup;
     } else {
-        username = virAuthGetUsername(conn, auth, "esx", "administrator", hostname);
-
-        if (!username) {
-            virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
+        if (!(username = virAuthGetUsername(conn, auth, "esx", "administrator",
+                                            hostname)))
             goto cleanup;
-        }
     }
 
-    password = virAuthGetPassword(conn, auth, "esx", username, hostname);
-
-    if (!password) {
-        virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
+    if (!(password = virAuthGetPassword(conn, auth, "esx", username, hostname)))
         goto cleanup;
-    }
 
     if (virAsprintf(&url, "%s://%s:%d/sdk", priv->parsedUri->transport,
                     hostname, conn->uri->port) < 0)
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux