Created
          December 5, 2015 22:26 
        
      - 
      
- 
        Save dave-tucker/27d7aab74ff8d4d36ce2 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| log "github.com/Sirupsen/logrus" | |
| "github.com/docker/machine/commands/mcndirs" | |
| "github.com/docker/machine/libmachine" | |
| ) | |
| func GetMachines() error { | |
| api := libmachine.GetDefaultStore() | |
| api.Path = mcndirs.GetBaseDir() | |
| log.Info("Listing machines") | |
| machines, err := api.List() | |
| if err != nil { | |
| return err | |
| } | |
| log.Info("Getting host IPs...") | |
| for m := range machines { | |
| ip, err := machines[m].Driver.GetIP() | |
| if err != nil { | |
| return err | |
| } | |
| log.Infof("IP: %s", ip) | |
| } | |
| return nil | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment