Thanks to visit codestin.com
Credit goes to github.com

Skip to content

exec response returning with extra data #140

Closed
@mrmcmuffinz

Description

@mrmcmuffinz

Scenario
I'm trying to check if a specific files exists in my pod and assert it on my end using a direct string to string comparison.

Code Snippet

cmd = "[ -f /etc/hosts ] && echo 'True' || echo 'False'"
response = kubernetes_client.connect_post_namespaced_pod_exec(pod, kubernetes_namespace, stderr=True, stdin=True, stdout=True, command=cmd, tty=False)
is_file = response.strip()
print is_file
print [ord(c) for c in is_file]
print len(is_file)

Output

True
[1, 1, 84, 114, 117, 101]
6

Problem
Before in kubernetes v1.0.0.b1, I did not have those extra characters in the beginning of my response but with the latest v1.0.0b3 I do. Anyone know why this is the case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions