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

Fixed BaseCommand initialization in delegated commands #114

Merged
merged 1 commit into from
Nov 3, 2017
Merged
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
2 changes: 1 addition & 1 deletion commands/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (cmd *Doctor) Run(c *cli.Context) error {

// 3. Pull down the data from DNSDock. This will confirm we can resolve names as well
// as route to the appropriate IP addresses via the added route commands
dnsRecords := DNSRecords{BaseCommand{machine: cmd.machine, out: cmd.out}}
dnsRecords := DNSRecords{cmd.BaseCommand}
if records, err := dnsRecords.LoadRecords(); err == nil {
resolved := false
for _, record := range records {
Expand Down
2 changes: 1 addition & 1 deletion commands/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (cmd *Kill) Run(c *cli.Context) error {
}

// First stop it (and cleanup)
stop := Stop{BaseCommand{machine: cmd.machine, out: cmd.out}}
stop := Stop{cmd.BaseCommand}
if err := stop.Run(c); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion commands/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (cmd *Remove) Run(c *cli.Context) error {
}

// Run kill first
kill := Kill{BaseCommand{machine: cmd.machine, out: cmd.out}}
kill := Kill{cmd.BaseCommand}
if err := kill.Run(c); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions commands/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ func (cmd *Restart) Run(c *cli.Context) error {
cmd.out.Info.Printf("Restarting Outrigger machine '%s' and services", cmd.machine.Name)
}

stop := Stop{BaseCommand{machine: cmd.machine, out: cmd.out}}
stop := Stop{cmd.BaseCommand}
if err := stop.Run(c); err != nil {
return err
}

time.Sleep(time.Duration(5) * time.Second)

start := Start{BaseCommand{machine: cmd.machine, out: cmd.out}}
start := Start{cmd.BaseCommand}
if err := start.Run(c); err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions commands/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (cmd *Start) Run(c *cli.Context) error {
cmd.machine.SetEnv()

cmd.out.Info.Println("Setting up DNS...")
dns := DNS{BaseCommand{machine: cmd.machine, out: cmd.out}}
dns := DNS{cmd.BaseCommand}
dns.StartDNS(cmd.machine, c.String("nameservers"))

// NFS mounts are Mac-only.
Expand Down Expand Up @@ -135,7 +135,7 @@ func (cmd *Start) Run(c *cli.Context) error {
cmd.out.Info.Println("To run Docker commands, your terminal session should be initialized with: 'eval \"$(rig config)\"'")

cmd.out.Info.Println("Launching Dashboard...")
dash := Dashboard{BaseCommand{machine: cmd.machine, out: cmd.out}}
dash := Dashboard{cmd.BaseCommand}
dash.LaunchDashboard(cmd.machine)

return cmd.Success("Outrigger is ready to use")
Expand All @@ -144,10 +144,10 @@ func (cmd *Start) Run(c *cli.Context) error {
// StartMinimal will start "minimal" Outrigger operations, which refers to environments where
// a virtual machine and networking is not required or managed by Outrigger.
func (cmd *Start) StartMinimal(nameservers string) error {
dns := DNS{BaseCommand{machine: cmd.machine, out: cmd.out}}
dns := DNS{cmd.BaseCommand}
dns.StartDNS(cmd.machine, nameservers)

dash := Dashboard{BaseCommand{machine: cmd.machine, out: cmd.out}}
dash := Dashboard{cmd.BaseCommand}
dash.LaunchDashboard(cmd.machine)

return cmd.Success("Outrigger services started")
Expand Down
4 changes: 2 additions & 2 deletions commands/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ func (cmd *Stop) StopMinimal() error {
cmd.out.Verbose.Printf("Skipping Step: Linux does not have a docker-machine to stop.")
cmd.out.Verbose.Printf("Skipping Step: Outrigger does not manage Linux networking.")

dash := Dashboard{BaseCommand{machine: cmd.machine, out: cmd.out}}
dash := Dashboard{cmd.BaseCommand}
dash.StopDashboard()

dns := DNS{BaseCommand{machine: cmd.machine, out: cmd.out}}
dns := DNS{cmd.BaseCommand}
dns.StopDNS()

return cmd.Success("")
Expand Down
8 changes: 4 additions & 4 deletions commands/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ func (cmd *Upgrade) Run(c *cli.Context) error {
}

cmd.out.Info.Printf("Backing up to prepare for upgrade...")
backup := &DataBackup{BaseCommand{machine: cmd.machine, out: cmd.out}}
backup := &DataBackup{cmd.BaseCommand}
if err := backup.Run(c); err != nil {
return err
}

remove := &Remove{BaseCommand{machine: cmd.machine, out: cmd.out}}
remove := &Remove{cmd.BaseCommand}
removeCtx := cmd.NewContext(remove.Commands()[0].Name, remove.Commands()[0].Flags, c)
cmd.SetContextFlag(removeCtx, "force", strconv.FormatBool(true))
if err := remove.Run(removeCtx); err != nil {
return err
}

start := &Start{BaseCommand{machine: cmd.machine, out: cmd.out}}
start := &Start{cmd.BaseCommand}
startCtx := cmd.NewContext(start.Commands()[0].Name, start.Commands()[0].Flags, c)
cmd.SetContextFlag(startCtx, "driver", cmd.machine.GetDriver())
cmd.SetContextFlag(startCtx, "cpu-count", strconv.FormatInt(int64(cmd.machine.GetCPU()), 10))
Expand All @@ -84,7 +84,7 @@ func (cmd *Upgrade) Run(c *cli.Context) error {
return err
}

restore := &DataRestore{BaseCommand{machine: cmd.machine, out: cmd.out}}
restore := &DataRestore{cmd.BaseCommand}
restoreCtx := cmd.NewContext(restore.Commands()[0].Name, restore.Commands()[0].Flags, c)
cmd.SetContextFlag(restoreCtx, "data-dir", c.String("data-dir"))
backupFile := fmt.Sprintf("%s%c%s.tgz", c.String("backup-dir"), os.PathSeparator, cmd.machine.Name)
Expand Down