chore: enable type checking cloudinit/distros/__init__.py#6646
chore: enable type checking cloudinit/distros/__init__.py#6646blackboxsw merged 6 commits intocanonical:mainfrom
Conversation
| @classmethod | ||
| def reload_init(cls, rcs=None): | ||
| """ | ||
| Reload systemd startup daemon. | ||
| May raise ProcessExecutionError | ||
| """ | ||
| init_cmd = cls.init_cmd | ||
| if cls.uses_systemd() or "systemctl" in init_cmd: | ||
| cmd = [init_cmd, "daemon-reload"] | ||
| return subp.subp(cmd, capture=True, rcs=rcs) | ||
|
|
There was a problem hiding this comment.
This has only one call site, and in that context this code is a no-op. We can delete this function.
There was a problem hiding this comment.
I still think we can delete the method from the parent class as it is never called. freebsd's reload_init method is called instead and that is the only distro taking advantage of any supplemental functionality to force a reload of main RC services.
| """ | ||
| init_cmd = cls.init_cmd | ||
| if cls.uses_systemd() or "systemctl" in init_cmd: | ||
| cmd = [init_cmd, "daemon-reload"] |
There was a problem hiding this comment.
If this had ever run, this would have thrown errors when calling subp because this creates a data structure like this:
[["systemctl"], "daemon-reload"]
There was a problem hiding this comment.
Agreed to drop this from parent Distro class, it's only used by FreeBSD which has its own subclass-local definition.
blackboxsw
left a comment
There was a problem hiding this comment.
Minor suggestion to keep the cloud.distro.reload_init() call in the BSD path of cc_rsyslog. Otherwise the rest looks good.
Proposed Commit Message
Additional Context
The primary benefit of this change is the increased mypy coverage in a core module for future changes.
See comments below that explain the changes.
Merge type