From 25a99c9c7f7e17ab5c1f46ad05f8f43545ae00e2 Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Fri, 27 Jul 2018 17:32:17 +0200 Subject: [PATCH] Generate UUID with a new configuration file It is a quality of life change. Generated config requires minimal modifications (boruta address) to work. Change-Id: I713886ca8595ba528247087fb49587ef0f27b72a Signed-off-by: Aleksander Mistewicz --- cmd/dryad/dryad.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/dryad/dryad.go b/cmd/dryad/dryad.go index b7d637f..7ebe7df 100644 --- a/cmd/dryad/dryad.go +++ b/cmd/dryad/dryad.go @@ -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)) } -- 2.7.4