package: autopkgtest version: 5.10 tags: patch Hi,
When logging in as root, autopkgtest-virt-ssh should assume that root-on-testbed is available. The current code doesn't do that. If autopkgtest-virt-ssh is started with '--capability root-on-testbed', but sudo fails, the 'root-on-testbed' capability is assumed to be absent and removed. This should (at least) result in a warning, to allow easier debugging. The attached patch fixes both issues. Thanks! Ivo
--- /usr/bin/autopkgtest-virt-ssh 2020-04-24 18:20:34.417318935 +0000 +++ /usr/bin/autopkgtest-virt-ssh.root 2020-04-24 18:20:26.637316737 +0000 @@ -326,16 +326,18 @@ global sshconfig, sshcmd, capabilities, workdir - if sshconfig['login'] != 'root': - (sudocmd, askpass) = can_sudo(sshcmd) - else: + if sshconfig['login'] == 'root': (sudocmd, askpass) = (None, None) - if sudocmd: - if 'root-on-testbed' not in capabilities: - capabilities.append('root-on-testbed') + capabilities.append('root-on-testbed') else: - if 'root-on-testbed' in capabilities: - capabilities.remove('root-on-testbed') + (sudocmd, askpass) = can_sudo(sshcmd) + if sudocmd: + if 'root-on-testbed' not in capabilities: + capabilities.append('root-on-testbed') + else: + if 'root-on-testbed' in capabilities: + adtlog.warning('sudo command failed: removing root-on-testbed capability') + capabilities.remove('root-on-testbed') extra_cmd = '' if askpass: