From 2dbb0adf3c9c592f17476943b11736f3d2f5538f Mon Sep 17 00:00:00 2001 From: Frank Febbraro Date: Fri, 3 Nov 2017 10:32:21 -0700 Subject: [PATCH] fixed BaseCommand initialization in delegated commands --- commands/doctor.go | 2 +- commands/kill.go | 2 +- commands/remove.go | 2 +- commands/restart.go | 4 ++-- commands/start.go | 8 ++++---- commands/stop.go | 4 ++-- commands/upgrade.go | 8 ++++---- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/commands/doctor.go b/commands/doctor.go index 238e9c0..9810672 100644 --- a/commands/doctor.go +++ b/commands/doctor.go @@ -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 { diff --git a/commands/kill.go b/commands/kill.go index 967d686..533690e 100644 --- a/commands/kill.go +++ b/commands/kill.go @@ -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 } diff --git a/commands/remove.go b/commands/remove.go index 8a92de0..860c7c1 100644 --- a/commands/remove.go +++ b/commands/remove.go @@ -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 } diff --git a/commands/restart.go b/commands/restart.go index d9fb98a..a3c6d51 100644 --- a/commands/restart.go +++ b/commands/restart.go @@ -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 } diff --git a/commands/start.go b/commands/start.go index 9719238..b5bc6a4 100644 --- a/commands/start.go +++ b/commands/start.go @@ -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. @@ -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") @@ -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") diff --git a/commands/stop.go b/commands/stop.go index c0b2263..e01a4d5 100644 --- a/commands/stop.go +++ b/commands/stop.go @@ -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("") diff --git a/commands/upgrade.go b/commands/upgrade.go index cac3d39..1c6127d 100644 --- a/commands/upgrade.go +++ b/commands/upgrade.go @@ -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)) @@ -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)