-
Notifications
You must be signed in to change notification settings - Fork 199
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
ansible-postgresql_exec custom module error ValueError: I/O operation on closed file #555
Comments
This one looks interesting -- I bet it's something to do with a difference in stdin/stdout. Should have time to look at this over the weekend, thanks for reporting! |
It's almost certainly due to
Due to ansible/ansible#3518 |
GitHub shows this is an unfortunately common idiom in Python: https://github.com/search?p=3&q=%22sys.setdefaultencoding%28%27utf8%27%29+%22&type=Code But much less so in Ansible: https://github.com/search?q=%22sys.setdefaultencoding%28%27utf8%27%29++import+pipes%22&type=Code |
It's been gone from the Ansible tree completely since Aug 2015, so this is just about third party compatibility
This might warrant a monkey-patch. The alternative is breaking compatibility with ancient existing modules. The question is what the patch should do! Some obvious behaviours
The alternative is to stop relying on |
Hi @gilesw I've been over this module a few times, and I'm a little perplexed what the setdefaultencoding() workaround is being used for. It's naturally been made obsolete in newer Ansible versions, but that doesn't explain why it is needed in older Ansibles. For example on Python 2, the 'read_file()' function will yield bytes, while on Python 3 it will decode UTF-8 by default The only remaining use is on line 279, where "getdefaultencoding()" is used instead of simply 'utf-8' or similar. Mitogen takes compatibility very seriously, but in this case, it'd be nice to understand what we're trying to be compatible with first before fixing it :) |
@dw thanks for looking into this. I'm afraid I'm not the original author, or any kind of python programmer. I just looked at the postgresql modules that are part of Ansible as a sort of template to make recent modifications and added output from the query that's run (which seems vital to me.) |
* origin/dmw: issue #555: ansible: workaround ancient reload(sys) hack.
This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://networkgenomics.com/mail/mitogen-announce/ Thanks for reporting this! |
* origin/026: docs: update Changelog for release. Bump version for release. issue #555: ansible: workaround ancient reload(sys) hack. issue #554: mitogen_action_script fix issue #554: fix Ansible 2.4 compatibility issue #554: don't rely on tmp_path autoremoval in test. issue #554: track and remove multiple make_tmp_path() calls. docs: update Changelog. docs: drastically simplify install/changelog. issue #552: include process identity in log messages. issue #550: update Changelog. issue #550: parent: add explanatory comment. issue #550: fix up TTY ioctls on WSL 2016 Anniversary Update docs: update Changelog. service: make service list optional. docs: update Changelog; closes #548. issue #548: always treat transport=smart as 'ssh' for mitogen_via=. docs: better intro paragraph. .ci: copy private key file to tempdir. os_fork: more doc tweaks os_fork: more doc tweaks os_fork: yet more doc tidyup os_fork: more doc tweaks os_fork: clean up docs .ci: import soak scripts. .ci: allow containers for different jobs to run simultaneously os_fork: python 3 fixes and tests. issue #535: activate Corker on 2.4 in master too. issue #535: update Changelog. issue #535: wire mitogen.os_fork into Broker and Pool. issue #535: parent: add create_socketpair(size=..) parameter. issue #535: introduce mitogen.os_fork module and Corker class. issue #535: docs: update Changelog issue #535: service: support Pool.defer() like Broker.defer() issue #535: core: unicode.encode() may take importer lock on 2.x issue #535: docs: fix up Select doc issue #535: docs: update Changelog. issue #535: core/select: support selecting from Latches. core: increase cookie field lengths to 64-bit; closes #545. tests: ensure serialization restrictions are in effect tests/bench: set process affinity in throughput.py. docs: update copyright year. docs: update Changelog. core: Make Latch.put(obj=) optional. docs: change 'unreleased' Changelog format and add a hint. docs: update Changelog; closes #542. issue #542: return of select poller, new selection logic issue #542: .ci: move some tests to Azure and enable Mac job. ansible: create stub __init__.py for sdist.
ubuntu, running off pips.
I'm hitting an error running a custom module I use:-
gilesw/ansible-postgresql_exec#1
Hopefully a simple one to fix.
The text was updated successfully, but these errors were encountered: