Add helper for checking the generic driver name
parent
a0d2c1a0c5
commit
a3b3b55ac0
|
@ -309,7 +309,7 @@ func deleteProfile(profile *config.Profile) error {
|
|||
return DeletionError{Err: delErr, Errtype: MissingProfile}
|
||||
}
|
||||
|
||||
if err == nil && (driver.BareMetal(cc.Driver) || cc.Driver == driver.Generic) {
|
||||
if err == nil && (driver.BareMetal(cc.Driver) || driver.IsGeneric(cc.Driver)) {
|
||||
if err := uninstallKubernetes(api, *cc, cc.Nodes[0], viper.GetString(cmdcfg.Bootstrapper)); err != nil {
|
||||
deletionError, ok := err.(DeletionError)
|
||||
if ok {
|
||||
|
|
|
@ -306,7 +306,7 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
if driver.IsVM(driverName) && driverName != driver.Generic {
|
||||
if driver.IsVM(driverName) && !driver.IsGeneric(driverName) {
|
||||
url, err := download.ISO(viper.GetStringSlice(isoURL), cmd.Flags().Changed(isoURL))
|
||||
if err != nil {
|
||||
return node.Starter{}, errors.Wrap(err, "Failed to cache ISO")
|
||||
|
|
|
@ -99,7 +99,7 @@ func MachineType(name string) string {
|
|||
return "container"
|
||||
}
|
||||
|
||||
if name == Generic {
|
||||
if IsGeneric(name) {
|
||||
return "bare metal machine"
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,11 @@ func BareMetal(name string) bool {
|
|||
return name == None || name == Mock
|
||||
}
|
||||
|
||||
// IsGeneric checks if the driver is generic
|
||||
func IsGeneric(name string) bool {
|
||||
return name == Generic
|
||||
}
|
||||
|
||||
// NeedsPortForward returns true if driver is unable provide direct IP connectivity
|
||||
func NeedsPortForward(name string) bool {
|
||||
if !IsKIC(name) {
|
||||
|
|
|
@ -129,7 +129,7 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No
|
|||
}
|
||||
}
|
||||
|
||||
if h.Driver.DriverName() == driver.Generic {
|
||||
if driver.IsGeneric(h.Driver.DriverName()) {
|
||||
if s == state.Running {
|
||||
out.Step(style.Running, `Using the {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": cc.Name, "machine_type": machineType})
|
||||
} else {
|
||||
|
|
|
@ -104,7 +104,7 @@ func fastDetectProvisioner(h *host.Host) (libprovision.Provisioner, error) {
|
|||
switch {
|
||||
case driver.IsKIC(d):
|
||||
return provision.NewUbuntuProvisioner(h.Driver), nil
|
||||
case driver.BareMetal(d), d == driver.Generic:
|
||||
case driver.BareMetal(d), driver.IsGeneric(d):
|
||||
return libprovision.DetectProvisioner(h.Driver)
|
||||
default:
|
||||
return provision.NewBuildrootProvisioner(h.Driver), nil
|
||||
|
|
|
@ -168,7 +168,7 @@ func createHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (
|
|||
return h, errors.Wrap(err, "post-start")
|
||||
}
|
||||
|
||||
if h.Driver.DriverName() == driver.Generic {
|
||||
if driver.IsGeneric(h.Driver.DriverName()) {
|
||||
if _, err := h.RunSSHCommand(fmt.Sprintf("sudo usermod -aG docker %s", h.Driver.GetSSHUsername())); err != nil {
|
||||
return h, errors.Wrap(err, "usermod")
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ func postStartSetup(h *host.Host, mc config.ClusterConfig) error {
|
|||
if driver.BareMetal(mc.Driver) {
|
||||
showLocalOsRelease()
|
||||
}
|
||||
if driver.IsVM(mc.Driver) || driver.IsKIC(mc.Driver) || mc.Driver == driver.Generic {
|
||||
if driver.IsVM(mc.Driver) || driver.IsKIC(mc.Driver) || driver.IsGeneric(mc.Driver) {
|
||||
logRemoteOsRelease(r)
|
||||
}
|
||||
return syncLocalAssets(r)
|
||||
|
|
|
@ -55,7 +55,7 @@ func stop(h *host.Host) error {
|
|||
}
|
||||
}
|
||||
|
||||
if h.DriverName == driver.Generic {
|
||||
if driver.IsGeneric(h.DriverName) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue