summaryrefslogtreecommitdiffstats
path: root/ipalib/frontend.py
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-11-16 15:13:32 -0600
committerEndi S. Dewata <edewata@redhat.com>2011-12-06 22:07:35 +0000
commit8f642bbe0885b4e6d375b705fcead6360d98b30f (patch)
tree354b50016aef64ef72b8844c5e66026fa50c9fa2 /ipalib/frontend.py
parent005b74d869ce240018985fd8abc752a5e200eb74 (diff)
downloadfreeipa-8f642bbe0885b4e6d375b705fcead6360d98b30f.tar.gz
freeipa-8f642bbe0885b4e6d375b705fcead6360d98b30f.tar.xz
freeipa-8f642bbe0885b4e6d375b705fcead6360d98b30f.zip
Added commands into metadata.
The json_metadata command has been modified to accept some new options and return the commands metadata. The API.txt has been updated as well. The UI has been modified to use commands metadata instead of methods metadata. Ticket #388
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r--ipalib/frontend.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index b79aad955..028e17e79 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -941,6 +941,17 @@ class Command(HasParam):
return rv
+ # list of attributes we want exported to JSON
+ json_friendly_attributes = (
+ 'name', 'takes_args', 'takes_options',
+ )
+
+ def __json__(self):
+ json_dict = dict(
+ (a, getattr(self, a)) for a in self.json_friendly_attributes
+ )
+ return json_dict
+
class LocalOrRemote(Command):
"""
A command that is explicitly executed locally or remotely.