Log generic warning on non-systemd systems.#1450
Conversation
| cloud = self.tmp_cloud(distro="ubuntu") | ||
| cloud.distro.init_cmd = ["service"] |
There was a problem hiding this comment.
The PR in 1449, which only just landed while you were working on this PR, refactored some unittests to use pytest instead of subclassing from CiTestCase. #1449 provided a parameterized TestHandleSSHPwauth test case test_no_restart_when_service_is_not_running. Would these new tests make more sense if parameterized in either TestHandleSSHPwauth.test_no_restart_when_service_is_not_running or a new parameterized testcase instead of separate unittests?
Two other minor points:
- generally in unittests, I think we want to start avoiding calls to
self.tmp_cloudand prefertests.unittests.util.get_cloudinstead as we try to retired tmp_cloud (and CiTestCase) where possible. - I don't think we need to set
cloud.distro.init_cmd = ["service"]on ubuntu distro because default isinit_cmd = ["service"]and this only gets reset to "systemctl" if uses_systemd == True, which you've mocked in this test.
There was a problem hiding this comment.
Sorry for breaking the integration tests and thanks for pointing out the updates.
I have parametrized the tests.
If the SSH status is checked in a non-systemd system, do not distinguish between service statuses and log a generic warning as we cannot expect status exit codes fulfilling any convention.
08913c7 to
643a6fd
Compare
|
@TheRealFalcon this PR is ready now. Thanks. |
There was a problem hiding this comment.
LGTM, thanks for your flexibility on this!
Since @blackboxsw requested changes, I'll wait until he gives his approval.
|
@blackboxsw @TheRealFalcon. This change now means I get the following on the console for Alpine Linux systems (openrc/busybox init-based) where previously I did not: This is because the sshd service is started later in the boot sequence. Also note that I have "ssh_pwauth: False" defined in /etc/cloud/cloud.cfg |
@dermotbradley I think we could fix this by:
Let me prepare a PR. |
If the SSH status is checked in a non-systemd system, do not
distinguish between service statuses and log a generic warning
as we cannot expect status exit codes fulfilling any convention.
Proposed Commit Message
Additional Context
#1422 (comment)
Checklist: