[ARVADOS] updated: 1.2.0-45-gd9ac7243e

Git user git at public.curoverse.com
Fri Aug 31 16:11:22 EDT 2018


Summary of changes:
 lib/dispatchcloud/azure.go | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

       via  d9ac7243e81ee55504bbcb96bb4edebd1dc10056 (commit)
      from  d557cd4a4847fe51f99cd0da91a46b73d8f5c5c8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d9ac7243e81ee55504bbcb96bb4edebd1dc10056
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Fri Aug 31 16:11:12 2018 -0400

    13964: Trim space
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/dispatchcloud/azure.go b/lib/dispatchcloud/azure.go
index 378e8bea3..28efe4f5c 100644
--- a/lib/dispatchcloud/azure.go
+++ b/lib/dispatchcloud/azure.go
@@ -608,35 +608,39 @@ func (ai *AzureInstance) VerifyPublicKey(ctx context.Context, receivedKey ssh.Pu
 		return err
 	}
 
-	nodetoken, err := sess.Output("cat /home/crunch/node-token")
+	nodetokenbytes, err := sess.Output("cat /home/crunch/node-token")
 	if err != nil {
 		return err
 	}
 
+	nodetoken := strings.TrimSpace(string(nodetokenbytes))
+
 	expectedToken := fmt.Sprintf("%s-%s", *ai.vm.Name, tags["node-token"])
-	log.Printf("%q %q", string(nodetoken), expectedToken)
+	log.Printf("%q %q", nodetoken, expectedToken)
 
-	if string(nodetoken) == expectedToken {
-		sess, err := client.NewSession()
-		if err != nil {
-			return err
-		}
+	if strings.TrimSpace(nodetoken) != expectedToken {
+		return fmt.Errorf("Node token did not match")
+	}
 
-		keyfingerprintbytes, err := sess.Output("ssh-keygen -E sha256 -l -f /etc/ssh/ssh_host_rsa_key.pub")
-		if err != nil {
-			return err
-		}
+	sess, err = client.NewSession()
+	if err != nil {
+		return err
+	}
+
+	keyfingerprintbytes, err := sess.Output("ssh-keygen -E sha256 -l -f /etc/ssh/ssh_host_rsa_key.pub")
+	if err != nil {
+		return err
+	}
 
-		sp := strings.Split(string(keyfingerprintbytes), " ")
+	sp := strings.Split(string(keyfingerprintbytes), " ")
 
-		log.Printf("%q %q", remoteFingerprint, sp[1])
+	log.Printf("%q %q", remoteFingerprint, sp[1])
 
-		if remoteFingerprint == sp[1] {
-			tags["ssh-pubkey-fingerprint"] = sp[1]
-			ai.SetTags(ctx, tags)
-			return nil
-		}
+	if remoteFingerprint != sp[1] {
+		return fmt.Errorf("Key fingerprint did not match")
 	}
 
-	return fmt.Errorf("Key fingerprint did not match")
+	tags["ssh-pubkey-fingerprint"] = sp[1]
+	ai.SetTags(ctx, tags)
+	return nil
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list