| 128 | } |
| 129 | |
| 130 | func LoadManifest(name string) (*Manifest, error) { |
| 131 | manifestLoaded := false |
| 132 | manifest := Manifest{} |
| 133 | |
| 134 | configPath, err := core.ConfigPath() |
| 135 | if err != nil { |
| 136 | log.Debugln("Could not retrieve config path, this is a problem...") |
| 137 | } |
| 138 | |
| 139 | manifestPath := path.Join(configPath, "manifests", name+".yml") |
| 140 | |
| 141 | if _, err := os.Stat(manifestPath); err == nil { |
| 142 | log.Debugln("Custom manifest found. Loading from path: ", manifestPath) |
| 143 | |
| 144 | data, err := ioutil.ReadFile(manifestPath) |
| 145 | if err != nil { |
| 146 | log.Debugln("Could not load custom manifest: ", err) |
| 147 | } |
| 148 | err = yaml.Unmarshal(data, &manifest) |
| 149 | if err != nil { |
| 150 | log.Debugln("Could not Ummarshal YAML data. Probably broken manifest.", err) |
| 151 | } |
| 152 | if err == nil { |
| 153 | manifestLoaded = true |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | if manifestLoaded == false { |
| 158 | log.Debugf("No custom manifest could be loaded for %s, using build-in one.", name) |
| 159 | data, err := Asset("plugins/" + name + "/data/manifest.yml") |
| 160 | if err != nil { |
| 161 | return nil, err |
| 162 | } |
| 163 | err = yaml.Unmarshal(data, &manifest) |
| 164 | if err != nil { |
| 165 | return nil, err |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | return &manifest, nil |
| 170 | } |
| 171 | |
| 172 | func (self *Base) Status(opts *AppConfig) (*docker.State, error) { |
| 173 | container, err := self.DockerClient.InspectContainer(opts.ContainerId) |