Skip to content

Instantly share code, notes, and snippets.

@benformosa
Created February 27, 2020 23:49
Show Gist options
  • Save benformosa/5bf545baab0e5cf59ce1aaac360b661b to your computer and use it in GitHub Desktop.
Save benformosa/5bf545baab0e5cf59ce1aaac360b661b to your computer and use it in GitHub Desktop.
ansible shebang.py bug report
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
def main():
'''do-nothing module for bug report'''
module = AnsibleModule()
module.exit_json(changed=False)
if __name__ == '__main__':
main()
[user@host ansible_collections]$ ansible-galaxy collection init my_namespace.my_collection
- Collection my_namespace.my_collection was created successfully
[user@host ansible_collections]$ cd my_namespace/my_collection/
[user@host my_collection]$ cd roles/
[user@host roles]$ ansible-galaxy role init my_role
- Role my_role was created successfully
[user@host roles]$ cd my_role/
[user@host my_role]$ mkdir library
[user@host my_role]$ vim library/my_module.py
[user@host my_role]$ cd ../..
[user@host my_collection]$ tree
.
|-- docs
|-- galaxy.yml
|-- plugins
| `-- README.md
|-- README.md
`-- roles
`-- my_role
|-- defaults
| `-- main.yml
|-- files
|-- handlers
| `-- main.yml
|-- library
| `-- my_module.py
|-- meta
| `-- main.yml
|-- README.md
|-- tasks
| `-- main.yml
|-- templates
|-- tests
| |-- inventory
| `-- test.yml
`-- vars
`-- main.yml
13 directories, 12 files
[user@host my_collection]$ ansible-test sanity
WARNING: PyYAML will be slow due to installation without libyaml support for interpreter: /home/user/pyvenv3/bin/python3.6
Running sanity test 'action-plugin-docs' with Python 3.6
Running sanity test 'ansible-doc' with Python 3.6
WARNING: Skipping sanity test 'compile' on Python 2.6 due to missing interpreter.
Running sanity test 'compile' with Python 2.7
WARNING: Skipping sanity test 'compile' on Python 3.5 due to missing interpreter.
Running sanity test 'compile' with Python 3.6
WARNING: Skipping sanity test 'compile' on Python 3.7 due to missing interpreter.
WARNING: Skipping sanity test 'compile' on Python 3.8 due to missing interpreter.
Running sanity test 'empty-init' with Python 3.6
Running sanity test 'future-import-boilerplate' with Python 3.6
Running sanity test 'ignores'
WARNING: Skipping sanity test 'import' on Python 2.6 due to missing interpreter.
Running sanity test 'import' with Python 2.7
WARNING: Skipping sanity test 'import' on Python 3.5 due to missing interpreter.
Running sanity test 'import' with Python 3.6
WARNING: Skipping sanity test 'import' on Python 3.7 due to missing interpreter.
WARNING: Skipping sanity test 'import' on Python 3.8 due to missing interpreter.
Running sanity test 'line-endings' with Python 3.6
Running sanity test 'metaclass-boilerplate' with Python 3.6
Running sanity test 'no-assert' with Python 3.6
Running sanity test 'no-basestring' with Python 3.6
Running sanity test 'no-dict-iteritems' with Python 3.6
Running sanity test 'no-dict-iterkeys' with Python 3.6
Running sanity test 'no-dict-itervalues' with Python 3.6
Running sanity test 'no-get-exception' with Python 3.6
Running sanity test 'no-illegal-filenames' with Python 3.6
Running sanity test 'no-main-display' with Python 3.6
Running sanity test 'no-smart-quotes' with Python 3.6
Running sanity test 'no-unicode-literals' with Python 3.6
Running sanity test 'pep8' with Python 3.6
Running sanity test 'pslint'
Running sanity test 'pylint' with Python 3.6
Running sanity test 'replace-urlopen' with Python 3.6
Running sanity test 'rstcheck' with Python 3.6
Running sanity test 'shebang' with Python 3.6
ERROR: Found 1 shebang issue(s) which need to be resolved:
ERROR: roles/my_role/library/my_module.py:1:1: unexpected non-module shebang: b'#!/usr/bin/python'
See documentation for help: https://docs.ansible.com/ansible/2.9/dev_guide/testing/sanity/shebang.html
Running sanity test 'shellcheck'
Running sanity test 'symlinks' with Python 3.6
Running sanity test 'use-argspec-type-path' with Python 3.6
Running sanity test 'use-compat-six' with Python 3.6
Running sanity test 'validate-modules' with Python 3.6
Running sanity test 'yamllint' with Python 3.6
ERROR: The 1 sanity test(s) listed below (out of 41) failed. See error output above for details.
shebang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment