tell upstart to reload configuration after writing an upstart job
Invoking 'initctl reload-configuration' is only required if inotify does not work. overlayroot does not support inotify. So, we just call initctl always, which wont hurt anything.
This commit is contained in:
parent
10f11050f4
commit
8829973e43
@ -64,3 +64,7 @@ class UpstartJobPartHandler(handlers.Handler):
|
|||||||
payload = util.dos2unix(payload)
|
payload = util.dos2unix(payload)
|
||||||
path = os.path.join(self.upstart_dir, filename)
|
path = os.path.join(self.upstart_dir, filename)
|
||||||
util.write_file(path, payload, 0644)
|
util.write_file(path, payload, 0644)
|
||||||
|
|
||||||
|
# if inotify support is not present in the root filesystem
|
||||||
|
# (overlayroot) then we need to tell upstart to re-read /etc
|
||||||
|
util.subp(["initctl", "reload-configuration"], capture=False)
|
||||||
|
@ -6,6 +6,7 @@ from mocker import MockerTestCase
|
|||||||
|
|
||||||
from cloudinit import handlers
|
from cloudinit import handlers
|
||||||
from cloudinit import helpers
|
from cloudinit import helpers
|
||||||
|
from cloudinit import util
|
||||||
|
|
||||||
from cloudinit.handlers import upstart_job
|
from cloudinit.handlers import upstart_job
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ class TestBuiltins(MockerTestCase):
|
|||||||
self.assertEquals(0, len(os.listdir(up_root)))
|
self.assertEquals(0, len(os.listdir(up_root)))
|
||||||
|
|
||||||
def test_upstart_frequency_single(self):
|
def test_upstart_frequency_single(self):
|
||||||
|
# files should be written out when frequency is ! per-instance
|
||||||
c_root = self.makeDir()
|
c_root = self.makeDir()
|
||||||
up_root = self.makeDir()
|
up_root = self.makeDir()
|
||||||
paths = helpers.Paths({
|
paths = helpers.Paths({
|
||||||
@ -41,9 +43,12 @@ class TestBuiltins(MockerTestCase):
|
|||||||
'upstart_dir': up_root,
|
'upstart_dir': up_root,
|
||||||
})
|
})
|
||||||
freq = PER_INSTANCE
|
freq = PER_INSTANCE
|
||||||
|
|
||||||
|
mock_subp = self.mocker.replace(util.subp, passthrough=False)
|
||||||
|
mock_subp(["initctl", "reload-configuration"], capture=False)
|
||||||
|
self.mocker.replay()
|
||||||
|
|
||||||
h = upstart_job.UpstartJobPartHandler(paths)
|
h = upstart_job.UpstartJobPartHandler(paths)
|
||||||
# No files should be written out when
|
|
||||||
# the frequency is ! per-instance
|
|
||||||
h.handle_part('', handlers.CONTENT_START,
|
h.handle_part('', handlers.CONTENT_START,
|
||||||
None, None, None)
|
None, None, None)
|
||||||
h.handle_part('blah', 'text/upstart-job',
|
h.handle_part('blah', 'text/upstart-job',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user