1
0
mirror of https://github.com/rancher/os.git synced 2025-08-02 07:24:28 +00:00

Fixes #209: ensure that service is in /var/lib/rancher/conf if specified through a file

This commit is contained in:
wlan0 2015-05-04 10:05:40 -07:00
parent f60bb0afa4
commit a748fde371

View File

@ -3,9 +3,11 @@ package control
import (
"fmt"
"log"
"strings"
"github.com/codegangsta/cli"
"github.com/rancherio/os/config"
"github.com/rancherio/os/docker"
"github.com/rancherio/os/util"
)
@ -88,6 +90,12 @@ func enable(c *cli.Context) {
for _, service := range c.Args() {
if val, ok := cfg.ServicesInclude[service]; !ok || !val {
if strings.HasPrefix(service, "/") && !strings.HasPrefix(service, "/var/lib/rancher/conf") {
log.Fatalf("ERROR: Service should be in path /var/lib/rancher/conf")
}
if _, err := docker.LoadServiceResource(service, true, cfg); err != nil {
log.Fatalf("could not load service %s", service)
}
cfg.ServicesInclude[service] = true
changed = true
}