mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
dns metadata
This is a little bit of a copy and paste approach, as the code for__json__ was copied from baseldap. Long term, we want to rewrite this plugin as an extension of baseldap anyway.
This commit is contained in:
parent
1dc0a3ab3e
commit
dcc0d76ef9
@ -187,6 +187,21 @@ class dns(Object):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
default_attributes = _zone_default_attributes
|
||||||
|
|
||||||
|
json_friendly_attributes = (
|
||||||
|
'default_attributes', 'label', 'name', 'takes_params' )
|
||||||
|
|
||||||
|
def __json__(self):
|
||||||
|
json_dict = dict(
|
||||||
|
(a, getattr(self, a)) for a in self.json_friendly_attributes
|
||||||
|
)
|
||||||
|
if self.primary_key:
|
||||||
|
json_dict['primary_key'] = self.primary_key.name
|
||||||
|
json_dict['methods'] = [m for m in self.methods]
|
||||||
|
return json_dict
|
||||||
|
|
||||||
|
|
||||||
api.register(dns)
|
api.register(dns)
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,16 +73,23 @@ class json_metadata(Command):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def execute(self, objname):
|
def execute(self, objname):
|
||||||
|
|
||||||
if objname and objname in self.api.Object:
|
if objname and objname in self.api.Object:
|
||||||
return dict(
|
|
||||||
|
meta = dict(
|
||||||
result=dict(
|
result=dict(
|
||||||
((objname, json_serialize(self.api.Object[objname])), )
|
((objname, json_serialize(self.api.Object[objname])), )
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
result=dict(
|
retval= dict([("metadata",meta), ("messages",dict())])
|
||||||
(o.name, json_serialize(o)) for o in self.api.Object()
|
|
||||||
)
|
else:
|
||||||
retval= dict([("metadata",result),("messages",json_serialize(self.messages))])
|
meta=dict(
|
||||||
|
(o.name, json_serialize(o)) for o in self.api.Object()
|
||||||
|
)
|
||||||
|
|
||||||
|
retval= dict([("metadata",meta),
|
||||||
|
("messages",json_serialize(self.messages))])
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user