summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/example.py
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2008-09-29 17:41:30 +0200
committerJason Gerard DeRose <jderose@redhat.com>2008-09-29 17:45:14 -0600
commitafdc72103847fc27efd00f8cc97a7320909ff6a0 (patch)
tree0e2bf04bb5d483b96ee43b218e759986d9af7b06 /ipalib/plugins/example.py
parentd77907d2d0ecc33ef4ee4121e10cfef385172b0d (diff)
downloadfreeipa.git-afdc72103847fc27efd00f8cc97a7320909ff6a0.tar.gz
freeipa.git-afdc72103847fc27efd00f8cc97a7320909ff6a0.tar.xz
freeipa.git-afdc72103847fc27efd00f8cc97a7320909ff6a0.zip
Add support for environment variables, change tests accordingly
Diffstat (limited to 'ipalib/plugins/example.py')
-rw-r--r--ipalib/plugins/example.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/ipalib/plugins/example.py b/ipalib/plugins/example.py
index 7576d2a1..c565d678 100644
--- a/ipalib/plugins/example.py
+++ b/ipalib/plugins/example.py
@@ -57,6 +57,23 @@ class discover(frontend.Command):
'Discover IPA servers on network.'
api.register(discover)
+# Command to get the idea how plugins will interact with api.env
+class envtest(frontend.Command):
+ 'Show current environment.'
+ def run(*args, **kw):
+ print ""
+ print "Environment variables:"
+ for var in api.env:
+ val = api.env[var]
+ if var is 'servers':
+ print ""
+ print " Servers:"
+ for item in api.env.servers:
+ print " %s" % item
+ print ""
+ else:
+ print " %s: %s" % (var, val)
+api.register(envtest)
# Register some methods for the 'user' object:
class user_add(crud.Add):