now get_url defaults to module temp dir (#36218)

* now get_url and other modules default to module temp dir

also fixed 'bare' exception

* allow modules to work with older versions

* updated docs per feedback
This commit is contained in:
Brian Coca 2018-02-20 08:40:45 -05:00 committed by GitHub
commit c119d54e4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 14 deletions

View file

@ -316,7 +316,7 @@ def ensure_yum_utils(module):
def fetch_rpm_from_url(spec, module=None):
# download package so that we can query it
package_name, _ = os.path.splitext(str(spec.rsplit('/', 1)[1]))
package_file = tempfile.NamedTemporaryFile(prefix=package_name, suffix='.rpm', delete=False)
package_file = tempfile.NamedTemporaryFile(dir=getattr(module, 'tmpdir', None), prefix=package_name, suffix='.rpm', delete=False)
module.add_cleanup_file(package_file.name)
try:
rsp, info = fetch_url(module, spec)