Fix wrong backup directory var name in apt module (#73840)

* Fix wrong backup directory var name in apt module
This commit is contained in:
Xabier Napal 2021-03-22 15:06:45 +01:00 committed by GitHub
parent 2c40dccd85
commit 2bff120db6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,4 @@
bugfixes:
- >-
apt - fix policy_rc_d parameter throwing an exception when restoring
original file (https://github.com/ansible/ansible/issues/66211)

View file

@ -428,7 +428,7 @@ class PolicyRcD(object):
try:
shutil.move(os.path.join(self.backup_dir, 'policy-rc.d'),
'/usr/sbin/policy-rc.d')
os.rmdir(self.tmpdir_name)
os.rmdir(self.backup_dir)
except Exception:
self.m.fail_json(msg="Fail to move back %s to /usr/sbin/policy-rc.d"
% os.path.join(self.backup_dir, 'policy-rc.d'))