Generate UUID with a new configuration file 29/185329/3
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Fri, 27 Jul 2018 15:32:17 +0000 (17:32 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 1 Aug 2018 16:05:35 +0000 (18:05 +0200)
It is a quality of life change. Generated config requires minimal
modifications (boruta address) to work.

Change-Id: I713886ca8595ba528247087fb49587ef0f27b72a
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
cmd/dryad/dryad.go

index b7d637f..7ebe7df 100644 (file)
@@ -29,6 +29,7 @@ import (
        dryad_rpc "git.tizen.org/tools/boruta/rpc/dryad"
        superviser_rpc "git.tizen.org/tools/boruta/rpc/superviser"
        "git.tizen.org/tools/muxpi/sw/nanopi/stm"
+       uuid "github.com/satori/go.uuid"
 )
 
 var (
@@ -52,6 +53,16 @@ func generateConfFile() {
        f, err := os.Create(confPath)
        exitOnErr("can't create configuration file:", err)
        defer f.Close()
+
+       u, err := uuid.NewV4()
+       if err != nil {
+               // can't generate UUID so write config without it.
+               // TODO: log a warning.
+               goto end
+       }
+       configuration.Caps["UUID"] = u.String()
+
+end:
        exitOnErr("can't generate new configuration:", configuration.Marshal(f))
 }