IBM / ansible-for-i

the tool is to provide several customized modules for Ansible to manage IBM i systems.
GNU General Public License v3.0
55 stars 51 forks source link

Invalid syntax errors when usecases playbooks import ibmi_fix_repo #149

Closed robinsg closed 1 year ago

robinsg commented 1 year ago

I'm running the check_download_ptf_group.yml playbook from the usecases folder in v1.9.1 of the collection.

I get a list of PTFs back from the PSP page, as expected, but then the playbook fails:

TASK [ibm.power_ibmi.fix_repo_check_ptf_group : If get the latest PTF group information fail] ************************************************************************************************************************************
task path: /home/grobins2/ansible/dev/IBMiPTFs/collections/ansible_collections/ibm/power_ibmi/roles/fix_repo_check_ptf_group/tasks/main.yml:19
skipping: [XXXXXXXXX] => {}

TASK [ibm.power_ibmi.fix_repo_check_ptf_group : Set check_ptf_group_fail to True] ************************************************************************************************************************************************
task path: /home/grobins2/ansible/dev/IBMiPTFs/collections/ansible_collections/ibm/power_ibmi/roles/fix_repo_check_ptf_group/tasks/main.yml:23
skipping: [XXXXXXXXX] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

TASK [ibm.power_ibmi.fix_repo_check_ptf_group : Check if ptf group information is already in catalog's ptf group information table] **********************************************************************************************
task path: /home/grobins2/ansible/dev/IBMiPTFs/collections/ansible_collections/ibm/power_ibmi/roles/fix_repo_check_ptf_group/tasks/main.yml:29
fatal: [XXXXXXXXX]: FAILED! => {
    "msg": "Unable to import ibm.power_ibmi.ibmi_fix_repo due to invalid syntax"

The same error occurs when I run check_ptf_group_order_status.yml.

I've tried these with the v1.6 collection too and get the same error.

I also get an error when running the ansible-doc command with this module:

[grobins2@jedc1-aaa-mgt01 IBMiPTFs (collection_1.9.1)]$ ansible-doc -vvvv ibm.power_ibmi.ibmi_fix_repo
ansible-doc 2.9.15
  config file = /home/grobins2/ansible/dev/IBMiPTFs/ansible.cfg
  configured module search path = [u'/home/grobins2/ansible/dev/IBMiPTFs/collections/ansible_collections/ibm/power_ibmi/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-doc
  python version = 2.7.5 (default, Aug 13 2020, 06:59:42) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /home/grobins2/ansible/dev/IBMiPTFs/ansible.cfg as config file
[ERROR]: unable to parse /home/grobins2/ansible/dev/IBMiPTFs/collections/ansible_collections/ibm/power_ibmi/plugins/modules/ibmi_fix_repo.py
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/cli/doc.py", line 195, in run
    doc, plainexamples, returndocs, metadata = DocCLI._get_plugin_doc(plugin, loader, search_paths)
  File "/usr/lib/python2.7/site-packages/ansible/cli/doc.py", line 302, in _get_plugin_doc
    doc, plainexamples, returndocs, metadata = get_docstring(filename, fragment_loader, verbose=(context.CLIARGS['verbosity'] > 0))
  File "/usr/lib/python2.7/site-packages/ansible/utils/plugin_docs.py", line 124, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/usr/lib/python2.7/site-packages/ansible/parsing/plugin_docs.py", line 40, in read_docstring
    M = ast.parse(b_module_data.read())
  File "/usr/lib64/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 365
    group_item['msg'] = f'Group level [{group_level}] cannot be converted to int. {ex}'
                                                                                      ^
SyntaxError: invalid syntax
ERROR! module ibm.power_ibmi.ibmi_fix_repo missing documentation (or could not parse documentation): invalid syntax (<unknown>, line 365)

Other modules appear to be working fine.

LiJunBJZhu commented 1 year ago

Seems you are using python2.7, however, the collection only supports python3.6+.

robgjertsen1 commented 1 year ago

Closing the issue. Please reopen if there is a problem running the playbook at supported python level 3.6+.