Tempfile was not closed, so rename opertion was failing.
Minor code refactor is done, to make function more readable.
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
Now this change ensures `config.json` is first written into a temp-file and
rename into the original file, if no errors from the FS. If ENOSPC occurs on write,
when the machine is restarted, the previous `config.json` is still available on startup.
Extended `TestStoreSave()` to check for any residual config files in the
machine directory.
Signed-off-by: Anil Belur <askb23@gmail.com>
Added compatibility for both 5.0 and 5.1 RPC plugins.
Addresses #2325
Signed-off-by: Jeff Nickoloff <jeff@allingeek.com>
modified: libmachine/drivers/plugin/register_driver.go
modified: libmachine/drivers/rpc/client_driver.go
Starting with version 15.04, ubuntu is based on systemd. The existing
ubuntu provider did not support systemd.
This commit introduce a new provider dedicated to systemd based
versions.
The previous provider is renamed to ubuntu_upstart.
Provider detection uses the /etc/os=release VERSION_ID.
Version ID is converted to a float value and then used to choose between
providers.
Unit tests are validating the provisioner compatibility.
Fixes#1891
Signed-off-by: Thomas Recloux <thomas.recloux@gmail.com>
Lint changes in SwarmCommandOptions chnaged `Ip` to `IP`.
It required change in template code also.
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
+ Download boot2docker before we stop the machine.
+ Use default(longer) timeout
+ Show b2d download progress
+ Fix typo
+ Add log before stop
Signed-off-by: David Gageot <david@gageot.net>
When attempting to connect to the docker api from the machine itself,
the TLS verification of the certificate checked against the public
IP address of the primary interface. This is undesirable on hosts
which have NAT rules that block access to that address by default.
Adding "localhost" to the list of alt_names allows the cert to be
verified and connections to localhost (either 127.0.0.1 or [::1]) to
the port to pass verification. Otherwise one would need to disable
verification just to connect to the local docker instance.
Signed-off-by: David Gageot <david@gageot.net>
This replaces the previous method of attempting to clean up servers when
an unexpected exit occurs in the client (e.g. SIGINT or panic) by a
heartbeat protocol. If the server does not hear from the connecting
client within a certain interval of time (500ms in this commit), it will
de-activate itself. This prevents dangling Docker Machine server
processes from accumulating.
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit allows downloading boot2docker releases not only from the official releases url (https://api.github.com/repos/boot2docker/boot2docker/releases) but from arbitrary github repositories that publish releases with a boot2docker.iso artifact. It also supports downloading from github enterprise.
Signed-off-by: Fabian Ruff <fabian@progra.de>
fix#2037:
when provision on CentOS 7.0, it needs to force tty allocation with multiple '-t' option.
Otherwise, the ssh command will failed with "sudo: sorry, you must have a tty to run sudo"
in SetHostname.
Signed-off-by: Xiaohui Liu <xiaohui.liu@ucloud.cn>
- Added some context to an error message - it's useful to know _which_
plugin failed when invoking the binary failed
- Replaced `json.Umarshal` with a `json.Decoder`, so that the
`UseNumber` function can be called, which prevents large integers from
being interpreted as `float64`s.
- Fixed a couple `log.Warn` calls that should've been `log.Warnf`
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
- First RPC steps
- Work on some flaws in RPC model
- Remove unused TLS settings from Engine and Swarm options
- Add code to correctly encode data over the network
- Add client driver for RPC
- Rename server driver file
- Start to make marshal make sense
- Fix silly RPC method args and add client
- Fix some issues with RPC calls, and marshaling
- Simplify plugin main.go
- Move towards 100% plugin in CLI
- Ensure that plugin servers are cleaned up properly
- Make flag parsing for driver flags work properly
Includes some work carried from @dmp42 updating the build process and
tests to use the new method.
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
Also, a few various cleanups are bundled:
1. Only call GetDriver() once to get the object in provision/utils.go
2. SSH command wrapper will return the error and let the consumer decide
what to do with it instead of bailing automatically on non-255
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
- Clear out some cruft tightly coupling libmachine to filestore
- Comment out drivers other than virtualbox for now
- Change way too many things
- Mostly, break out the code to be more modular.
- Destroy all traces of "provider" in its current form. It will be
brought back as something more sensible, instead of something which
overlaps in function with both Host and Store.
- Fix mis-managed config passthru
- Remove a few instances of state stored in env vars
- This should be explicitly communicated in Go-land, not through the
shell.
- Rename "store" module to "persist"
- This is done mostly to avoid confusion about the fact that a concrete
instance of a "Store" interface is oftentimes referred to as "store" in
the code.
- Rip out repetitive antipattern for getting store
- This replaces the previous repetive idiom for getting the cert info, and
consequently the store, with a much less repetitive idiom.
- Also, some redundant methods in commands.go for accessing hosts have
either been simplified or removed entirely.
- First steps towards fixing up tests
- Test progress continues
- Replace unit tests with integration tests
- MAKE ALL UNIT TESTS PASS YAY
- Add helper test files
- Don't write to disk in libmachine/host
- Heh.. coverage check strikes again
- Fix remove code
- Move cert code around
- Continued progress: simplify Driver
- Fixups and make creation work with new model
- Move drivers module inside of libmachine
- Move ssh module inside of libmachine
- Move state module to libmachine
- Move utils module to libmachine
- Move version module to libmachine
- Move log module to libmachine
- Modify some constructor methods around
- Change Travis build dep structure
- Boring gofmt fix
- Add version module
- Move NewHost to store
- Update some boring cert path infos to make API easier to use
- Fix up some issues around the new model
- Clean up some cert path stuff
- Don't use shady functions to get store path :D
- Continue artifact work
- Fix silly machines dir bug
- Continue fixing silly path issues
- Change up output of vbm a bit
- Continue work to make example go
- Change output a little more
- Last changes needed to make create finish properly
- Fix config.go to use libmachine
- Cut down code duplication and make both methods work with libmachine
- Add pluggable logging implementation
- Return error when machine already in desired state
- Update example to show log method
- Fix file:// bug
- Fix Swarm defaults
- Remove unused TLS settings from Engine and Swarm options
- Remove spurious error
- Correct bug detecting if migration was performed
- Fix compilation errors from tests
- Fix most of remaining test issues
- Fix final silly bug in tests
- Remove extraneous debug code
- Add -race to test command
- Appease the gofmt
- Appease the generate coverage
- Making executive decision to remove Travis coverage check
In the early days I thought this would be a good idea because it would
encourage people to write tests in case they added a new module. Well,
in fact it has just turned into a giant nuisance and made refactoring
work like this even more difficult.
- Move Get to Load
- Move HostListItem code to CLI
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit makes no changes to code execution, but rather resolves some
`go vet` errors, the majority of which relate to `fatal` being used
instead of `fatalf` during testing.
Signed-off-by: Matt McNaughton <mattjmcnaughton@gmail.com>
Fix https://github.com/docker/machine/issues/1651
As pointed out in the issue above, the `active` and `ls` commands used
different methods for determing the active machine. This commit defines
a single method on the `host` struct called `IsActive` which provides
a uniform check for machine activness. `IsActive` returns true only
if `DOCKER_HOST == url` and the state is not stopped - previously the
`active` command only checked the url.
* Add a single `host` method `IsActive` for determining if a machine is
active.
Signed-off-by: Matt McNaughton <mattjmcnaughton@gmail.com>
If the lines don't split cleanly (occasionally STDERR gets mixed in, for
instance, due to our current SSH output setup), we should simply
log.Warn in the output instead of bailing completely.
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>