Merge pull request #1622 from rawkode/virtualbox-no-vbfs-share-flag

Added option to disable virtualbox vbfs mount of users home directory
This commit is contained in:
Nathan LeClaire 2015-08-12 13:25:18 -07:00
commit 49764bb47a
2 changed files with 13 additions and 4 deletions

View File

@ -29,6 +29,7 @@ Options:
- `--virtualbox-boot2docker-url`: The URL of the boot2docker image. Defaults to the latest available version.
- `--virtualbox-import-boot2docker-vm`: The name of a Boot2Docker VM to import.
- `--virtualbox-hostonly-cidr`: The CIDR of the host only adapter.
- `--virtualbox-no-share`: Disable the mount of your home directory
The `--virtualbox-boot2docker-url` flag takes a few different forms. By
default, if no value is specified for this flag, Machine will check locally for
@ -66,3 +67,4 @@ Environment variables and default values:
| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* |
| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` |
| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` |
| `--virtualbox-no-share` | - | `false` |

View File

@ -43,6 +43,7 @@ type Driver struct {
Boot2DockerURL string
Boot2DockerImportVM string
HostOnlyCIDR string
NoShare bool
}
func init() {
@ -91,6 +92,10 @@ func GetCreateFlags() []cli.Flag {
Value: defaultHostOnlyCIDR,
EnvVar: "VIRTUALBOX_HOSTONLY_CIDR",
},
cli.BoolFlag{
Name: "virtualbox-no-share",
Usage: "Disable the mount of your home directory",
},
}
}
@ -137,6 +142,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHUser = "docker"
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
d.NoShare = flags.Bool("virtualbox-no-share")
return nil
}
@ -307,7 +313,8 @@ func (d *Driver) Create() error {
// TODO "linux"
}
if shareDir != "" {
if shareDir != "" && !d.NoShare {
log.Debugf("setting up shareDir")
if _, err := os.Stat(shareDir); err != nil && !os.IsNotExist(err) {
return err
} else if !os.IsNotExist(err) {