acme_certficate: allow to write files to CWD (#54754)
* Allow to write files to CWD. * Add changelog.pull/4420/head
parent
f9dfb78d3c
commit
e422f18898
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "acme_certificate - writing result failed when no path was specified (i.e. destination in current working directory)."
|
|
@ -119,9 +119,10 @@ def write_file(module, dest, content):
|
||||||
raise ModuleFailException("Destination %s not readable" % (dest))
|
raise ModuleFailException("Destination %s not readable" % (dest))
|
||||||
checksum_dest = module.sha1(dest)
|
checksum_dest = module.sha1(dest)
|
||||||
else:
|
else:
|
||||||
if not os.access(os.path.dirname(dest), os.W_OK):
|
dirname = os.path.dirname(dest) or '.'
|
||||||
|
if not os.access(dirname, os.W_OK):
|
||||||
os.remove(tmpsrc)
|
os.remove(tmpsrc)
|
||||||
raise ModuleFailException("Destination dir %s not writable" % (os.path.dirname(dest)))
|
raise ModuleFailException("Destination dir %s not writable" % (dirname))
|
||||||
if checksum_src != checksum_dest:
|
if checksum_src != checksum_dest:
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(tmpsrc, dest)
|
shutil.copyfile(tmpsrc, dest)
|
||||||
|
|
Loading…
Reference in New Issue