Merge lp:~bcsaller/pyjuju/lxc-killpid into lp:pyjuju
Proposed by
Benjamin Saller
Status: | Work in progress | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~bcsaller/pyjuju/lxc-killpid | ||||
Merge into: | lp:pyjuju | ||||
Diff against target: |
122 lines (+17/-28) 3 files modified
juju/lib/service.py (+10/-17) juju/providers/local/__init__.py (+2/-1) juju/providers/local/agent.py (+5/-10) |
||||
To merge this branch: | bzr merge lp:~bcsaller/pyjuju/lxc-killpid | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Kapil Thangavelu (community) | Needs Fixing | ||
Review via email: mp+120497@code.launchpad.net |
Description of the change
Properly destroy local provider environment
Stop using temp dir to hold pid
Properly pass juju-directory on destory-environment
To post a comment you must log in.
Unmerged revisions
- 564. By Benjamin Saller
-
properly kill daemons, properly pass juju_dir on destroy-
environment/ container destruction
Reviewers: mp+120497_ code.launchpad. net,
Message:
Please take a look.
Description:
Properly destroy local provider environment
Stop using temp dir to hold pid
Properly pass juju-directory on destory-environment
https:/ /code.launchpad .net/~bcsaller/ juju/lxc- killpid/ +merge/ 120497
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6460118/
Affected files: local/_ _init__ .py local/agent. py
A [revision details]
M juju/lib/service.py
M juju/providers/
M juju/providers/
Index: [revision details]
=== 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: <email address hidden>
+New revision: <email address hidden>
Index: juju/lib/service.py service. py'
=== modified file 'juju/lib/
--- juju/lib/service.py 2012-08-03 12:28:29 +0000
+++ juju/lib/service.py 2012-08-21 04:52:21 +0000
@@ -8,14 +8,18 @@
def _check_call(args, env=None, output_path=None): output_ path, os.W_OK):
- if not output_path:
- output_path = os.devnull
+ if not output_path or not os.access(
+ f = open(os.devnull, "a")
+ else:
+ f = open(output_path, "a")
- with open(output_path, "a") as f: check_call(
stdout= f.fileno( ), stderr=f.fileno(),
env=env)
+ try:
return subprocess.
args,
+ finally:
+ f.close()
def _cat(filename, use_sudo=False):
self. _description = None
self. _environ = None
self. _command = None
@@ -43,20 +47,11 @@
- self._output_path = None
+ self.output_path = None
self._pid = None
- @property
- def output_path(self):
- if self._output_path is not None:
- return self._output_path
- return "/tmp/%s.output" % self._name
-
- @output_path.setter
- def output_path(self, path):
- self._output_path = path
def set_description (self, description):
self. _description = description
@@ -78,7 +73,7 @@
@ inlineCallbacks output( self): exists( self.output_ path): exists( self.output_ path): output( ) output( )
def _trash_
- if os.path.
+ if self.output_path and os.path.
# Just using os.unlink will fail when we're running TEST_SUDO
# tests which hit this code path (because root will own
# self.output_path)
@@ -115,14 +110,12 @@
def destroy(self):
if (yield self.is_running()):
yield self._call("kill", self.get_pid())
- yield self._trash_
+ yield self._trash_
def get_pid(self):
return self._pid
if self._pid != None:
- if not os.path. exists( self._pid_ path): _pid_path, use_sudo= self._use_ sudo)
return None
- return None
r, data = _cat(self.
if r != 0:
Index: juju/providers/ local/_ _init__ .py /local/ __init_ _.py' local/_ _init__ .py 2012-07-20 17:28:17 +0000 local/_ _in...
=== modified file 'juju/providers
--- juju/providers/
+++ juju/providers/