From 60aaa655c219acc5f14914b6ea6f3860dbb3d686 Mon Sep 17 00:00:00 2001
From: kayrus <kay.diam@gmail.com>
Date: Mon, 5 Aug 2019 12:49:52 +0200
Subject: [PATCH] Return 1 rc if the server was not found

Resolves #3
---
 main.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/main.go b/main.go
index a1d0b9c..204af0d 100644
--- a/main.go
+++ b/main.go
@@ -100,6 +100,8 @@ var RootCmd = &cobra.Command{
 			}
 		}
 
+		var errors []error
+
 		switch v := privateKey.(type) {
 		// Only RSA PKCS #1 v1.5 is supported by OpenStack
 		case *rsa.PrivateKey:
@@ -113,12 +115,17 @@ var RootCmd = &cobra.Command{
 				err = processServer(client, server, v)
 				if err != nil {
 					log.Printf("%s", err)
+					errors = append(errors, err)
 				}
 			}
 		default:
 			return fmt.Errorf("unsupported key type %T\nOnly RSA PKCS #1 v1.5 is supported by OpenStack", v)
 		}
 
+		if len(errors) > 0 {
+			return fmt.Errorf("%v", errors)
+		}
+
 		return nil
 	},
 }
-- 
GitLab