URL: https://github.com/freeipa/freeipa/pull/5150
Author: tiran
 Title: #5150: trust-add: Catch correct exception when chown SSSD
Action: opened

PR body:
"""
Commit 72fb4e6 introduced a regression. SSSD_USER.chown() raises
ValueError instead of KeyError when SSSD user does not exist.

Fixes: https://pagure.io/freeipa/issue/8516
Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5150/head:pr5150
git checkout pr5150
From e1b2ce063a0bbd19f10c765d4974f1f84240dff7 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Fri, 25 Sep 2020 11:14:04 +0200
Subject: [PATCH] trust-add: Catch correct exception when chown SSSD

Commit 72fb4e6 introduced a regression. SSSD_USER.chown() raises
ValueError instead of KeyError when SSSD user does not exist.

Fixes: https://pagure.io/freeipa/issue/8516
Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 install/oddjob/com.redhat.idm.trust-fetch-domains.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install/oddjob/com.redhat.idm.trust-fetch-domains.in b/install/oddjob/com.redhat.idm.trust-fetch-domains.in
index 0ef72481c0..92fb4ce9b7 100644
--- a/install/oddjob/com.redhat.idm.trust-fetch-domains.in
+++ b/install/oddjob/com.redhat.idm.trust-fetch-domains.in
@@ -97,7 +97,7 @@ def retrieve_keytab(api, ccache_name, oneway_keytab_name, oneway_principal):
     # Make sure SSSD is able to read the keytab
     try:
         constants.SSSD_USER.chown(oneway_keytab_name)
-    except KeyError:
+    except ValueError:
         # If user 'sssd' does not exist, we don't need to chown from root to sssd
         # because it means SSSD does not run as sssd user
         pass
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to