Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant Switch To Connected Hosts #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion commands/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ func connect(cmdline string) error {

// All is good, update hosts state
if err := hosts.Register(host); err != nil {
return fmt.Errorf("Error connecting to host: %s", err)
return err
}

fmt.Printf("Verified Host(%s) Exists.\n", uuid)

results, err := api.ScheduleQueryAndWait(
Expand Down
2 changes: 1 addition & 1 deletion hosts/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Register(newHost Host) error {
for i, host := range connectedHosts {
if newHost.UUID == host.UUID {
currentHostIndex = i
return nil
return fmt.Errorf("Active Host Switched")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of misusing how errors are set up here, I would suggest that the caller does print after this Register call, or the line above the return here does a print

}
}
connectedHosts = append(connectedHosts, newHost)
Expand Down