|
|
1756dc |
From 644b46d3f301ac1b237818b8dc59f178c8fe14fe Mon Sep 17 00:00:00 2001
|
|
|
1756dc |
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
|
1756dc |
Date: Sat, 24 Nov 2018 13:01:28 +0100
|
|
|
1756dc |
Subject: [PATCH 12/15] compat: write to sysconfig after all changes are done
|
|
|
1756dc |
|
|
|
1756dc |
Before this patch we were writing to sysconfig before we check that
|
|
|
1756dc |
authconfig is run as root. This produce following traceback:
|
|
|
1756dc |
|
|
|
1756dc |
Truncated backtrace:
|
|
|
1756dc |
authcompat_EnvironmentFile.py:77:write:PermissionError: [Errno 13] Permission denied: '/etc/sysconfig/authconfig'
|
|
|
1756dc |
|
|
|
1756dc |
Traceback (most recent call last):
|
|
|
1756dc |
File "/usr/sbin/authconfig", line 650, in <module>
|
|
|
1756dc |
main()
|
|
|
1756dc |
File "/usr/sbin/authconfig", line 629, in main
|
|
|
1756dc |
authcompat = AuthCompat()
|
|
|
1756dc |
File "/usr/sbin/authconfig", line 463, in __init__
|
|
|
1756dc |
self.sysconfig.write()
|
|
|
1756dc |
File "/usr/lib/python3.7/site-packages/authselect/authcompat_EnvironmentFile.py", line 77, in write
|
|
|
1756dc |
with open(self.filename, "w") as f:
|
|
|
1756dc |
PermissionError: [Errno 13] Permission denied: '/etc/sysconfig/authconfig'
|
|
|
1756dc |
|
|
|
1756dc |
Now we write to sysconfig after writing all changes.
|
|
|
1756dc |
|
|
|
1756dc |
Resolves:
|
|
|
1756dc |
https://github.com/pbrezina/authselect/issues/119
|
|
|
1756dc |
---
|
|
|
1756dc |
src/compat/authcompat.py.in.in | 2 +-
|
|
|
1756dc |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
1756dc |
|
|
|
1756dc |
diff --git a/src/compat/authcompat.py.in.in b/src/compat/authcompat.py.in.in
|
|
|
1756dc |
index 666dcd0df57962a789a8882c26535d95d3e75cf2..e4b8c05c6a11a215529ba66f8b36b72a6ac18448 100755
|
|
|
1756dc |
--- a/src/compat/authcompat.py.in.in
|
|
|
1756dc |
+++ b/src/compat/authcompat.py.in.in
|
|
|
1756dc |
@@ -460,7 +460,6 @@ class AuthCompat:
|
|
|
1756dc |
self.options.parse()
|
|
|
1756dc |
self.options.applysysconfig(self.sysconfig)
|
|
|
1756dc |
self.options.updatesysconfig(self.sysconfig)
|
|
|
1756dc |
- self.sysconfig.write()
|
|
|
1756dc |
|
|
|
1756dc |
def printWarning(self):
|
|
|
1756dc |
print(_("Running authconfig compatibility tool."))
|
|
|
1756dc |
@@ -646,6 +645,7 @@ def main():
|
|
|
1756dc |
try:
|
|
|
1756dc |
authcompat.runAuthselect()
|
|
|
1756dc |
authcompat.writeConfiguration()
|
|
|
1756dc |
+ authcompat.sysconfig.write()
|
|
|
1756dc |
except subprocess.CalledProcessError as result:
|
|
|
1756dc |
eprint(_("Command [%s] failed with %d, stderr:")
|
|
|
1756dc |
% (' '.join(result.cmd), result.returncode))
|
|
|
1756dc |
--
|
|
|
1756dc |
2.17.2
|
|
|
1756dc |
|