1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Rename 'GraphPath' to the more logical 'Root'. This does not affect users except for a slight text change in the usage messge

This commit is contained in:
Solomon Hykes 2013-10-23 08:09:16 +00:00
parent 1b8eef4efb
commit 7e691e11b0
6 changed files with 17 additions and 19 deletions

View file

@ -8,9 +8,7 @@ import (
// FIXME: separate runtime configuration from http api configuration
type DaemonConfig struct {
Pidfile string
// FIXME: don't call this GraphPath, it doesn't actually
// point to /var/lib/docker/graph, which is confusing.
GraphPath string
Root string
ProtoAddresses []string
AutoRestart bool
EnableCors bool
@ -26,7 +24,7 @@ type DaemonConfig struct {
func ConfigGetenv(job *engine.Job) *DaemonConfig {
var config DaemonConfig
config.Pidfile = job.Getenv("Pidfile")
config.GraphPath = job.Getenv("GraphPath")
config.Root = job.Getenv("Root")
config.AutoRestart = job.GetenvBool("AutoRestart")
config.EnableCors = job.GetenvBool("EnableCors")
if dns := job.Getenv("Dns"); dns != "" {

View file

@ -34,7 +34,7 @@ func main() {
flAutoRestart := flag.Bool("r", true, "Restart previously running containers")
bridgeName := flag.String("b", "", "Attach containers to a pre-existing network bridge. Use 'none' to disable container networking")
pidfile := flag.String("p", "/var/run/docker.pid", "File containing process PID")
flGraphPath := flag.String("g", "/var/lib/docker", "Path to graph storage base dir.")
flRoot := flag.String("g", "/var/lib/docker", "Path to use as the root of the docker runtime.")
flEnableCors := flag.Bool("api-enable-cors", false, "Enable CORS requests in the remote api.")
flDns := flag.String("dns", "", "Set custom dns servers")
flHosts := utils.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
@ -71,7 +71,7 @@ func main() {
flag.Usage()
return
}
eng, err := engine.New(*flGraphPath)
eng, err := engine.New(*flRoot)
if err != nil {
log.Fatal(err)
}
@ -80,7 +80,7 @@ func main() {
log.Fatal(err)
}
job.Setenv("Pidfile", *pidfile)
job.Setenv("GraphPath", *flGraphPath)
job.Setenv("Root", *flRoot)
job.SetenvBool("AutoRestart", *flAutoRestart)
job.SetenvBool("EnableCors", *flEnableCors)
job.Setenv("Dns", *flDns)

View file

@ -582,21 +582,21 @@ func NewRuntime(config *DaemonConfig) (*Runtime, error) {
}
func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
runtimeRepo := path.Join(config.GraphPath, "containers")
runtimeRepo := path.Join(config.Root, "containers")
if err := os.MkdirAll(runtimeRepo, 0700); err != nil && !os.IsExist(err) {
return nil, err
}
g, err := NewGraph(path.Join(config.GraphPath, "graph"))
g, err := NewGraph(path.Join(config.Root, "graph"))
if err != nil {
return nil, err
}
volumes, err := NewGraph(path.Join(config.GraphPath, "volumes"))
volumes, err := NewGraph(path.Join(config.Root, "volumes"))
if err != nil {
return nil, err
}
repositories, err := NewTagStore(path.Join(config.GraphPath, "repositories"), g)
repositories, err := NewTagStore(path.Join(config.Root, "repositories"), g)
if err != nil {
return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
}
@ -608,7 +608,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
return nil, err
}
gographPath := path.Join(config.GraphPath, "linkgraph.db")
gographPath := path.Join(config.Root, "linkgraph.db")
initDatabase := false
if _, err := os.Stat(gographPath); err != nil {
if os.IsNotExist(err) {

View file

@ -46,8 +46,8 @@ func nuke(runtime *Runtime) error {
wg.Wait()
runtime.Close()
os.Remove(filepath.Join(runtime.config.GraphPath, "linkgraph.db"))
return os.RemoveAll(runtime.config.GraphPath)
os.Remove(filepath.Join(runtime.config.Root, "linkgraph.db"))
return os.RemoveAll(runtime.config.Root)
}
func cleanup(runtime *Runtime) error {
@ -119,7 +119,7 @@ func init() {
func setupBaseImage() {
config := &DaemonConfig{
GraphPath: unitTestStoreBase,
Root: unitTestStoreBase,
AutoRestart: false,
BridgeIface: unitTestNetworkBridge,
}

View file

@ -158,7 +158,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error {
}
func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
r, err := registry.NewRegistry(srv.runtime.config.GraphPath, nil, srv.HTTPRequestFactory(nil))
r, err := registry.NewRegistry(srv.runtime.config.Root, nil, srv.HTTPRequestFactory(nil))
if err != nil {
return nil, err
}
@ -702,7 +702,7 @@ func (srv *Server) poolRemove(kind, key string) error {
}
func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, metaHeaders map[string][]string, parallel bool) error {
r, err := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders))
r, err := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders))
if err != nil {
return err
}
@ -911,7 +911,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo
out = utils.NewWriteFlusher(out)
img, err := srv.runtime.graph.Get(localName)
r, err2 := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders))
r, err2 := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders))
if err2 != nil {
return err2
}

View file

@ -67,7 +67,7 @@ func newTestRuntime(prefix string) (runtime *Runtime, err error) {
}
config := &DaemonConfig{
GraphPath: root,
Root: root,
AutoRestart: false,
}
runtime, err = NewRuntimeFromDirectory(config)