Cosmetic tidy up of pid lookup function

The code flow can be made more obvious in this function

Change-Id: Ie65d7af764485cfa78e7a322817f984a7ee2762c
This commit is contained in:
Jonathan Rosser 2023-10-24 13:23:40 +01:00
parent ea46200a4f
commit 4615ef2930
1 changed files with 6 additions and 6 deletions

View File

@ -437,16 +437,16 @@ class Connection(SSH.Connection):
so that a container lookup is not required on a subsequent
command within the same task.
"""
if not self.is_container:
return 1, ''
pid_path = """/proc/%s"""
if self.is_container:
lookup_command = (u"lxc-info -Hpn '%s'" % self.container_name)
if not subdir:
subdir = 'root'
else:
return 1, ''
if not subdir:
subdir = 'root'
if not self.container_pid:
ssh_executable = self.get_option('ssh_executable')
lookup_command = (u"lxc-info -Hpn '%s'" % self.container_name)
args = (ssh_executable, 'ssh', self.host, lookup_command)
returncode, stdout, _ = self._run(
self._build_command(*args),