Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ansible/roles/vm_set/library/ptf_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def get_pid(ctn_name):
cli = docker.from_env()
try:
ctn = cli.containers.get(ctn_name)
except Exception:
return None
if ctn.status == 'running':
return ctn.attrs['State']['Pid']
except Exception as e:
logging.debug("Failed to get pid for container %s: %s" % (ctn_name, str(e)))

return ctn.attrs['State']['Pid']
return None

def get_process_pids(self, process):
cmd = 'docker exec -t {} bash -c "pgrep -f \'{}\'"'.format(self.ctn_name, process)
Expand Down