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

result_banners referenced before assignment in os_config module #56

Open
hbennett-spirententerprise opened this issue Nov 18, 2022 · 1 comment

Comments

@hbennett-spirententerprise
SUMMARY

While using the dellemc.os.os6_config module I am getting a fatal error with the follow STDERR:

  • local variable 'result_banners' referenced before assignment
ISSUE TYPE
  • Bug Report
COMPONENT NAME

os6_config

ANSIBLE VERSION

ansible [core 2.13.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True

COLLECTION VERSION

/usr/local/lib/python3.8/dist-packages/ansible_collections

Collection Version


dellemc.os6 1.0.7

CONFIGURATION

COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['/ansible/collections']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INVENTORY_ENABLED(/etc/ansible/ansible.cfg) = ['spirent_it.Network.netbox']

OS / ENVIRONMENT

Dell N2048 running firmware 6.5.1.6

STEPS TO REPRODUCE

Running module dellemc.os6.os6_config with following with update_type set to "check". The _config_lines can be any configuration.

  • name: "Run Module: {{ prefix }}{{ _module.name }} - {{ update_type }}"
    vars:
    _config_lines: "{{lookup('template', 'templates/' + prefix + '' + _module.name + '.j2')}}"
    dellemc.os6.os6_config:
    lines: "{{ _config_lines }}"
    config: "{{ ansible_net_config }}"
    update: "{{ update_type }}"
    register: _results
EXPECTED RESULTS

Return changes in _results

ACTUAL RESULTS

fatal: [netcalswtac02]: FAILED! => {
"changed": false,
"module_stderr": "local variable 'result_banners' referenced before assignment",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}

@hbennett-spirententerprise
Copy link
Author

I was able to fix the issue by defining results_banners at the beginning of the code block,
if configobjs or banners:
result_banners = []

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

No branches or pull requests

1 participant