veyron2/services/mgmt/node: rename node->device, cl 2 of N (go/vissue/496)
Rename node->device throughout type/method names and comments. Virtually all
mechanical replacements, except for comment reformatting.
Renaming files and packages left for future cls.
Change-Id: I49cfd04c3ae2a7e6ffed8c76f6868d5981118fcf
diff --git a/tools/mgmt/nodex/acl_test.go b/tools/mgmt/nodex/acl_test.go
index 57922f8..9e6b945 100644
--- a/tools/mgmt/nodex/acl_test.go
+++ b/tools/mgmt/nodex/acl_test.go
@@ -32,7 +32,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
// Test the 'get' command.
tape.SetResponses([]interface{}{GetACLResponse{
@@ -49,7 +49,7 @@
err: nil,
}})
- if err := cmd.Execute([]string{"acl", "get", nodeName}); err != nil {
+ if err := cmd.Execute([]string{"acl", "get", deviceName}); err != nil {
t.Fatalf("%v, output: %v, error: %v", err)
}
if expected, got := strings.TrimSpace(`
@@ -78,10 +78,10 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
// Some tests to validate parse.
- if err := cmd.Execute([]string{"acl", "set", nodeName}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName}); err == nil {
t.Fatalf("failed to correctly detect insufficient parameters")
}
if expected, got := "ERROR: set: incorrect number of arguments 1, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -90,7 +90,7 @@
stderr.Reset()
stdout.Reset()
- if err := cmd.Execute([]string{"acl", "set", nodeName, "foo"}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName, "foo"}); err == nil {
t.Fatalf("failed to correctly detect insufficient parameters")
}
if expected, got := "ERROR: set: incorrect number of arguments 2, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -99,7 +99,7 @@
stderr.Reset()
stdout.Reset()
- if err := cmd.Execute([]string{"acl", "set", nodeName, "foo", "bar", "ohno"}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName, "foo", "bar", "ohno"}); err == nil {
t.Fatalf("failed to correctly detect insufficient parameters")
}
if expected, got := "ERROR: set: incorrect number of arguments 4, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -108,7 +108,7 @@
stderr.Reset()
stdout.Reset()
- if err := cmd.Execute([]string{"acl", "set", nodeName, "foo", "!"}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName, "foo", "!"}); err == nil {
t.Fatalf("failed to detect invalid parameter")
}
if expected, got := "ERROR: failed to parse access tags for \"foo\": empty access tag", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -156,7 +156,7 @@
if err := cmd.Execute([]string{
"acl",
"set",
- nodeName,
+ deviceName,
"friends/...", "Admin,Write",
"friends/alice", "!Admin,Write",
"self/...", "Admin,Write,Read",
@@ -227,10 +227,10 @@
},
})
- if err := cmd.Execute([]string{"acl", "set", nodeName, "vana/bad", "Read"}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName, "vana/bad", "Read"}); err == nil {
t.Fatalf("GetACL RPC inside acl set command failed but error wrongly not detected")
}
- if expected, got := `^ERROR: GetACL\(`+nodeName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
+ if expected, got := `^ERROR: GetACL\(`+deviceName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
t.Fatalf("Unexpected output from list. Got %q, regexp %q", got, expected)
}
if expected, got := "", strings.TrimSpace(stdout.String()); got != expected {
@@ -260,13 +260,13 @@
verror.Make(errOops, nil),
})
- if err := cmd.Execute([]string{"acl", "set", nodeName, "friend", "Read"}); err == nil {
+ if err := cmd.Execute([]string{"acl", "set", deviceName, "friend", "Read"}); err == nil {
t.Fatalf("SetACL should have failed: %v", err)
}
if expected, got := "", strings.TrimSpace(stdout.String()); got != expected {
t.Fatalf("Unexpected output from list. Got %q, expected %q", got, expected)
}
- if expected, got := `^ERROR: SetACL\(`+nodeName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
+ if expected, got := `^ERROR: SetACL\(`+deviceName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
t.Fatalf("Unexpected output from list. Got %q, regexp %q", got, expected)
}
diff --git a/tools/mgmt/nodex/associate_impl.go b/tools/mgmt/nodex/associate_impl.go
index 479046e..06d77c3 100644
--- a/tools/mgmt/nodex/associate_impl.go
+++ b/tools/mgmt/nodex/associate_impl.go
@@ -13,9 +13,9 @@
Name: "list",
Short: "Lists the account associations.",
Long: "Lists all account associations.",
- ArgsName: "<nodemanager>.",
+ ArgsName: "<devicemanager>.",
ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.`,
+<devicemanager> is the name of the device manager to connect to.`,
}
func runList(cmd *cmdline.Command, args []string) error {
@@ -41,9 +41,9 @@
Name: "add",
Short: "Add the listed blessings with the specified system account.",
Long: "Add the listed blessings with the specified system account.",
- ArgsName: "<nodemanager> <systemName> <blessing>...",
+ ArgsName: "<devicemanager> <systemName> <blessing>...",
ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.
+<devicemanager> is the name of the device manager to connect to.
<systemName> is the name of an account holder on the local system.
<blessing>.. are the blessings to associate systemAccount with.`,
}
@@ -62,9 +62,9 @@
Name: "remove",
Short: "Removes system accounts associated with the listed blessings.",
Long: "Removes system accounts associated with the listed blessings.",
- ArgsName: "<nodemanager> <blessing>...",
+ ArgsName: "<devicemanager> <blessing>...",
ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.
+<devicemanager> is the name of the device manager to connect to.
<blessing>... is a list of blessings.`,
}
diff --git a/tools/mgmt/nodex/impl.go b/tools/mgmt/nodex/impl.go
index 51fb0f6..1bda19b 100644
--- a/tools/mgmt/nodex/impl.go
+++ b/tools/mgmt/nodex/impl.go
@@ -15,9 +15,9 @@
Name: "install",
Short: "Install the given application.",
Long: "Install the given application.",
- ArgsName: "<node> <application>",
+ ArgsName: "<device> <application>",
ArgsLong: `
-<node> is the veyron object name of the node manager's app service.
+<device> is the veyron object name of the device manager's app service.
<application> is the veyron object name of the application.`,
}
@@ -25,12 +25,12 @@
if expected, got := 2, len(args); expected != got {
return cmd.UsageErrorf("install: incorrect number of arguments, expected %d, got %d", expected, got)
}
- nodeName, appName := args[0], args[1]
- appID, err := node.ApplicationClient(nodeName).Install(runtime.NewContext(), appName)
+ deviceName, appName := args[0], args[1]
+ appID, err := node.ApplicationClient(deviceName).Install(runtime.NewContext(), appName)
if err != nil {
return fmt.Errorf("Install failed: %v", err)
}
- fmt.Fprintf(cmd.Stdout(), "Successfully installed: %q\n", naming.Join(nodeName, appID))
+ fmt.Fprintf(cmd.Stdout(), "Successfully installed: %q\n", naming.Join(deviceName, appID))
return nil
}
@@ -76,11 +76,11 @@
var cmdClaim = &cmdline.Command{
Run: runClaim,
Name: "claim",
- Short: "Claim the node.",
- Long: "Claim the node.",
- ArgsName: "<node> <grant extension>",
+ Short: "Claim the device.",
+ Long: "Claim the device.",
+ ArgsName: "<device> <grant extension>",
ArgsLong: `
-<node> is the veyron object name of the node manager's app service.
+<device> is the veyron object name of the device manager's app service.
<grant extension> is used to extend the default blessing of the
current principal when blessing the app instance.`,
@@ -90,8 +90,8 @@
if expected, got := 2, len(args); expected != got {
return cmd.UsageErrorf("claim: incorrect number of arguments, expected %d, got %d", expected, got)
}
- nodeName, grant := args[0], args[1]
- if err := node.DeviceClient(nodeName).Claim(runtime.NewContext(), &granter{p: runtime.Principal(), extension: grant}); err != nil {
+ deviceName, grant := args[0], args[1]
+ if err := node.DeviceClient(deviceName).Claim(runtime.NewContext(), &granter{p: runtime.Principal(), extension: grant}); err != nil {
return fmt.Errorf("Claim failed: %v", err)
}
fmt.Fprintln(cmd.Stdout(), "Successfully claimed.")
@@ -101,9 +101,9 @@
func root() *cmdline.Command {
return &cmdline.Command{
Name: "nodex",
- Short: "Tool for interacting with the veyron node manager",
+ Short: "Tool for interacting with the veyron device manager",
Long: `
-The nodex tool facilitates interaction with the veyron node manager.
+The nodex tool facilitates interaction with the veyron device manager.
`,
Children: []*cmdline.Command{cmdInstall, cmdStart, associateRoot(), cmdClaim, cmdStop, cmdSuspend, cmdResume, aclRoot()},
}
diff --git a/tools/mgmt/nodex/impl_test.go b/tools/mgmt/nodex/impl_test.go
index 535fbdb..e7239d3 100644
--- a/tools/mgmt/nodex/impl_test.go
+++ b/tools/mgmt/nodex/impl_test.go
@@ -32,7 +32,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
// Test the 'list' command.
tape.SetResponses([]interface{}{ListAssociationResponse{
@@ -49,7 +49,7 @@
err: nil,
}})
- if err := cmd.Execute([]string{"associate", "list", nodeName}); err != nil {
+ if err := cmd.Execute([]string{"associate", "list", deviceName}); 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 {
@@ -62,7 +62,7 @@
stdout.Reset()
// Test list with bad parameters.
- if err := cmd.Execute([]string{"associate", "list", nodeName, "hello"}); err == nil {
+ if err := cmd.Execute([]string{"associate", "list", deviceName, "hello"}); err == nil {
t.Fatalf("wrongly failed to receive a non-nil error.")
}
if got, expected := len(tape.Play()), 0; got != expected {
@@ -84,7 +84,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "/myapp/1")
+ deviceName := naming.JoinAddressName(endpoint.String(), "/myapp/1")
if err := cmd.Execute([]string{"add", "one"}); err == nil {
t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -96,7 +96,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "add", deviceName, "alice", "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected := []interface{}{
@@ -109,7 +109,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/other", "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "add", deviceName, "alice", "root/other", "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected = []interface{}{
@@ -134,7 +134,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
if err := cmd.Execute([]string{"remove", "one"}); err == nil {
t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -146,7 +146,7 @@
stdout.Reset()
tape.SetResponses([]interface{}{nil})
- if err := cmd.Execute([]string{"associate", "remove", nodeName, "root/self"}); err != nil {
+ if err := cmd.Execute([]string{"associate", "remove", deviceName, "root/self"}); err != nil {
t.Fatalf("%v", err)
}
expected := []interface{}{
@@ -171,7 +171,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
if err := cmd.Execute([]string{"install", "blech"}); err == nil {
t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -196,12 +196,12 @@
appId: appId,
err: nil,
}})
- if err := cmd.Execute([]string{"install", nodeName, "myBestApp"}); err != nil {
+ if err := cmd.Execute([]string{"install", deviceName, "myBestApp"}); err != nil {
t.Fatalf("%v", err)
}
eb := new(bytes.Buffer)
- fmt.Fprintf(eb, "Successfully installed: %q", naming.Join(nodeName, appId))
+ fmt.Fprintf(eb, "Successfully installed: %q", naming.Join(deviceName, appId))
if expected, got := eb.String(), strings.TrimSpace(stdout.String()); got != expected {
t.Fatalf("Unexpected output from Install. Got %q, expected %q", got, expected)
}
@@ -227,7 +227,7 @@
cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
- nodeName := naming.JoinAddressName(endpoint.String(), "")
+ deviceName := naming.JoinAddressName(endpoint.String(), "")
// Confirm that we correctly enforce the number of arguments.
if err := cmd.Execute([]string{"claim", "nope"}); err == nil {
@@ -254,8 +254,8 @@
tape.SetResponses([]interface{}{
nil,
})
- if err := cmd.Execute([]string{"claim", nodeName, "grant"}); err != nil {
- t.Fatalf("Claim(%s, %s) failed: %v", nodeName, "grant", err)
+ if err := cmd.Execute([]string{"claim", deviceName, "grant"}); err != nil {
+ t.Fatalf("Claim(%s, %s) failed: %v", deviceName, "grant", err)
}
if got, expected := len(tape.Play()), 1; got != expected {
t.Errorf("invalid call sequence. Got %v, want %v", got, expected)
@@ -277,7 +277,7 @@
tape.SetResponses([]interface{}{
verror.Make(errOops, nil),
})
- if err := cmd.Execute([]string{"claim", nodeName, "grant"}); err == nil {
+ if err := cmd.Execute([]string{"claim", deviceName, "grant"}); err == nil {
t.Fatalf("claim() failed to detect error", err)
}
expected = []interface{}{
diff --git a/tools/mgmt/nodex/nodemanager_mock_test.go b/tools/mgmt/nodex/nodemanager_mock_test.go
index 82b1593..717122b 100644
--- a/tools/mgmt/nodex/nodemanager_mock_test.go
+++ b/tools/mgmt/nodex/nodemanager_mock_test.go
@@ -16,7 +16,7 @@
"veyron.io/veyron/veyron/profiles"
)
-type mockNodeInvoker struct {
+type mockDeviceInvoker struct {
tape *Tape
t *testing.T
}
@@ -27,7 +27,7 @@
err error
}
-func (mni *mockNodeInvoker) ListAssociations(ipc.ServerContext) (associations []node.Association, err error) {
+func (mni *mockDeviceInvoker) ListAssociations(ipc.ServerContext) (associations []node.Association, err error) {
vlog.VI(2).Infof("ListAssociations() was called")
ir := mni.tape.Record("ListAssociations")
@@ -44,7 +44,7 @@
// simpleCore implements the core of all mock methods that take
// arguments and return error.
-func (mni *mockNodeInvoker) simpleCore(callRecord interface{}, name string) error {
+func (mni *mockDeviceInvoker) simpleCore(callRecord interface{}, name string) error {
ri := mni.tape.Record(callRecord)
switch r := ri.(type) {
case nil:
@@ -56,21 +56,21 @@
return nil
}
-func (mni *mockNodeInvoker) AssociateAccount(call ipc.ServerContext, identityNames []string, accountName string) error {
+func (mni *mockDeviceInvoker) AssociateAccount(call ipc.ServerContext, identityNames []string, accountName string) error {
return mni.simpleCore(AddAssociationStimulus{"AssociateAccount", identityNames, accountName}, "AssociateAccount")
}
-func (mni *mockNodeInvoker) Claim(call ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Claim(call ipc.ServerContext) error {
return mni.simpleCore("Claim", "Claim")
}
-func (*mockNodeInvoker) Describe(ipc.ServerContext) (node.Description, error) {
+func (*mockDeviceInvoker) Describe(ipc.ServerContext) (node.Description, error) {
return node.Description{}, nil
}
-func (*mockNodeInvoker) IsRunnable(_ ipc.ServerContext, description binary.Description) (bool, error) {
+func (*mockDeviceInvoker) IsRunnable(_ ipc.ServerContext, description binary.Description) (bool, error) {
return false, nil
}
-func (*mockNodeInvoker) Reset(call ipc.ServerContext, deadline uint64) error { return nil }
+func (*mockDeviceInvoker) Reset(call ipc.ServerContext, deadline uint64) error { return nil }
// Mock Install
type InstallStimulus struct {
@@ -83,26 +83,26 @@
err error
}
-func (mni *mockNodeInvoker) Install(call ipc.ServerContext, appName string) (string, error) {
+func (mni *mockDeviceInvoker) Install(call ipc.ServerContext, appName string) (string, error) {
ir := mni.tape.Record(InstallStimulus{"Install", appName})
r := ir.(InstallResponse)
return r.appId, r.err
}
-func (*mockNodeInvoker) Refresh(ipc.ServerContext) error { return nil }
-func (*mockNodeInvoker) Restart(ipc.ServerContext) error { return nil }
+func (*mockDeviceInvoker) Refresh(ipc.ServerContext) error { return nil }
+func (*mockDeviceInvoker) Restart(ipc.ServerContext) error { return nil }
-func (mni *mockNodeInvoker) Resume(_ ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Resume(_ ipc.ServerContext) error {
return mni.simpleCore("Resume", "Resume")
}
-func (i *mockNodeInvoker) Revert(call ipc.ServerContext) error { return nil }
+func (i *mockDeviceInvoker) Revert(call ipc.ServerContext) error { return nil }
type StartResponse struct {
appIds []string
err error
}
-func (mni *mockNodeInvoker) Start(ipc.ServerContext) ([]string, error) {
+func (mni *mockDeviceInvoker) Start(ipc.ServerContext) ([]string, error) {
ir := mni.tape.Record("Start")
r := ir.(StartResponse)
return r.appIds, r.err
@@ -113,16 +113,16 @@
timeDelta uint32
}
-func (mni *mockNodeInvoker) Stop(_ ipc.ServerContext, timeDelta uint32) error {
+func (mni *mockDeviceInvoker) Stop(_ ipc.ServerContext, timeDelta uint32) error {
return mni.simpleCore(StopStimulus{"Stop", timeDelta}, "Stop")
}
-func (mni *mockNodeInvoker) Suspend(_ ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Suspend(_ ipc.ServerContext) error {
return mni.simpleCore("Suspend", "Suspend")
}
-func (*mockNodeInvoker) Uninstall(ipc.ServerContext) error { return nil }
-func (i *mockNodeInvoker) Update(ipc.ServerContext) error { return nil }
-func (*mockNodeInvoker) UpdateTo(ipc.ServerContext, string) error { return nil }
+func (*mockDeviceInvoker) Uninstall(ipc.ServerContext) error { return nil }
+func (i *mockDeviceInvoker) Update(ipc.ServerContext) error { return nil }
+func (*mockDeviceInvoker) UpdateTo(ipc.ServerContext, string) error { return nil }
// Mock ACL getting and setting
type GetACLResponse struct {
@@ -137,11 +137,11 @@
etag string
}
-func (mni *mockNodeInvoker) SetACL(_ ipc.ServerContext, acl access.TaggedACLMap, etag string) error {
+func (mni *mockDeviceInvoker) SetACL(_ ipc.ServerContext, acl access.TaggedACLMap, etag string) error {
return mni.simpleCore(SetACLStimulus{"SetACL", acl, etag}, "SetACL")
}
-func (mni *mockNodeInvoker) GetACL(ipc.ServerContext) (access.TaggedACLMap, string, error) {
+func (mni *mockDeviceInvoker) GetACL(ipc.ServerContext) (access.TaggedACLMap, string, error) {
ir := mni.tape.Record("GetACL")
r := ir.(GetACLResponse)
return r.acl, r.etag, r.err
@@ -157,7 +157,7 @@
}
func (d *dispatcher) Lookup(suffix string) (interface{}, security.Authorizer, error) {
- return node.DeviceServer(&mockNodeInvoker{tape: d.tape, t: d.t}), nil, nil
+ return node.DeviceServer(&mockDeviceInvoker{tape: d.tape, t: d.t}), nil, nil
}
func startServer(t *testing.T, r veyron2.Runtime, tape *Tape) (ipc.Server, naming.Endpoint, error) {