Merge lp:~larsks/cloud-init/fix-systemd-detection into lp:~cloud-init-dev/cloud-init/trunk
Proposed by
Lars Kellogg-Stedman
Status: | Merged |
---|---|
Merged at revision: | 1112 |
Proposed branch: | lp:~larsks/cloud-init/fix-systemd-detection |
Merge into: | lp:~cloud-init-dev/cloud-init/trunk |
Diff against target: |
102 lines (+37/-12) 4 files modified
cloudinit/distros/__init__.py (+8/-0) cloudinit/distros/rhel.py (+0/-8) tests/unittests/helpers.py (+6/-4) tests/unittests/test_distros/test_generic.py (+23/-0) |
To merge this branch: | bzr merge lp:~larsks/cloud-init/fix-systemd-detection |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dan Watkins | Approve | ||
Joshua Harlow | Pending | ||
Review via email: mp+260885@code.launchpad.net |
Description of the change
check for systemd using sd_booted() semantics
The existing cloud-init code determines if systemd is in use by looking at the
distribution name and version. This is prone to error because:
- RHEL derivatives other than CentOS (e.g., Scientific Linux) will fail this test, and
- Distributions that are not derived from RHEL also use systemd
This patch makes cloud-init use the same logic that is used in systemd's
sd_booted() method
(http://
To post a comment you must log in.
Hi Lars,
Thanks for taking the time to do this, this looks like a good improvement.
Some tests for this would be good, to ensure that we don't regress here[0]. TestGenericDistro in tests/unittests /test_distros/ test_generic. py already has the means to do filesystem mocking in place, so it shouldn't be too painful.
Dan
[0] If I weren't looking at the code too carefully, I'd replace what you've written with os.path.isdir; but that would be incorrect because it follows symbolic links. Having something that makes us notice if someone does this would be valuable.