[backport/2.2] Fix k8s_drain failing when pod has local storage (#332)

This commit is contained in:
Mike Graves
2022-01-17 00:23:57 -05:00
committed by GitHub
parent 1c02fe3443
commit 5fdd70cbc3
2 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
---
bugfixes:
- k8s_drain - fix error caused by accessing an undefined variable when pods have local storage (https://github.com/ansible-collections/kubernetes.core/issues/292).

View File

@@ -183,6 +183,7 @@ def filter_pods(pods, force, ignore_daemonset):
# local storage
if localStorage:
pod_names = ",".join([pod[0] + "/" + pod[1] for pod in localStorage])
errors.append("cannot delete Pods with local storage: {0}.".format(pod_names))
# DaemonSet managed Pods