merge from trunk
This commit is contained in:
commit
2d17bfbff8
@ -1,6 +1,8 @@
|
|||||||
0.7.3:
|
0.7.3:
|
||||||
- fix omnibus chef installer (LP: #1182265) [Chris Wing]
|
- fix omnibus chef installer (LP: #1182265) [Chris Wing]
|
||||||
- small fix for OVF datasource for iso transport on non-iso9660 filesystem
|
- small fix for OVF datasource for iso transport on non-iso9660 filesystem
|
||||||
|
- determine if upstart version is suitable for
|
||||||
|
'initctl reload-configuration' (LP: #1124384). If so, then invoke it.
|
||||||
0.7.2:
|
0.7.2:
|
||||||
- add a debian watch file
|
- add a debian watch file
|
||||||
- add 'sudo' entry to ubuntu's default user (LP: #1080717)
|
- add 'sudo' entry to ubuntu's default user (LP: #1080717)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
from cloudinit import handlers
|
from cloudinit import handlers
|
||||||
from cloudinit import log as logging
|
from cloudinit import log as logging
|
||||||
@ -66,14 +67,53 @@ class UpstartJobPartHandler(handlers.Handler):
|
|||||||
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)
|
||||||
|
|
||||||
# FIXME LATER (LP: #1124384)
|
if SUITABLE_UPSTART:
|
||||||
# a bug in upstart means that invoking reload-configuration
|
|
||||||
# at this stage in boot causes havoc. So, until that is fixed
|
|
||||||
# we will not do that. However, I'd like to be able to easily
|
|
||||||
# test to see if this bug is still present in an image with
|
|
||||||
# a newer upstart. So, a boot hook could easiliy write this file.
|
|
||||||
if os.path.exists("/run/cloud-init-upstart-reload"):
|
|
||||||
# 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)
|
util.subp(["initctl", "reload-configuration"], capture=False)
|
||||||
|
|
||||||
|
|
||||||
|
def _has_suitable_upstart():
|
||||||
|
# (LP: #1124384)
|
||||||
|
# a bug in upstart means that invoking reload-configuration
|
||||||
|
# at this stage in boot causes havoc. So, try to determine if upstart
|
||||||
|
# is installed, and reloading configuration is OK.
|
||||||
|
if not os.path.exists("/sbin/initctl"):
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
(version_out, _err) = util.subp(["initctl", "version"])
|
||||||
|
except:
|
||||||
|
util.logexc(LOG, "initctl version failed")
|
||||||
|
return False
|
||||||
|
|
||||||
|
# expecting 'initctl version' to output something like: init (upstart X.Y)
|
||||||
|
if re.match("upstart 1.[0-7][\)]", version_out):
|
||||||
|
return False
|
||||||
|
if "upstart 0." in version_out:
|
||||||
|
return False
|
||||||
|
elif "upstart 1.8" in version_out:
|
||||||
|
if not os.path.exists("/usr/bin/dpkg-query"):
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
(dpkg_ver, _err) = util.subp(["dpkg-query",
|
||||||
|
"--showformat=${Version}",
|
||||||
|
"--show", "upstart"], rcs=[0, 1])
|
||||||
|
except Exception:
|
||||||
|
util.logexc(LOG, "dpkg-query failed")
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
util.subp(["dpkg", "--compare-versions", dpkg_ver, "ge", good])
|
||||||
|
print "good version"
|
||||||
|
return True
|
||||||
|
except util.ProcessExecutionError as e:
|
||||||
|
if e.exit_code is 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
util.logexc(LOG, "dpkg --compare-versions failed [%s]",
|
||||||
|
e.exit_code)
|
||||||
|
except Exception as e:
|
||||||
|
util.logexc(LOG, "dpkg --compare-versions failed")
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
SUITABLE_UPSTART = _has_suitable_upstart()
|
||||||
|
@ -35,7 +35,6 @@ class TestBuiltins(test_helpers.FilesystemMockingTestCase):
|
|||||||
None, None, None)
|
None, None, None)
|
||||||
self.assertEquals(0, len(os.listdir(up_root)))
|
self.assertEquals(0, len(os.listdir(up_root)))
|
||||||
|
|
||||||
@unittest.skip("until LP: #1124384 fixed")
|
|
||||||
def test_upstart_frequency_single(self):
|
def test_upstart_frequency_single(self):
|
||||||
# files should be written out when frequency is ! per-instance
|
# files should be written out when frequency is ! per-instance
|
||||||
new_root = self.makeDir()
|
new_root = self.makeDir()
|
||||||
@ -47,6 +46,7 @@ class TestBuiltins(test_helpers.FilesystemMockingTestCase):
|
|||||||
'upstart_dir': "/etc/upstart",
|
'upstart_dir': "/etc/upstart",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
upstart_job.SUITABLE_UPSTART = True
|
||||||
util.ensure_dir("/run")
|
util.ensure_dir("/run")
|
||||||
util.ensure_dir("/etc/upstart")
|
util.ensure_dir("/etc/upstart")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user