Refactor the role/attribute member reporting code

The `config` object now hosts a generic method for updating the config
entry for desired server role configuration (if not empty). The
duplicated code in dns/trust/vaultconfig commands was replaced by a call
to a common method.

https://pagure.io/freeipa/issue/6937

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Martin Babinsky
2017-05-16 17:29:39 +02:00
parent bddb90f38a
commit cac7e49daa
4 changed files with 27 additions and 41 deletions

View File

@@ -997,9 +997,9 @@ class vaultconfig_show(Retrieve):
with self.api.Backend.kra.get_client() as kra_client:
transport_cert = kra_client.system_certs.get_transport_cert()
config = {'transport_cert': transport_cert.binary}
config.update(
self.api.Backend.serverroles.config_retrieve("KRA server")
)
self.api.Object.config.show_servroles_attributes(
config, "KRA server", **options)
return {
'result': config,