From b762ebaa5ef755dc0df7e7bee97cc5bd29b17a5c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 18 Sep 2018 00:32:18 +0200 Subject: UpdateTool CLI show total/fail/success updates Signed-off-by: Toni Uhlig --- src/UpdateTool.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/UpdateTool.cpp b/src/UpdateTool.cpp index 1f4d2af..1f5ccda 100644 --- a/src/UpdateTool.cpp +++ b/src/UpdateTool.cpp @@ -28,6 +28,7 @@ int main(int argc, char* argv[]) /* Command Line Interface (CLI) for UNIX/WIN */ int main(int argc, char *argv[]) { + size_t totalUpdates = 0, successUpdates = 0; int rv; std::vector uf; std::string errstr, hostPorts; @@ -56,6 +57,10 @@ int main(int argc, char *argv[]) } for (auto *u : uf) { + totalUpdates++; + std::cerr << "Connecting to '" << u->getHostname() << ":" + << u->getPort() << "' with password '" + << u->getPassword() << "'" << std::endl; rv = u->doAuth(); mapEmcError(rv, errstr); if (rv == UPDATE_OK) { @@ -71,6 +76,7 @@ int main(int argc, char *argv[]) std::cerr << "uploading file " << u->getUpdateFile() << std::endl; rv = u->doUpdate(); if (rv == UPDATE_OK) { + successUpdates++; std::cerr << "Update succeeded!" << std::endl; } else { mapEmcError(rv, errstr); @@ -86,6 +92,13 @@ int main(int argc, char *argv[]) for (auto *u : uf) { delete u; } + + std::cout << "-----------------------" << std::endl + << "updates: " << totalUpdates << std::endl + << "success: " << successUpdates << std::endl + << "failed.: " << (totalUpdates - successUpdates) << std::endl + << std::endl; + return 0; } -- cgit v1.2.3