Skip to content

UnboundLocalError: local variable 'objs' referenced before assignment #379

@hexwit

Description

@hexwit
SUMMARY

When executing task that should define default privileges I get an exception.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • community.postgresql.postgresql_privs module
  • type: default_privs
ANSIBLE VERSION
ansible 2.10.4
  config file = ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.10.5/libexec/lib/python3.9/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.9.1 (default, Jan  8 2021, 17:17:17) [Clang 12.0.0 (clang-1200.0.32.28)]
COLLECTION VERSION
community.postgresql 2.3.1
CONFIGURATION
DEFAULT_SCP_IF_SSH(ansible.cfg) = True
OS / ENVIRONMENT
  • playbook execution: MacOS Catalina
  • target host: Debian 11 (with postgresql-15 and python3-psycopg2)
STEPS TO REPRODUCE

Preconditions:

  • database exists
  • roles exists

Execute following task:

-   name: "Define default CRUD privileges"
    community.postgresql.postgresql_privs:
        database: "some_db"
        type: default_privs
        objs: ALL_IN_SCHEMA
        privs: SELECT,INSERT,UPDATE,DELETE,EXECUTE
        schema: public
        role: "target_role"
        login_host: "localhost"
        login_user: "some_login_user"
        login_password: "some_login_password"
EXPECTED RESULTS

Default privileges for specified role refined.

ACTUAL RESULTS

Exception is thrown.

{"changed": false, "module_stderr": "/tmp/ansible_community.postgresql.postgresql_privs_payload_ljebxmcs/ansible_community.postgresql.postgresql_privs_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_privs.py\", line 1225, in main\r\nUnboundLocalError: local variable 'objs' referenced before assignment\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions