[ARVADOS] updated: 1.2.0-42-g70d3ebeed
Git user
git at public.curoverse.com
Fri Aug 31 14:47:48 EDT 2018
Summary of changes:
lib/dispatchcloud/azure.go | 12 +++++++++++-
lib/dispatchcloud/azure_test.go | 9 +++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
via 70d3ebeed39405ea3ae8a30deb861101be6d6baf (commit)
from 14c7bc075dcdb8d6594919417b4c1b085b89745b (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 70d3ebeed39405ea3ae8a30deb861101be6d6baf
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Fri Aug 31 14:47:28 2018 -0400
13964: Set and check node-token WIP
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 da2e3eb8f..c68a41809 100644
--- a/lib/dispatchcloud/azure.go
+++ b/lib/dispatchcloud/azure.go
@@ -6,6 +6,7 @@ package dispatchcloud
import (
"context"
+ "encoding/base64"
"fmt"
"log"
"net/http"
@@ -246,6 +247,10 @@ func (az *AzureProvider) Create(ctx context.Context,
newTags InstanceTags,
publicKey ssh.PublicKey) (Instance, error) {
+ if len(newTags["node-token"]) == 0 {
+ return nil, fmt.Errorf("Must provide tag 'node-token'")
+ }
+
name, err := randutil.String(15, "abcdefghijklmnopqrstuvwxyz0123456789")
if err != nil {
return nil, err
@@ -256,6 +261,8 @@ func (az *AzureProvider) Create(ctx context.Context,
timestamp := time.Now().Format(time.RFC3339Nano)
+ newTags["instance-type"] = instanceType.Name
+
tags := make(map[string]*string)
tags["created-at"] = ×tamp
for k, v := range newTags {
@@ -299,6 +306,9 @@ func (az *AzureProvider) Create(ctx context.Context,
log.Printf("URI instance vhd %v", instance_vhd)
+ customData := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(`#!/bin/sh
+echo '%s-%s' > /home/crunch/node-token`, name, newTags["node-token"])))
+
vmParameters := compute.VirtualMachine{
Location: &az.azconfig.Location,
Tags: tags,
@@ -343,7 +353,7 @@ func (az *AzureProvider) Create(ctx context.Context,
},
},
},
- //CustomData: to.StringPtr(""),
+ CustomData: &customData,
},
},
}
diff --git a/lib/dispatchcloud/azure_test.go b/lib/dispatchcloud/azure_test.go
index d5998aae6..2a8cc186c 100644
--- a/lib/dispatchcloud/azure_test.go
+++ b/lib/dispatchcloud/azure_test.go
@@ -22,6 +22,7 @@ import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
+ "github.com/jmcvetta/randutil"
"golang.org/x/crypto/ssh"
check "gopkg.in/check.v1"
)
@@ -120,9 +121,13 @@ func (*AzureProviderSuite) TestCreate(c *check.C) {
pk, _, _, _, err := ssh.ParseAuthorizedKey(keybytes)
c.Assert(err, check.IsNil)
+ nodetoken, err := randutil.String(40, "abcdefghijklmnopqrstuvwxyz0123456789")
+ c.Assert(err, check.IsNil)
+
inst, err := ap.Create(context.Background(),
cluster.InstanceTypes["tiny"],
- img, map[string]string{"tag1": "bleep"},
+ img, map[string]string{"instance-type": "tiny",
+ "node-token": nodetoken},
pk)
c.Assert(err, check.IsNil)
@@ -267,7 +272,7 @@ func (*AzureProviderSuite) TestSSH(c *check.C) {
sess, err := sshclient.NewSession()
c.Assert(err, check.IsNil)
- out, err := sess.Output("ls /")
+ out, err := sess.Output("cat /home/crunch/node-token")
c.Assert(err, check.IsNil)
log.Printf("%v", string(out))
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list