Added support for client defined result data in FReeIPABaseModule

Modified support for processing result of IPA API commands so that
client code can define its own processing and add return values to
self.exit_args based on command result.

If a subclass need to process the result of IPA API commands it should
override the method `process_command_result`. The default implementation
will simply evaluate if `changed` should be true.
This commit is contained in:
Rafael Guterres Jeffman
2020-08-05 15:13:46 -03:00
parent abbd15e6f5
commit 531e544b30
2 changed files with 23 additions and 7 deletions

View File

@@ -472,6 +472,14 @@ class DNSZoneModule(FreeIPABaseModule):
}
self.add_ipa_command("dnszone_mod", zone_name, args)
def process_command_result(self, name, command, args, result):
super(DNSZoneModule, self).process_command_result(
name, command, args, result
)
if command == "dnszone_add" and self.ipa_params.name_from_ip:
dnszone_exit_args = self.exit_args.setdefault('dnszone', {})
dnszone_exit_args['name'] = name
def get_argument_spec():
forwarder_spec = dict(