veyron/tools/mgmt/nodex: create a unified node manager tool
Merge the in-progress node tool into the associate tool to create a
single unified command line tool for node manager control.
Change-Id: I11823b14cbeead4a0b93d625f9b863c652be7838
diff --git a/tools/associate/doc.go b/tools/associate/doc.go
deleted file mode 100644
index 6133bbe..0000000
--- a/tools/associate/doc.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// This file was auto-generated via go generate.
-// DO NOT UPDATE MANUALLY
-
-/*
-The associate tool facilitates creating blessing to system account associations.
-
-Usage:
- associate <command>
-
-The associate commands are:
- list Lists the account associations.
- add Associate the listed blessings with the specified system account
- remove Removes system accounts associated with the listed blessings.
- help Display help for commands or topics
-Run "associate help [command]" for command usage.
-
-The global flags are:
- -alsologtostderr=true: log to standard error as well as files
- -log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
- -log_dir=: if non-empty, write log files to this directory
- -logtostderr=false: log to standard error instead of files
- -max_stack_buf_size=4292608: max size in bytes of the buffer to use for logging stack traces
- -stderrthreshold=2: logs at or above this threshold go to stderr
- -v=0: log level for V logs
- -vmodule=: comma-separated list of pattern=N settings for file-filtered logging
- -vv=0: log level for V logs
-
-Associate List
-
-Lists all account associations
-
-Usage:
- associate list <nodemanager>.
-
-<nodemanager> is the name of the node manager to connect to.
-
-Associate Add
-
-Associate the listed blessings with the specified system account
-
-Usage:
- associate add <nodemanager> <systemName> <blessing>...
-
-<identify specifier>... is a list of 1 or more identify specifications
-<systemName> is the name of an account holder on the local system
-<blessing>.. are the blessings to associate systemAccount with
-
-Associate Remove
-
-Removes system accounts associated with the listed blessings.
-
-Usage:
- associate remove <nodemanager> <blessing>...
-
-<nodemanager> is the node manager to connect to
-<blessing>... is a list of blessings.
-
-Associate Help
-
-Help with no args displays the usage of the parent command.
-Help with args displays the usage of the specified sub-command or help topic.
-"help ..." recursively displays help for all commands and topics.
-
-Usage:
- associate help [flags] [command/topic ...]
-
-[command/topic ...] optionally identifies a specific sub-command or help topic.
-
-The help flags are:
- -style=text: The formatting style for help output, either "text" or "godoc".
-*/
-package main
diff --git a/tools/mgmt/node/main.go b/tools/mgmt/node/main.go
deleted file mode 100644
index b4e497c..0000000
--- a/tools/mgmt/node/main.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package main
-
-import (
- "veyron.io/veyron/veyron2/rt"
-
- _ "veyron.io/veyron/veyron/profiles"
-)
-
-func main() {
- defer rt.Init().Cleanup()
- root().Main()
-}
diff --git a/tools/associate/impl.go b/tools/mgmt/nodex/associate_impl.go
similarity index 97%
rename from tools/associate/impl.go
rename to tools/mgmt/nodex/associate_impl.go
index b8f580b..a3d2a49 100644
--- a/tools/associate/impl.go
+++ b/tools/mgmt/nodex/associate_impl.go
@@ -79,7 +79,7 @@
return node.NodeClient(args[0]).AssociateAccount(ctx, args[1:], "")
}
-func root() *cmdline.Command {
+func associateRoot() *cmdline.Command {
return &cmdline.Command{
Name: "associate",
Short: "Tool for creating associations between Vanadium blessings and a system account",
diff --git a/tools/mgmt/nodex/doc.go b/tools/mgmt/nodex/doc.go
new file mode 100644
index 0000000..3ab0e44
--- /dev/null
+++ b/tools/mgmt/nodex/doc.go
@@ -0,0 +1,149 @@
+// This file was auto-generated via go generate.
+// DO NOT UPDATE MANUALLY
+
+/*
+The nodex tool facilitates interaction with the veyron node manager.
+
+Usage:
+ nodex <command>
+
+The nodex commands are:
+ install Install the given application.
+ start Start an instance of the given application.
+ associate Tool for creating associations between Vanadium blessings and a
+ system account
+ claim Claim the node.
+ help Display help for commands or topics
+Run "nodex help [command]" for command usage.
+
+The global flags are:
+ -alsologtostderr=true
+ log to standard error as well as files
+ -log_backtrace_at=:0
+ when logging hits line file:N, emit a stack trace
+ -log_dir=
+ if non-empty, write log files to this directory
+ -logtostderr=false
+ log to standard error instead of files
+ -max_stack_buf_size=4292608
+ max size in bytes of the buffer to use for logging stack traces
+ -stderrthreshold=2
+ logs at or above this threshold go to stderr
+ -v=0
+ log level for V logs
+ -veyron.credentials=
+ directory to use for storing security credentials
+ -veyron.namespace.root=[/proxy.envyor.com:8101]
+ local namespace root; can be repeated to provided multiple roots
+ -veyron.vtrace.cache_size=1024
+ The number of vtrace traces to store in memory.
+ -veyron.vtrace.dump_on_shutdown=false
+ If true, dump all stored traces on runtime shutdown.
+ -veyron.vtrace.sample_rate=0
+ Rate (from 0.0 to 1.0) to sample vtrace traces.
+ -vmodule=
+ comma-separated list of pattern=N settings for file-filtered logging
+ -vv=0
+ log level for V logs
+
+Nodex Install
+
+Install the given application.
+
+Usage:
+ nodex install <node> <application>
+
+<node> is the veyron object name of the node manager's app service.
+<application> is the veyron object name of the application.
+
+Nodex Start
+
+Start an instance of the given application.
+
+Usage:
+ nodex start <application installation> <grant extension>
+
+<application installation> is the veyron object name of the application
+installation from which to start an instance.
+
+<grant extension> is used to extend the default blessing of the current
+principal when blessing the app instance.
+
+Nodex Associate
+
+The associate tool facilitates managing blessing to system account associations.
+
+Usage:
+ nodex associate <command>
+
+The nodex associate commands are:
+ list Lists the account associations.
+ add Add the listed blessings with the specified system account.
+ remove Removes system accounts associated with the listed blessings.
+
+Nodex Associate List
+
+Lists all account associations.
+
+Usage:
+ nodex associate list <nodemanager>.
+
+<nodemanager> is the name of the node manager to connect to.
+
+Nodex Associate Add
+
+Add the listed blessings with the specified system account.
+
+Usage:
+ nodex associate add <nodemanager> <systemName> <blessing>...
+
+<nodemanager> is the name of the node manager to connect to. <systemName> is the
+name of an account holder on the local system. <blessing>.. are the blessings to
+associate systemAccount with.
+
+Nodex Associate Remove
+
+Removes system accounts associated with the listed blessings.
+
+Usage:
+ nodex associate remove <nodemanager> <blessing>...
+
+<nodemanager> is the name of the node manager to connect to. <blessing>... is a
+list of blessings.
+
+Nodex Claim
+
+Claim the node.
+
+Usage:
+ nodex claim <node> <grant extension>
+
+<node> is the veyron object name of the node manager's app service.
+
+<grant extension> is used to extend the default blessing of the current
+principal when blessing the app instance.
+
+Nodex Help
+
+Help with no args displays the usage of the parent command.
+
+Help with args displays the usage of the specified sub-command or help topic.
+
+"help ..." recursively displays help for all commands and topics.
+
+The output is formatted to a target width in runes. The target width is
+determined by checking the environment variable CMDLINE_WIDTH, falling back on
+the terminal width from the OS, falling back on 80 chars. By setting
+CMDLINE_WIDTH=x, if x > 0 the width is x, if x < 0 the width is unlimited, and
+if x == 0 or is unset one of the fallbacks is used.
+
+Usage:
+ nodex help [flags] [command/topic ...]
+
+[command/topic ...] optionally identifies a specific sub-command or help topic.
+
+The nodex help flags are:
+ -style=text
+ The formatting style for help output, either "text" or "godoc".
+*/
+package main
diff --git a/tools/mgmt/node/impl.go b/tools/mgmt/nodex/impl.go
similarity index 95%
rename from tools/mgmt/node/impl.go
rename to tools/mgmt/nodex/impl.go
index 9758d72..c540f68 100644
--- a/tools/mgmt/node/impl.go
+++ b/tools/mgmt/nodex/impl.go
@@ -102,11 +102,13 @@
func root() *cmdline.Command {
return &cmdline.Command{
- Name: "node",
+ Name: "nodex",
Short: "Tool for interacting with the veyron node manager",
Long: `
-The node tool facilitates interaction with the veyron node manager.
+The nodex tool facilitates interaction with the veyron node manager.
`,
- Children: []*cmdline.Command{cmdInstall, cmdStart, cmdClaim},
+
+
+ Children: []*cmdline.Command{cmdInstall, cmdStart, associateRoot(), cmdClaim},
}
}
diff --git a/tools/associate/impl_test.go b/tools/mgmt/nodex/impl_test.go
similarity index 94%
rename from tools/associate/impl_test.go
rename to tools/mgmt/nodex/impl_test.go
index dbb2ecc..d03ecb2 100644
--- a/tools/associate/impl_test.go
+++ b/tools/mgmt/nodex/impl_test.go
@@ -153,7 +153,7 @@
err: nil,
}})
- if err := cmd.Execute([]string{"list", nodeName}); err != nil {
+ if err := cmd.Execute([]string{"associate", "list", nodeName}); err != nil {
t.Fatalf("%v", err)
}
if expected, got := "root/self alice_self_account\nroot/other alice_other_account", strings.TrimSpace(stdout.String()); got != expected {
@@ -166,7 +166,7 @@
stdout.Reset()
// Test list with bad parameters.
- if err := cmd.Execute([]string{"list", nodeName, "hello"}); err == nil {
+ if err := cmd.Execute([]string{"associate", "list", nodeName, "hello"}); err == nil {
t.Fatalf("wrongly failed to receive a non-nil error.")
}
if got, expected := len(tape.Play()), 0; got != expected {
@@ -201,7 +201,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"add", nodeName, "alice", "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected := []interface{}{
@@ -214,7 +214,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"add", nodeName, "alice", "root/other", "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/other", "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected = []interface{}{
@@ -252,7 +252,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"remove", nodeName, "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "remove", nodeName, "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected := []interface{}{
diff --git a/tools/associate/main.go b/tools/mgmt/nodex/main.go
similarity index 100%
rename from tools/associate/main.go
rename to tools/mgmt/nodex/main.go
diff --git a/tools/associate/mock_test.go b/tools/mgmt/nodex/mock_test.go
similarity index 100%
rename from tools/associate/mock_test.go
rename to tools/mgmt/nodex/mock_test.go