Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1224)

Unified Diff: environs/cloudinit/cloudinit.go

Issue 53220043: EnsureMongoServer function for MachineAgent
Patch Set: EnsureMongoServer function for MachineAgent Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cmd/jujud/machine_test.go ('k') | provider/local/config.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: environs/cloudinit/cloudinit.go
=== modified file 'environs/cloudinit/cloudinit.go'
--- environs/cloudinit/cloudinit.go 2013-12-18 15:15:23 +0000
+++ environs/cloudinit/cloudinit.go 2014-01-16 21:36:55 +0000
@@ -284,9 +284,7 @@
c.AddPackage("mongodb-server")
certKey := string(cfg.StateServerCert) + string(cfg.StateServerKey)
c.AddFile(cfg.dataFile("server.pem"), certKey, 0600)
- if err := cfg.addMongoToBoot(c); err != nil {
- return err
- }
+
// We temporarily give bootstrap-state a directory
// of its own so that it can get the state info via the
// same mechanism as other jujud commands.
@@ -381,9 +379,7 @@
return nil, err
}
acfg.SetValue(agent.AgentServiceName, machineAgentServiceName(tag))
- if cfg.StateServer {
- acfg.SetValue(agent.MongoServiceName, mongoServiceName)
- }
+
cmds, err := acfg.WriteCommands()
if err != nil {
return nil, err
@@ -392,8 +388,6 @@
return acfg, nil
}
-const mongoServiceName = "juju-db"
-
func machineAgentServiceName(tag string) string {
return "jujud-" + tag
}
@@ -417,28 +411,6 @@
return nil
}
-func (cfg *MachineConfig) addMongoToBoot(c *cloudinit.Config) error {
- dbDir := path.Join(cfg.DataDir, "db")
- c.AddScripts(
- "mkdir -p "+dbDir+"/journal",
- "chmod 0700 "+dbDir,
- // Otherwise we get three files with 100M+ each, which takes time.
- "dd bs=1M count=1 if=/dev/zero of="+dbDir+"/journal/prealloc.0",
- "dd bs=1M count=1 if=/dev/zero of="+dbDir+"/journal/prealloc.1",
- "dd bs=1M count=1 if=/dev/zero of="+dbDir+"/journal/prealloc.2",
- )
-
- name := mongoServiceName
- conf := upstart.MongoUpstartService(name, cfg.DataDir, dbDir, cfg.StatePort)
- cmds, err := conf.InstallCommands()
- if err != nil {
- return fmt.Errorf("cannot make cloud-init upstart script for the state database: %v", err)
- }
- c.AddRunCmd(cloudinit.LogProgressCmd("Starting MongoDB server (%s)", name))
- c.AddScripts(cmds...)
- return nil
-}
-
// versionDir converts a tools URL into a name
// to use as a directory for storing the tools executables in
// by using the last element stripped of its extension.
« no previous file with comments | « cmd/jujud/machine_test.go ('k') | provider/local/config.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b