Merge lp:~axwalk/juju-core/jujud-uninstall-mongo into lp:~go-bot/juju-core/trunk
Proposed by
Andrew Wilkins
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2083 |
Proposed branch: | lp:~axwalk/juju-core/jujud-uninstall-mongo |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
196 lines (+75/-11) 6 files modified
agent/agent.go (+2/-0) cmd/jujud/machine.go (+29/-7) cmd/jujud/machine_test.go (+6/-2) environs/cloudinit/cloudinit.go (+13/-2) environs/cloudinit/cloudinit_test.go (+23/-0) provider/local/environ.go (+2/-0) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/jujud-uninstall-mongo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+195565@code.launchpad.net |
Commit message
cmd/jujud: remove mongo and data-dir on teardown
Two new agent.conf keys are introduced:
- AGENT_SERVICE_NAME, and
- MONGO_SERVICE_NAME.
The former is always added, the latter only
for state servers. For backwards-
we fall back to os.Getenv(
AGENT_SERVICE_NAME.
Description of the change
cmd/jujud: remove mongo and data-dir on teardown
Two new agent.conf keys are introduced:
- AGENT_SERVICE_NAME, and
- MONGO_SERVICE_NAME.
The former is always added, the latter only
for state servers. For backwards-
we fall back to os.Getenv(
AGENT_SERVICE_NAME.
To post a comment you must log in.
Reviewers: mp+195565_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/jujud: remove mongo and data-dir on teardown
Note: this does not remove the services when
using the local provider, as it gives the services
non-standard names. It doesn't have any negative
effects, either, unless you're running the local
provider on a machine provisioned with Juju; but
that's not really sane is it?
https:/ /code.launchpad .net/~axwalk/ juju-core/ jujud-uninstall -mongo/ +merge/ 195565
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/28270043/
Affected files (+38, -11 lines): machine. go machine_ test.go cloudinit/ cloudinit. go
A [revision details]
M cmd/jujud/
M cmd/jujud/
M environs/
M upstart/service.go
Index: [revision details] 20131118065206- jpp233o069gz877 4
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: upstart/service.go service. go'
=== modified file 'upstart/
--- upstart/service.go 2013-09-18 01:25:45 +0000
+++ upstart/service.go 2013-11-18 09:36:25 +0000
@@ -13,6 +13,10 @@
const (
maxMongoFiles = 65000
maxAgentFiles = 20000
+
+ // MongoServiceName is the default name of the upstart
+ // service that runs mongod for Juju.
+ MongoServiceName = "juju-db"
)
// MongoUpstartService returns the upstart config for the mongo state
service.
@@ -40,6 +44,12 @@
}
}
+// MachineAgentSer viceName returns the upstart service name for viceName( tag string) string { tartService returns the upstart config for a machine tartService( name, toolsDir, dataDir, logDir, tag,
+// a machine agent with the given tag.
+func MachineAgentSer
+ return "jujud-" + tag
+}
+
// MachineAgentUps
agent
// based on the tag and machineId passed in.
func MachineAgentUps
machineId string, env map[string]string) *Conf {
Index: cmd/jujud/ machine. go machine. go' machine. go 2013-10-02 23:18:21 +0000 machine. go 2013-11-18 09:36:25 +0000 g(a.MachineId)
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -304,13 +304,23 @@
return names.MachineTa
}
-func (m *MachineAgent) uninstallAgent() error { "UPSTART_ JOB") NewService( name).Remove( ) NewService( upstart. MachineAgentSer viceName( a.Conf. config. Tag())) NewService( upstart. MongoServiceNam e) StopAndRemove( ); err != nil {
- // TODO(axw) get this from agent config when it's available
- name := os.Getenv(
- if name != "" {
- return upstart.
- }
- return nil
+func (a *MachineAgent) uninstallAgent() error {
+ // NOTE: this will not stop/remove upstart services
+ // for the local provider (only), which has different
+ // service names for different users/environments.
+ service :=
upstart.
+ if err := service.Remove(); err != nil {
+ return err
+ }
+ // The machine agent may terminate without knowing its jobs,
+ // for example if the machine's entry in state was removed.
+ // Thus, we do not rely on jobs here, and instead just check
+ // if the upstart config exists.
+ service = upstart.
+ if err := service.
+ return err
+ }
+ return os....