From afdc72103847fc27efd00f8cc97a7320909ff6a0 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Mon, 29 Sep 2008 17:41:30 +0200 Subject: Add support for environment variables, change tests accordingly --- ipalib/plugins/example.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ipalib/plugins/example.py') 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): -- cgit