@@ -33,6 +33,7 @@ import (
33
33
"github.com/openshift/origin/pkg/oc/bootstrap/docker/dockermachine"
34
34
"github.com/openshift/origin/pkg/oc/bootstrap/docker/errors"
35
35
"github.com/openshift/origin/pkg/oc/bootstrap/docker/host"
36
+ "github.com/openshift/origin/pkg/oc/bootstrap/docker/localcmd"
36
37
"github.com/openshift/origin/pkg/oc/bootstrap/docker/openshift"
37
38
"github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
38
39
osclientcmd "github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
@@ -334,6 +335,7 @@ func (c *CommonStartConfig) Complete(f *osclientcmd.Factory, cmd *cobra.Command)
334
335
c .addTask (simpleTask ("Checking OpenShift client" , c .CheckOpenShiftClient ))
335
336
336
337
c .addTask (conditionalTask ("Create Docker machine" , c .CreateDockerMachine , func () bool { return c .ShouldCreateDockerMachine }))
338
+
337
339
// Get a Docker client.
338
340
// If a Docker machine was specified, make sure that the machine is running.
339
341
// Otherwise, use environment variables.
@@ -342,6 +344,8 @@ func (c *CommonStartConfig) Complete(f *osclientcmd.Factory, cmd *cobra.Command)
342
344
// Check that we have the minimum Docker version available to run OpenShift
343
345
c .addTask (simpleTask ("Checking Docker version" , c .CheckDockerVersion ))
344
346
347
+ c .addTask (conditionalTask ("Checking prerequisites for port forwarding" , c .CheckPortForwardingPrerequisites , func () bool { return c .PortForwarding }))
348
+
345
349
// Check for an OpenShift container. If one exists and is running, exit.
346
350
// If one exists but not running, delete it.
347
351
c .addTask (simpleTask ("Checking for existing OpenShift container" , c .CheckExistingOpenShiftContainer ))
@@ -739,6 +743,18 @@ func (c *CommonStartConfig) CheckDockerVersion(out io.Writer) error {
739
743
return nil
740
744
}
741
745
746
+ // CheckPortForwardingPrerequisites checks that socat is installed when port forwarding is enabled
747
+ // Socat needs to be installed manually on MacOS
748
+ func (c * CommonStartConfig ) CheckPortForwardingPrerequisites (out io.Writer ) error {
749
+ err := localcmd .New ("socat" ).Args ("-V" ).Run ()
750
+ if err != nil {
751
+ glog .V (2 ).Infof ("Error from socat command execution: %v" , err )
752
+ fmt .Fprintf (out , "WARNING: Port forwarding requires socat command line utility." +
753
+ "Cluster public ip may not be reachable. Please make sure socat installed in your operating system \n " )
754
+ }
755
+ return nil
756
+ }
757
+
742
758
func (c * CommonStartConfig ) EnsureHostDirectories (io.Writer ) error {
743
759
return c .HostHelper ().EnsureHostDirectories (! c .UseNsenterMount )
744
760
}
0 commit comments