Skip to content

Conversation

@patchback
Copy link

@patchback patchback bot commented Jan 30, 2023

This is a backport of PR #399 as merged into main (bbaee4f).

SUMMARY

On some of our systems the postgresql_query task failed with the following error:

AttributeError: module 'psycopg2' has no attribute 'extras'

Applying the patch from this commit fixed the issue for me on those systems. This was previously reported in issue #283. However now that some time has passed, I am unable to reproduce the issue on our newer systems.

In any case, this is still a mistake that could cause problems in the future, so I think it would be better to fix it.

The reason that this mistake is not causing any actual errors in normal situations is because of how the python import system functions: All of the entrypoints (all the source files under plugins/modules) have an import for psycopg2.extras. This causes extras to be available on psycopg2 for any code (in any module) that executes after that import statement, such as the function bodies in module_utils/postgres.py.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.postgresql

ADDITIONAL INFORMATION

Fixes #283

Fixes #283

(cherry picked from commit bbaee4f)
@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

❗ No coverage uploaded for pull request base (stable-1@ff00e35). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head bbaee4f differs from pull request most recent head f725626. Consider uploading reports for the commit f725626 to get more accurate results

@@             Coverage Diff             @@
##             stable-1     #405   +/-   ##
===========================================
  Coverage            ?   80.55%           
===========================================
  Files               ?       37           
  Lines               ?     5005           
  Branches            ?     1146           
===========================================
  Hits                ?     4032           
  Misses              ?      672           
  Partials            ?      301           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Andersson007 Andersson007 merged commit 4b35abb into stable-1 Jan 31, 2023
@Andersson007 Andersson007 deleted the patchback/backports/stable-1/bbaee4fe8214bd67f1d3af51aff3e5ac7e54f54b/pr-399 branch January 31, 2023 10:12
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

Successfully merging this pull request may close these issues.

3 participants