mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
Port modules away from __file__
* __file__ won't work if we want to invoke modules via -m or if we figure out how to keep modules from hitting the disk with pipelining. * module.tmpdir is the new way to place a file where it will be cleaned automatically. Change format string to not depend on __file__: * cloud/amazon/ec2_elb_lb.py * cloud/amazon/elb_classic_lb.py Use module.tempdir: * packaging/os/apt.py * files/unarchive.py
This commit is contained in:
parent
c227a0c8bb
commit
9350a81ae4
5 changed files with 12 additions and 8 deletions
|
@ -847,8 +847,7 @@ def upgrade(m, mode="yes", force=False, default_release=None,
|
|||
|
||||
|
||||
def download(module, deb):
|
||||
tempdir = os.path.dirname(__file__)
|
||||
package = os.path.join(tempdir, str(deb.rsplit('/', 1)[1]))
|
||||
package = os.path.join(module.tmpdir, to_native(deb.rsplit('/', 1)[1], errors='surrogate_or_strict'))
|
||||
# When downloading a deb, how much of the deb to download before
|
||||
# saving to a tempfile (64k)
|
||||
BUFSIZE = 65536
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue