16306: Merge branch 'master'
[arvados.git] / lib / boot / supervisor.go
index 51f5c8bfd29f7533ca028c563fd1bd68840cd71f..20576b6b9739dfa70e875371c9b97fc21ae070b5 100644 (file)
@@ -470,9 +470,9 @@ func (super *Supervisor) lookPath(prog string) string {
        return prog
 }
 
-// Run prog with args, using dir as working directory. If ctx is
-// cancelled while the child is running, RunProgram terminates the
-// child, waits for it to exit, then returns.
+// RunProgram runs prog with args, using dir as working directory. If ctx is
+// cancelled while the child is running, RunProgram terminates the child, waits
+// for it to exit, then returns.
 //
 // Child's environment will have our env vars, plus any given in env.
 //
@@ -650,30 +650,30 @@ func (super *Supervisor) autofillConfig(cfg *arvados.Config) error {
                }
                if len(svc.InternalURLs) == 0 {
                        svc.InternalURLs = map[arvados.URL]arvados.ServiceInstance{
-                               arvados.URL{Scheme: "http", Host: fmt.Sprintf("%s:%s", super.ListenHost, nextPort(super.ListenHost)), Path: "/"}: arvados.ServiceInstance{},
+                               {Scheme: "http", Host: fmt.Sprintf("%s:%s", super.ListenHost, nextPort(super.ListenHost)), Path: "/"}: {},
                        }
                }
        }
-       if cluster.SystemRootToken == "" {
-               cluster.SystemRootToken = randomHexString(64)
-       }
-       if cluster.ManagementToken == "" {
-               cluster.ManagementToken = randomHexString(64)
-       }
-       if cluster.API.RailsSessionSecretToken == "" {
-               cluster.API.RailsSessionSecretToken = randomHexString(64)
-       }
-       if cluster.Collections.BlobSigningKey == "" {
-               cluster.Collections.BlobSigningKey = randomHexString(64)
-       }
-       if super.ClusterType != "production" && cluster.Containers.DispatchPrivateKey == "" {
-               buf, err := ioutil.ReadFile(filepath.Join(super.SourcePath, "lib", "dispatchcloud", "test", "sshkey_dispatch"))
-               if err != nil {
-                       return err
-               }
-               cluster.Containers.DispatchPrivateKey = string(buf)
-       }
        if super.ClusterType != "production" {
+               if cluster.SystemRootToken == "" {
+                       cluster.SystemRootToken = randomHexString(64)
+               }
+               if cluster.ManagementToken == "" {
+                       cluster.ManagementToken = randomHexString(64)
+               }
+               if cluster.API.RailsSessionSecretToken == "" {
+                       cluster.API.RailsSessionSecretToken = randomHexString(64)
+               }
+               if cluster.Collections.BlobSigningKey == "" {
+                       cluster.Collections.BlobSigningKey = randomHexString(64)
+               }
+               if cluster.Containers.DispatchPrivateKey == "" {
+                       buf, err := ioutil.ReadFile(filepath.Join(super.SourcePath, "lib", "dispatchcloud", "test", "sshkey_dispatch"))
+                       if err != nil {
+                               return err
+                       }
+                       cluster.Containers.DispatchPrivateKey = string(buf)
+               }
                cluster.TLS.Insecure = true
        }
        if super.ClusterType == "test" {