-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Machine.list() function to list machines #2
Conversation
To be clear, when I suggested to drop Some thoughts about the individual fields:
With these simplifications, the amount of code required drops significantly, and there's no point to having a Parser class. We can just do: machine.responseTime = parseInt(machine.responseTime) / 1e6
machine.state = machine.state.toLowerCase()
machine.activeHost = machine.activeHost === 'true'
machine.activeSwarm = machine.activeSwarm === 'true' Which also makes our code easier to grasp at first sight. As for
I went over some of the Go source code of
First off, I'm gonna refactor a bit, so that functions like If anyone is gonna be using @dikarel Sorry for the long story. If you have any quibbles with the above, LMK. I'm closing this PR, but I want to thank you for your work of course. |
Also, thanks for mentioning this:
You're right, it should be LF. |
Thanks, and apologies for misunderstanding the reqs. I would also like to suggest the following for
|
Can you clarify? Is this a known bug of |
I'm running 10-20 docker machines on VirtualBox in Windows 7; I noticed that running
I had to increase the timeout for it to work, like this: A configurable timeout option would also be useful in case of busy machines or remote machines over slow connection, as mentioned by this issue Relevant: docker/machine@02c235b |
Thanks for the explanation. I added a timeout option in e72abb6. |
@dikarel published 2.0.0. Let me know how the new features work out for you. |
It works! Thanks |
Useful for writing utilities that need to invoke docker-machine ls.
Summary
I explored docker-machine's docs, and found out that the
--format
parameter of thels
command doesn't support JSON output (e.g. can't do{{json .Name}}
). Ended up reformatting the output into tab-delimited lines instead, before parsing them into JavaScript objects.To keep the main class small enough to understand, I modularized parser logic into a separate class.
I noticed that the line endings used in the project are mixed. I assume for now that UNIX-style is the correct one, as most files in the project use UNIX-style line endings.
Tested on OS X El Capitan