@@ -50,7 +50,7 @@ func newDeployCommand(dockerCli command.Cli, common *commonOptions) *cobra.Comma
5050 if err != nil {
5151 return err
5252 }
53- return RunDeploy (dockerCli , cmd .Flags (), config , commonOrchestrator , opts )
53+ return RunDeploy (dockerCli , cmd .Flags (), config , common , opts )
5454 },
5555 }
5656
@@ -74,17 +74,8 @@ func newDeployCommand(dockerCli command.Cli, common *commonOptions) *cobra.Comma
7474}
7575
7676// RunDeploy performs a stack deploy against the specified orchestrator
77- func RunDeploy (dockerCli command.Cli , flags * pflag.FlagSet , config * composetypes.Config , commonOrchestrator command.Orchestrator , opts options.Deploy ) error {
78- switch {
79- case commonOrchestrator .HasAll ():
80- return errUnsupportedAllOrchestrator
81- case commonOrchestrator .HasKubernetes ():
82- kli , err := kubernetes .WrapCli (dockerCli , kubernetes .NewOptions (flags , commonOrchestrator ))
83- if err != nil {
84- return errors .Wrap (err , "unable to deploy to Kubernetes" )
85- }
86- return kubernetes .RunDeploy (kli , opts , config )
87- default :
88- return swarm .RunDeploy (dockerCli , opts , config )
89- }
77+ func RunDeploy (dockerCli command.Cli , flags * pflag.FlagSet , config * composetypes.Config , common * commonOptions , opts options.Deploy ) error {
78+ return runOrchestratedCommand (dockerCli , flags , common ,
79+ func () error { return swarm .RunDeploy (dockerCli , opts , config ) },
80+ func (kli * kubernetes.KubeCli ) error { return kubernetes .RunDeploy (kli , opts , config ) })
9081}
0 commit comments