URL: https://github.com/freeipa/freeipa/pull/886
Author: martbab
 Title: #886: *config-show: Restore the original reporting of server 
roles/attributes
Action: opened

PR body:
"""
Revert to the FreeIPA 4.4 behavior of these commands: if no master
provides the role (or the information is inaccessible to the caller),
return an empty list. If no one provides the attribute do not return
anything.

We may also discuss other options such as do not show anything if both
properties are empty. This is indeed implied by the params in the commands
which are optional.

https://pagure.io/freeipa/issue/7029
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/886/head:pr886
git checkout pr886
From 099a0bf5281318cdd7aef29736a735ebf96c56d8 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Wed, 21 Jun 2017 17:21:04 +0200
Subject: [PATCH] *config-show: Restore the original reporting of server
 roles/attributes

Revert to the FreeIPA 4.4 behavior of these commands: if no master
provides the role (or the information is inaccessible to the caller),
return an empty list. If no one provides the attribute do not return
anything.

https://pagure.io/freeipa/issue/7029
---
 ipaserver/plugins/config.py      | 3 +--
 ipaserver/plugins/serverroles.py | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
index df6bd466af..ce15e6096f 100644
--- a/ipaserver/plugins/config.py
+++ b/ipaserver/plugins/config.py
@@ -278,8 +278,7 @@ def update_entry_with_role_config(self, role_name, entry_attrs):
 
         role_config = backend.config_retrieve(role_name)
         for key, value in role_config.items():
-            if value:
-                entry_attrs.update({key: value})
+            entry_attrs.update({key: value})
 
 
     def show_servroles_attributes(self, entry_attrs, *roles, **options):
diff --git a/ipaserver/plugins/serverroles.py b/ipaserver/plugins/serverroles.py
index e81635c331..85cf7edd01 100644
--- a/ipaserver/plugins/serverroles.py
+++ b/ipaserver/plugins/serverroles.py
@@ -136,7 +136,9 @@ def config_retrieve(self, servrole):
 
         for name, attr in assoc_attributes.items():
             attr_value = attr.get(self.api)
-            result.update({name: attr_value})
+
+            if attr_value:
+                result.update({name: attr_value})
 
         return result
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to