Skip to content

Commit a52cc9c

Browse files
authored
Merge pull request #109 from myakove/pod-execute-ignore-rc
Pod.execute: add ignore_rc flag
2 parents 29a79a8 + 0e61b6d commit a52cc9c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ocp_resources/pod.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ def containers(self):
6868
"""
6969
return self.instance.spec.containers
7070

71-
def execute(self, command, timeout=60, container=None):
71+
def execute(self, command, timeout=60, container=None, ignore_rc=False):
7272
"""
7373
Run command on Pod
7474
7575
Args:
7676
command (list): Command to run.
7777
timeout (int): Time to wait for the command.
7878
container (str): Container name where to exec the command.
79+
ignore_rc (bool): If True ignore error rc from the shell and return out.
7980
8081
Returns:
8182
str: Command output.
@@ -124,7 +125,7 @@ def execute(self, command, timeout=60, container=None):
124125
stdout = resp.read_stdout(timeout=5)
125126
stderr = resp.read_stderr(timeout=5)
126127

127-
if rcstring == "Success":
128+
if rcstring == "Success" or ignore_rc:
128129
return stdout
129130

130131
returncode = [

0 commit comments

Comments
 (0)