diff --git a/command/agent_force_leave_test.go b/command/agent_force_leave_test.go deleted file mode 100644 index d343a09fc..000000000 --- a/command/agent_force_leave_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package command - -import ( - "testing" - - "github.com/mitchellh/cli" -) - -func TestAgentForceLeaveCommand_Implements(t *testing.T) { - var _ cli.Command = &AgentForceLeaveCommand{} -} diff --git a/command/agent_join_test.go b/command/agent_join_test.go deleted file mode 100644 index f8a278fc7..000000000 --- a/command/agent_join_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package command - -import ( - "testing" - - "github.com/mitchellh/cli" -) - -func TestAgentJoinCommand_Implements(t *testing.T) { - var _ cli.Command = &AgentJoinCommand{} -} diff --git a/command/agent_force_leave.go b/command/server_force_leave.go similarity index 62% rename from command/agent_force_leave.go rename to command/server_force_leave.go index b1a26b98b..666be7060 100644 --- a/command/agent_force_leave.go +++ b/command/server_force_leave.go @@ -5,15 +5,15 @@ import ( "strings" ) -type AgentForceLeaveCommand struct { +type ServerForceLeaveCommand struct { Meta } -func (c *AgentForceLeaveCommand) Help() string { +func (c *ServerForceLeaveCommand) Help() string { helpText := ` -Usage: nomad agent-force-leave [options] +Usage: nomad server-force-leave [options] - Forces an agent to enter the "left" state. This can be used to + Forces an server to enter the "left" state. This can be used to eject nodes which have failed and will not rejoin the cluster. Note that if the member is actually still alive, it will eventually rejoin the cluster again. @@ -24,12 +24,12 @@ General Options: return strings.TrimSpace(helpText) } -func (c *AgentForceLeaveCommand) Synopsis() string { - return "Force a member into the 'left' state" +func (c *ServerForceLeaveCommand) Synopsis() string { + return "Force a server into the 'left' state" } -func (c *AgentForceLeaveCommand) Run(args []string) int { - flags := c.Meta.FlagSet("force-leave", FlagSetClient) +func (c *ServerForceLeaveCommand) Run(args []string) int { + flags := c.Meta.FlagSet("server-force-leave", FlagSetClient) flags.Usage = func() { c.Ui.Output(c.Help()) } if err := flags.Parse(args); err != nil { return 1 @@ -52,7 +52,7 @@ func (c *AgentForceLeaveCommand) Run(args []string) int { // Call force-leave on the node if err := client.Agent().ForceLeave(node); err != nil { - c.Ui.Error(fmt.Sprintf("Error force-leaving node %s: %s", node, err)) + c.Ui.Error(fmt.Sprintf("Error force-leaving server %s: %s", node, err)) return 1 } diff --git a/command/server_force_leave_test.go b/command/server_force_leave_test.go new file mode 100644 index 000000000..fdf651162 --- /dev/null +++ b/command/server_force_leave_test.go @@ -0,0 +1,11 @@ +package command + +import ( + "testing" + + "github.com/mitchellh/cli" +) + +func TestServerForceLeaveCommand_Implements(t *testing.T) { + var _ cli.Command = &ServerForceLeaveCommand{} +} diff --git a/command/agent_join.go b/command/server_join.go similarity index 74% rename from command/agent_join.go rename to command/server_join.go index 5da7e65a7..9b9bacc53 100644 --- a/command/agent_join.go +++ b/command/server_join.go @@ -5,13 +5,13 @@ import ( "strings" ) -type AgentJoinCommand struct { +type ServerJoinCommand struct { Meta } -func (c *AgentJoinCommand) Help() string { +func (c *ServerJoinCommand) Help() string { helpText := ` -Usage: nomad agent-join [options] [...] +Usage: nomad server-join [options] [...] Joins the local server to one or more Nomad servers. Joining is only required for server nodes, and only needs to succeed @@ -25,12 +25,12 @@ General Options: return strings.TrimSpace(helpText) } -func (c *AgentJoinCommand) Synopsis() string { +func (c *ServerJoinCommand) Synopsis() string { return "Join server nodes together" } -func (c *AgentJoinCommand) Run(args []string) int { - flags := c.Meta.FlagSet("agent-join", FlagSetClient) +func (c *ServerJoinCommand) Run(args []string) int { + flags := c.Meta.FlagSet("server-join", FlagSetClient) flags.Usage = func() { c.Ui.Output(c.Help()) } if err := flags.Parse(args); err != nil { return 1 @@ -59,6 +59,6 @@ func (c *AgentJoinCommand) Run(args []string) int { } // Success - c.Ui.Output(fmt.Sprintf("Joined %d nodes successfully", n)) + c.Ui.Output(fmt.Sprintf("Joined %d servers successfully", n)) return 0 } diff --git a/command/server_join_test.go b/command/server_join_test.go new file mode 100644 index 000000000..289006c50 --- /dev/null +++ b/command/server_join_test.go @@ -0,0 +1,11 @@ +package command + +import ( + "testing" + + "github.com/mitchellh/cli" +) + +func TestServerJoinCommand_Implements(t *testing.T) { + var _ cli.Command = &ServerJoinCommand{} +} diff --git a/command/agent_members.go b/command/server_members.go similarity index 82% rename from command/agent_members.go rename to command/server_members.go index 38110cb4d..779de332d 100644 --- a/command/agent_members.go +++ b/command/server_members.go @@ -8,15 +8,15 @@ import ( "github.com/ryanuber/columnize" ) -type AgentMembersCommand struct { +type ServerMembersCommand struct { Meta } -func (c *AgentMembersCommand) Help() string { +func (c *ServerMembersCommand) Help() string { helpText := ` -Usage: nomad agent-members [options] +Usage: nomad server-members [options] - Display a list of the known members and their status. + Display a list of the known servers and their status. General Options: @@ -32,14 +32,14 @@ Agent Members Options: return strings.TrimSpace(helpText) } -func (c *AgentMembersCommand) Synopsis() string { - return "Display a list of known members and their status" +func (c *ServerMembersCommand) Synopsis() string { + return "Display a list of known servers and their status" } -func (c *AgentMembersCommand) Run(args []string) int { +func (c *ServerMembersCommand) Run(args []string) int { var detailed bool - flags := c.Meta.FlagSet("agent-members", FlagSetClient) + flags := c.Meta.FlagSet("server-members", FlagSetClient) flags.Usage = func() { c.Ui.Output(c.Help()) } flags.BoolVar(&detailed, "detailed", false, "Show detailed output") @@ -64,7 +64,7 @@ func (c *AgentMembersCommand) Run(args []string) int { // Query the members mem, err := client.Agent().Members() if err != nil { - c.Ui.Error(fmt.Sprintf("Error querying members: %s", err)) + c.Ui.Error(fmt.Sprintf("Error querying servers: %s", err)) return 1 } diff --git a/command/agent_members_test.go b/command/server_members_test.go similarity index 84% rename from command/agent_members_test.go rename to command/server_members_test.go index d7a22df05..41cd6b6eb 100644 --- a/command/agent_members_test.go +++ b/command/server_members_test.go @@ -7,16 +7,16 @@ import ( "github.com/mitchellh/cli" ) -func TestAgentMembersCommand_Implements(t *testing.T) { - var _ cli.Command = &AgentMembersCommand{} +func TestServerMembersCommand_Implements(t *testing.T) { + var _ cli.Command = &ServerMembersCommand{} } -func TestAgentMembersCommand_Run(t *testing.T) { +func TestServerMembersCommand_Run(t *testing.T) { srv, client, url := testServer(t, nil) defer srv.Stop() ui := new(cli.MockUi) - cmd := &AgentMembersCommand{Meta: Meta{Ui: ui}} + cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}} // Get our own node name name, err := client.Agent().NodeName() @@ -44,7 +44,7 @@ func TestAgentMembersCommand_Run(t *testing.T) { func TestMembersCommand_Fails(t *testing.T) { ui := new(cli.MockUi) - cmd := &AgentMembersCommand{Meta: Meta{Ui: ui}} + cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}} // Fails on misuse if code := cmd.Run([]string{"some", "bad", "args"}); code != 1 { @@ -59,7 +59,7 @@ func TestMembersCommand_Fails(t *testing.T) { if code := cmd.Run([]string{"-address=nope"}); code != 1 { t.Fatalf("expected exit code 1, got: %d", code) } - if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error querying members") { + if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error querying servers") { t.Fatalf("expected failed query error, got: %s", out) } } diff --git a/commands.go b/commands.go index 921606307..e60e37ff6 100644 --- a/commands.go +++ b/commands.go @@ -34,30 +34,12 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory { }, nil }, - "agent-force-leave": func() (cli.Command, error) { - return &command.AgentForceLeaveCommand{ - Meta: meta, - }, nil - }, - "agent-info": func() (cli.Command, error) { return &command.AgentInfoCommand{ Meta: meta, }, nil }, - "agent-join": func() (cli.Command, error) { - return &command.AgentJoinCommand{ - Meta: meta, - }, nil - }, - - "agent-members": func() (cli.Command, error) { - return &command.AgentMembersCommand{ - Meta: meta, - }, nil - }, - "eval-monitor": func() (cli.Command, error) { return &command.EvalMonitorCommand{ Meta: meta, @@ -82,6 +64,24 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory { }, nil }, + "server-force-leave": func() (cli.Command, error) { + return &command.ServerForceLeaveCommand{ + Meta: meta, + }, nil + }, + + "server-join": func() (cli.Command, error) { + return &command.ServerJoinCommand{ + Meta: meta, + }, nil + }, + + "server-members": func() (cli.Command, error) { + return &command.ServerMembersCommand{ + Meta: meta, + }, nil + }, + "spawn-daemon": func() (cli.Command, error) { return &command.SpawnDaemonCommand{ Meta: meta, diff --git a/website/source/docs/commands/agent-force-leave.html.md.erb b/website/source/docs/commands/server-force-leave.html.md.erb similarity index 54% rename from website/source/docs/commands/agent-force-leave.html.md.erb rename to website/source/docs/commands/server-force-leave.html.md.erb index 4fc9ca816..5000923a4 100644 --- a/website/source/docs/commands/agent-force-leave.html.md.erb +++ b/website/source/docs/commands/server-force-leave.html.md.erb @@ -1,14 +1,14 @@ --- layout: "docs" -page_title: "Commands: agent-force-leave" -sidebar_current: "docs-commands-agent-force-leave" +page_title: "Commands: server-force-leave" +sidebar_current: "docs-commands-server-force-leave" description: > - Force a node into the "left" state. + Force a server into the "left" state. --- -# Command: agent-force-leave +# Command: server-force-leave -The `agent-force-leave` command forces a server to enter the "left" state. +The `server-force-leave` command forces a server to enter the "left" state. This can be used to eject server nodes which have failed and will not rejoin the cluster. Note that if the server is actually still alive, it will eventually rejoin the cluster again. @@ -16,7 +16,7 @@ eventually rejoin the cluster again. ## Usage ``` -nomad agent-force-leave [options] +nomad server-force-leave [options] ``` This command expects only one argument - the node which should be forced @@ -28,8 +28,8 @@ to enter the "left" state. ## Examples -Force-leave the node "node1": +Force-leave the server "node1": ``` -$ nomad agent-force-leave node1 +$ nomad server-force-leave node1 ``` diff --git a/website/source/docs/commands/agent-join.html.md.erb b/website/source/docs/commands/server-join.html.md.erb similarity index 69% rename from website/source/docs/commands/agent-join.html.md.erb rename to website/source/docs/commands/server-join.html.md.erb index 951c8cd3e..d0faf1aa3 100644 --- a/website/source/docs/commands/agent-join.html.md.erb +++ b/website/source/docs/commands/server-join.html.md.erb @@ -1,14 +1,14 @@ --- layout: "docs" -page_title: "Commands: agent-join" -sidebar_current: "docs-commands-agent-join" +page_title: "Commands: server-join" +sidebar_current: "docs-commands-server-join" description: > Joins the local server to one or more Nomad servers. --- -# Command: agent-join +# Command: server-join -The `agent-join` command joins the local server to one or more Nomad servers. +The `server-join` command joins the local server to one or more Nomad servers. Joining is only required for server nodes, and only needs to succeed against one or more of the provided addresses. Once joined, the gossip layer will handle discovery of the other server nodes in the cluster. @@ -16,7 +16,7 @@ handle discovery of the other server nodes in the cluster. ## Usage ``` -nomad agent-join [options] [...] +nomad server-join [options] [...] ``` One or more server addresses are required. If multiple server addresses are @@ -33,6 +33,6 @@ be 1. Join the local server to a remote server: ``` -$ nomad agent-join 10.0.0.8:4648 -Joined 1 nodes successfully +$ nomad server-join 10.0.0.8:4648 +Joined 1 servers successfully ``` diff --git a/website/source/docs/commands/agent-members.html.md.erb b/website/source/docs/commands/server-members.html.md.erb similarity index 73% rename from website/source/docs/commands/agent-members.html.md.erb rename to website/source/docs/commands/server-members.html.md.erb index 7e9de4553..3f3630ea2 100644 --- a/website/source/docs/commands/agent-members.html.md.erb +++ b/website/source/docs/commands/server-members.html.md.erb @@ -1,21 +1,21 @@ --- layout: "docs" -page_title: "Commands: agent-members" -sidebar_current: "docs-commands-agent-members" +page_title: "Commands: server-members" +sidebar_current: "docs-commands-server-members" description: > - Display a list of the known cluster members and their status. + Display a list of the known server members and their status. --- -# Command: agent-members +# Command: server-members -The `agent-members` command displays a list of the known servers in the cluster +The `server-members` command displays a list of the known servers in the cluster and their current status. Member information is provided by the gossip protocol, which is only run on server nodes. ## Usage ``` -nomad agent-members [options] +nomad server-members [options] ``` ## General Options @@ -33,7 +33,7 @@ nomad agent-members [options] Default view: ``` -$ nomad agent-members +$ nomad server-members Name Addr Port Status Proto Build DC Region node1.global 10.0.0.8 4648 alive 2 0.1.0dev dc1 global node2.global 10.0.0.9 4648 alive 2 0.1.0dev dc1 global @@ -42,7 +42,7 @@ node2.global 10.0.0.9 4648 alive 2 0.1.0dev dc1 global Detailed view: ``` -$ nomad agent-members -detailed +$ nomad server-members -detailed Name Addr Port Tags node1 10.0.0.8 4648 bootstrap=1,build=0.1.0dev,vsn=1,vsn_max=1,dc=dc1,port=4647,region=global,role=nomad,vsn_min=1 node2 10.0.0.9 4648 bootstrap=0,build=0.1.0dev,vsn=1,vsn_max=1,dc=dc1,port=4647,region=global,role=nomad,vsn_min=1