func getProject(args []string, st store.Store) (*Project, error) { var id string var err error if len(args) == 0 { // Get main project id, err = st.Read("main_project", "") if err != nil { return nil, err } } else { id = args[0] // Try by name if realId, err := st.Read(id, "names"); err == nil { id = realId } } p, err := GetProject(id, st) if err != nil { return nil, errors.New("Project does not exists") } if !p.Running() { return nil, errors.New("Project is not running") } log.Debugln("Project:", p.ID) return p, nil }
func New(st store.Store) (sw Swarm, err error) { addr, err := st.Read("manager", "cluster/docker/swarm") if err != nil { return } eng, err := docker.New("tcp://"+addr, "") if err != nil { return } sw = Swarm{Store: st, engine: eng} return }