diff options
-rw-r--r-- | cmd/dryad/dryad.go | 8 | ||||
-rw-r--r-- | dryad/conf/conf.go | 8 | ||||
-rw-r--r-- | dryad/conf/conf_test.go | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/cmd/dryad/dryad.go b/cmd/dryad/dryad.go index 4339a5a..1e79d87 100644 --- a/cmd/dryad/dryad.go +++ b/cmd/dryad/dryad.go @@ -27,6 +27,7 @@ import ( "git.tizen.org/tools/boruta/dryad" "git.tizen.org/tools/boruta/dryad/conf" dryad_rpc "git.tizen.org/tools/boruta/rpc/dryad" + superviser_rpc "git.tizen.org/tools/boruta/rpc/superviser" ) var ( @@ -86,6 +87,13 @@ func main() { go srv.Accept(l) + boruta, err := superviser_rpc.DialSuperviserClient(configuration.BorutaAddress) + exitOnErr("failed to initialize connection to boruta:", err) + defer boruta.Close() + + err = boruta.Register(configuration.Caps) + exitOnErr("failed to register to boruta:", err) + // Wait for interrupt. c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) diff --git a/dryad/conf/conf.go b/dryad/conf/conf.go index c12a226..42675ba 100644 --- a/dryad/conf/conf.go +++ b/dryad/conf/conf.go @@ -23,6 +23,8 @@ import ( "io/ioutil" "github.com/BurntSushi/toml" + + . "git.tizen.org/tools/boruta" ) // DefaultRPCPort is a port that should be used as default parameter @@ -33,6 +35,7 @@ const DefaultRPCPort = 7175 func NewConf() *General { return &General{ Address: fmt.Sprintf(":%d", DefaultRPCPort), + Caps: Capabilities(map[string]string{}), User: &User{ Name: "boruta-user", Groups: []string{}, @@ -56,6 +59,11 @@ type General struct { Address string `toml:"listen_address"` // BorutaAddress is used to connect to Boruta server. BorutaAddress string `toml:"boruta_address"` + // Caps are necessary information to register in Boruta. + // + // TODO(amistewicz): This field should be removed when + // it will be possible to read it from hardware. + Caps Capabilities `toml:"caps"` // User refers information necessary to create the user. User *User `toml:"user"` // SDcard is a base path to block device of sdcard. diff --git a/dryad/conf/conf_test.go b/dryad/conf/conf_test.go index c0b2142..f1f7177 100644 --- a/dryad/conf/conf_test.go +++ b/dryad/conf/conf_test.go @@ -20,6 +20,7 @@ import ( "bytes" "strings" + "git.tizen.org/tools/boruta" . "git.tizen.org/tools/boruta/dryad/conf" . "github.com/onsi/ginkgo" @@ -31,12 +32,15 @@ var _ = Describe("Conf", func() { boruta_address = "" sdcard = "/dev/sdX" +[caps] + [user] name = "boruta-user" groups = [] ` unmarshaled := &General{ Address: ":7175", + Caps: boruta.Capabilities(map[string]string{}), User: &User{ Name: "boruta-user", Groups: []string{}, |