There is an issue with outputting enabled roles in server-find regarding our lovely `--raw`, `--all` and `--no-member` options.

This quick patch fixes that.

--
Martin^3 Babinsky
From 24eaec37476afdd9019492b5b4b79cef9c853a4b Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Fri, 17 Jun 2016 16:16:48 +0200
Subject: [PATCH 7/7] Fix listing of enabled roles in `server-find`

The roles can be thought of as membership attributes so we should only
list
them if `--all` is specified and `--no-members` is not.

Also do not show them if `--raw` is passed in.
---
 ipaserver/plugins/server.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py
index d7c4ba415d4811970b6554b7c862b4b074416b1d..433c74db702efaeade3104dda9da497b60424ed3 100644
--- a/ipaserver/plugins/server.py
+++ b/ipaserver/plugins/server.py
@@ -191,7 +191,10 @@ class server(LDAPObject):
             entry_attrs['ipalocation_location'] = converted_locations
 
     def get_enabled_roles(self, entry_attrs, **options):
-        if options.get('raw', False) or options.get('no_members', False):
+        if not options.get('all', False) and options.get('no_members', False):
+            return
+
+        if options.get('raw', False):
             return
 
         enabled_roles = self.api.Command.server_role_find(
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to