summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXabier Napal <naxabier@gmail.com>2021-03-22 15:06:45 +0100
committerGitHub <noreply@github.com>2021-03-22 15:06:45 +0100
commit2bff120db6bf96dd0085c6ce1b29f3999b872db4 (patch)
treebb319ba079bec995390dce25f26e216a6a6d9515
parentUpdate Ansible release version to v2.11.0b3.post0. (#73980) (diff)
downloadansible-2bff120db6bf96dd0085c6ce1b29f3999b872db4.tar.xz
ansible-2bff120db6bf96dd0085c6ce1b29f3999b872db4.zip
Fix wrong backup directory var name in apt module (#73840)
* Fix wrong backup directory var name in apt module
-rw-r--r--changelogs/fragments/73840_apt-policy-rc-d.yml4
-rw-r--r--lib/ansible/modules/apt.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/changelogs/fragments/73840_apt-policy-rc-d.yml b/changelogs/fragments/73840_apt-policy-rc-d.yml
new file mode 100644
index 0000000000..4c260ce8c1
--- /dev/null
+++ b/changelogs/fragments/73840_apt-policy-rc-d.yml
@@ -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)
diff --git a/lib/ansible/modules/apt.py b/lib/ansible/modules/apt.py
index 0300d866c3..d6b038acc6 100644
--- a/lib/ansible/modules/apt.py
+++ b/lib/ansible/modules/apt.py
@@ -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'))