From 2bff120db6bf96dd0085c6ce1b29f3999b872db4 Mon Sep 17 00:00:00 2001 From: Xabier Napal Date: Mon, 22 Mar 2021 15:06:45 +0100 Subject: [PATCH] Fix wrong backup directory var name in apt module (#73840) * Fix wrong backup directory var name in apt module --- changelogs/fragments/73840_apt-policy-rc-d.yml | 4 ++++ lib/ansible/modules/apt.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/73840_apt-policy-rc-d.yml 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 00000000000..4c260ce8c11 --- /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 0300d866c31..d6b038acc63 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'))