# k8s module error: 'NoneType' object has no attribute 'endswith'\\n"

**URL:** <https://forum.ansible.com/t/k8s-module-error-nonetype-object-has-no-attribute-endswith-n/31484>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [October 17, 2019, 10:39pm UTC](https://forum.ansible.com/t/k8s-module-error-nonetype-object-has-no-attribute-endswith-n/31484 "2019-10-17T22:39:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boa\_Ah](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@Boa\_Ah](https://forum.ansible.com/u/Boa_Ah)\
**Post date:** [October 17, 2019, 10:39pm UTC](https://forum.ansible.com/t/k8s-module-error-nonetype-object-has-no-attribute-endswith-n/31484/1 "2019-10-17T22:39:43Z")

</div>

Team,

I have simple test and its failing with below when using k8s module.

task/main.yaml

- name: “Validate k8s version KUBECTL”

shell: “kubectl version --short”

register: k8s\_version

failed\_when: k8s\_version.rc == 1

- debug:

var: k8s\_version.stdout

- name: “Validate k8s Versions Client & Server: K8s Module”

k8s:

validate:

verify\_ssl: no

output

changed: [localhost]

TASK [2\_k8s\_validations : debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost] =\> {

“k8s\_version.stdout”: “Client Version: v1.10.1\nServer Version: v1.13.5”

}

TASK [2\_k8s\_validations : Validate k8s Versions Client & Server: K8s Module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

fatal: [localhost]: FAILED! =\> {“changed”: false, “module\_stderr”: “/Users/amohmad/.ansible/tmp/ansible-tmp-1571351337.4579258-273170310360257/AnsiballZ\_k8s.py:18: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module’s documentation for alternative uses\n import imp\nTraceback (most recent call last):\n File "/Users/amohmad/.ansible/tmp/ansible-tmp-1571351337.4579258-273170310360257/AnsiballZ\_k8s.py", line 114, in \n \_ansiballz\_main()\n File "/Users/amohmad/.ansible/tmp/ansible-tmp-1571351337.4579258-273170310360257/AnsiballZ\_k8s.py", line 106, in \_ansiballz\_main\n invoke\_module(zipped\_mod, temp\_path, ANSIBALLZ\_PARAMS)\n File "/Users/amohmad/.ansible/tmp/ansible-tmp-1571351337.4579258-273170310360257/AnsiballZ\_k8s.py", line 49, in invoke\_module\n imp.load\_module(‘ **main** ’, mod, module, MOD\_DESC)\n File "/usr/local/Cellar/ansible/2.8.5/libexec/lib/python3.7/imp.py", line 234, in load\_module\n return load\_source(name, filename, file)\n File "/usr/local/Cellar/ansible/2.8.5/libexec/lib/python3.7/imp.py", line 169, in load\_source\n module = \_exec(spec, sys.modules[name])\n File "", line 630, in \_exec\n File "", line 728, in exec\_module\n File "", line 219, in \_call\_with\_frames\_removed\n File "/var/folders/qq/t\_5mbv151fxfq9\_vdgyvcvg8yz98pj/T/ansible\_k8s\_payload\_yo7cq9fu/ **main**.py", line 258, in \n File "/var/folders/qq/t\_5mbv151fxfq9\_vdgyvcvg8yz98pj/T/ansible\_k8s\_payload\_yo7cq9fu/ **main**.py", line 254, in main\n File "/var/folders/qq/t\_5mbv151fxfq9\_vdgyvcvg8yz98pj/T/ansible\_k8s\_payload\_yo7cq9fu/ansible\_k8s\_payload.zip/ansible/module\_utils/k8s/raw.py", line 160, in execute\_module\nAttributeError: ‘NoneType’ object has no attribute ‘endswith’\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

localhost
