Source: waagent
Version: 2.15.0.1-1
Usertags: pidof-without-procps
Dear maintainer(s) of waagent,
it appears that waagent uses `pidof` in its testsuite, or that
at least one of its binary packages uses `pidof` at runtime.
Historically, `pidof` was provided by the Essential package
`sysvinit-tools`, making an explicit dependency unnecessary. However
`pidof` will soon be moved to `procps` and will no longer be part of
the Essential set.
Please add an explicit dependency on `procps`:
* via the `Depends:` field of all binary packages of waagent
that use `pidof` at runtime;
* via the `Build-Depends:` field of waagent, if `pidof` is
used in tests run at build-time;
* via the `Depends:` field of `debian/control/tests`, if `pidof` is
used in autopkgtests.
To prevent any disruption for users of waagent, please add
this dependency now, before `pidof` is moved from `sysvinit-utils` to
`procps`. Alternatively, you could remove all uses of `pidof`.
It is believed that waagent uses `pidof` due to the following
code snippets:
```
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/ubuntu.py
# Override
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "dhclient3"])
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/default.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "dhclient"])
def set_hostname(self, hostname):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/bigip.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["/sbin/pidof", "dhclient"])
def set_hostname(self, hostname):
path: waagent_2.12.0.2-4/tests/ga/test_env.py
assert_warnings(1)
with
patch("azurelinuxagent.common.osutil.default.shellutil.run_command",
side_effect=lambda _: self.shellutil_run_command(["pidof",
"non-existing-process"])):
# it should log the new error
pids = monitor_dhcp_client_restart._get_dhcp_client_pid()
path: waagent_2.12.0.2-4/tests/ga/test_env.py
def
test_get_dhcp_client_pid_should_return_an_empty_list_and_log_a_warning_when_dhcp_client_is_not_running(self):
with
patch("azurelinuxagent.common.osutil.default.shellutil.run_command",
side_effect=lambda _: self.shellutil_run_command(["pidof",
"non-existing-process"])):
with patch('azurelinuxagent.common.logger.Logger.warn') as
mock_warn:
pids =
MonitorDhcpClientRestart(get_osutil())._get_dhcp_client_pid()
path: waagent_2.12.0.2-4/tests/ga/test_env.py
self.assertEqual("Dhcp client is not running.", args[0])
with
patch("azurelinuxagent.common.osutil.default.shellutil.run_command",
side_effect=lambda _: self.shellutil_run_command(["pidof",
"non-existing-process"])):
# it should log the first error
pids = monitor_dhcp_client_restart._get_dhcp_client_pid()
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/openwrt.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", self.dhclient_name])
def get_nic_state(self, as_string=False):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/alpine.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "dhcpcd"])
def restart_if(self, ifname, retries=None, wait=None):
path: waagent_2.12.0.2-4/tests/common/osutil/test_default.py
def mock_run_command(cmd): # pylint: disable=unused-argument
return original_run_command(["pidof", "non-existing-process"])
with patch("azurelinuxagent.common.utils.shellutil.run_command",
side_effect=mock_run_command):
path: waagent_2.12.0.2-4/tests/common/osutil/test_default.py
def mock_run_command(cmd): # pylint: disable=unused-argument
return original_run_command(["pidof", "pidof"])
with patch("azurelinuxagent.common.utils.shellutil.run_command",
side_effect=mock_run_command):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/fedora.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "dhclient"])
def conf_sshd(self, disable_password):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/clearlinux.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "systemd-networkd"])
def conf_sshd(self, disable_password):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/photonos.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(['pidof', 'systemd-networkd'])
def conf_sshd(self, disable_password):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/redhat.py
# Override
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "dhclient"])
def set_hostname(self, hostname):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/arch.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "systemd-networkd"])
def conf_sshd(self, disable_password):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/suse.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", self.dhclient_name])
def is_dhcp_enabled(self):
path: waagent_2.12.0.2-4/azurelinuxagent/common/osutil/mariner.py
def get_dhcp_pid(self):
return self._get_dhcp_pid(["pidof", "systemd-networkd"])
def conf_sshd(self, disable_password):
```
Feel free to close this issue if this is a false positive (for example
if this code is in an unreachable code path).
Regards,
--
Gioele Barabucci