Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community.network.ce_config: unindent does not match any outer indentation level #584

Open
misch42 opened this issue Jan 7, 2024 · 1 comment

Comments

@misch42
Copy link

misch42 commented Jan 7, 2024

SUMMARY

I want to configure a huawei switch according to the ansible doc of community.network.ce_config. The task is:

  • name: "Configure top level configuration and save it"
    community.network.ce_config:
    lines: "sysname switchname"

This throws an error.

ISSUE TYPE

TASK [Configure top level configuration and save it] **************************************************************************************
task path: /home/misch/huawei_configure.yml:38
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158, in run
res = self._execute()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 629, in _execute
result = self._handler.run(task_vars=vars_copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/action/ce.py", line 56, in run
result = super(ActionModule, self).run(task_vars=task_vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 42, in run
filename, module = self._find_load_module()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 280, in _find_load_module
module = importlib.import_module(context.plugin_resolved_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 432, in exec_module
code_obj = self.get_code(self._fullname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 544, in get_code
self._compiled_code = compile(source=source_code, filename=filename, mode='exec', flags=0, dont_inherit=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/modules/ce_config.py", line 275
if module.params['defaults']:
^
IndentationError: unindent does not match any outer indentation level
fatal: [Ansible-test-22]: FAILED! => {
"msg": "Unexpected failure during module execution: unindent does not match any outer indentation level (ce_config.py, line 275)",
"stdout": ""
}

COMPONENT NAME

community.network.ce_config

ANSIBLE VERSION
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/misch/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/misch/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION
# /usr/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.network 5.0.0
CONFIGURATION
$ ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/netbox-inventory.yml', '/etc/ansible/inventory.yml']
OS / ENVIRONMENT
$ cat /etc/os-release 
NAME="AlmaLinux"
VERSION="9.2 (Turquoise Kodkod)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.2 (Turquoise Kodkod)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
STEPS TO REPRODUCE

run the task above.

  - name: "Configure top level configuration and save it"
    community.network.ce_config:
      lines: "sysname switchname"

EXPECTED RESULTS

Set hostname on device.

ACTUAL RESULTS
TASK [Configure top level configuration and save it] **************************************************************************************
task path: /home/misch/huawei_configure.yml:38
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 629, in _execute
    result = self._handler.run(task_vars=vars_copy)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/action/ce.py", line 56, in run
    result = super(ActionModule, self).run(task_vars=task_vars)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 42, in run
    filename, module = self._find_load_module()
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 280, in _find_load_module
    module = importlib.import_module(context.plugin_resolved_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 432, in exec_module
    code_obj = self.get_code(self._fullname)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 544, in get_code
    self._compiled_code = compile(source=source_code, filename=filename, mode='exec', flags=0, dont_inherit=True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/modules/ce_config.py", line 275
    if module.params['defaults']:
                                 ^
IndentationError: unindent does not match any outer indentation level
fatal: [Ansible-test-22]: FAILED! => {
    "msg": "Unexpected failure during module execution: unindent does not match any outer indentation level (ce_config.py, line 275)",
    "stdout": ""
}

@Andersson007
Copy link
Contributor

@misch42 hi, thanks for reporting the issue!

I'll ping the original maintainers: @QijunPan @TommyLike @edisonxiang @freesky-edward @hwDCN @niuzhenguo @xuxiaowei0512 @yanzhangi @zengchen1024 @zhongjun2

Though the chances anybody responds is not high, so I'll put the help_wanted label and the link to the Quick-start dev guide if anyone else wants to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants