ansible_mitogen: Fix TypeError in set_file_owner()

fixes #1234
pull/1235/head
Alex Willmer 11 months ago
parent 186404829d
commit 9b91a1a529

@ -647,11 +647,10 @@ def set_file_owner(path, owner, group=None, fd=None):
else:
gid = os.getegid()
if fd is not None and hasattr(os, 'fchown'):
os.fchown(fd, (uid, gid))
if fd is not None:
os.fchown(fd, uid, gid)
else:
# Python<2.6
os.chown(path, (uid, gid))
os.chown(path, uid, gid)
def write_path(path, s, owner=None, group=None, mode=None,
@ -741,7 +740,7 @@ def set_file_mode(path, spec, fd=None):
mode = os.stat(path).st_mode
new_mode = apply_mode_spec(spec, mode)
if fd is not None and hasattr(os, 'fchmod'):
if fd is not None:
os.fchmod(fd, new_mode)
else:
os.chmod(path, new_mode)

@ -36,6 +36,8 @@ In progress (unreleased)
``_low_level_execute_command()``
* :gh:issue:`1227` tests: Name transport_config tests that use ``mitogen_via``
* :gh:issue:`1143` :mod:`ansible_mitogen`: Fix dnf module include for dnf.cli
* :gh:issue:`1234` :mod:`ansible_mitogen`: Fix :exc:`TypeError` in
:func:`ansible_mitogen.target.set_file_owner`
v0.3.21 (2025-01-20)

Loading…
Cancel
Save