(args []string)
| 51 | } |
| 52 | |
| 53 | func (cmd SSHCommand) Execute(args []string) error { |
| 54 | |
| 55 | err := cmd.SharedActor.CheckTarget(true, true) |
| 56 | if err != nil { |
| 57 | return err |
| 58 | } |
| 59 | |
| 60 | ttyOption, err := cmd.EvaluateTTYOption() |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | var forwardSpecs []sharedaction.LocalPortForward |
| 66 | for _, spec := range cmd.LocalPortForwardSpecs { |
| 67 | forwardSpecs = append(forwardSpecs, sharedaction.LocalPortForward(spec)) |
| 68 | } |
| 69 | |
| 70 | sshAuth, warnings, err := cmd.Actor.GetSecureShellConfigurationByApplicationNameSpaceProcessTypeAndIndex( |
| 71 | cmd.RequiredArgs.AppName, |
| 72 | cmd.Config.TargetedSpace().GUID, |
| 73 | cmd.ProcessType, |
| 74 | cmd.ProcessIndex, |
| 75 | ) |
| 76 | cmd.UI.DisplayWarnings(warnings) |
| 77 | if err != nil { |
| 78 | return err |
| 79 | } |
| 80 | |
| 81 | err = cmd.SSHActor.ExecuteSecureShell( |
| 82 | cmd.SSHClient, |
| 83 | sharedaction.SSHOptions{ |
| 84 | Commands: cmd.Commands, |
| 85 | Endpoint: sshAuth.Endpoint, |
| 86 | HostKeyFingerprint: sshAuth.HostKeyFingerprint, |
| 87 | LocalPortForwardSpecs: forwardSpecs, |
| 88 | Passcode: sshAuth.Passcode, |
| 89 | SkipHostValidation: cmd.SkipHostValidation, |
| 90 | SkipRemoteExecution: cmd.SkipRemoteExecution, |
| 91 | TTYOption: ttyOption, |
| 92 | Username: sshAuth.Username, |
| 93 | }) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | // EvaluateTTYOption determines which TTY options are mutually exclusive and |
| 102 | // returns an error accordingly. |
nothing calls this directly
no test coverage detected