All pastes #1066323 Raw Edit

Miscellany

public diff v1 · immutable
#1066323 ·published 2008-07-09 04:43 UTC
rendered paste body
diff --git a/client/fas.conf b/client/fas.confindex 5fdb1bb..bc87ead 100644--- a/client/fas.conf+++ b/client/fas.conf@@ -64,3 +64,7 @@ ssh_restricted_shell = /bin/bash ; ssh_restricted_groups will have the keys they uploaded altered when they are ; installed on this machine, appended with the options below. ssh_key_options = no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty++[plugins]++plugin_dir = /usr/libexec/fasdiff --git a/client/fasClient b/client/fasClientindex 97ae4f4..9f9e15f 100755--- a/client/fasClient+++ b/client/fasClient@@ -82,6 +82,11 @@ parser.add_option('--nossh',                      default = False,                      action = 'store_true',                      help = _('Do not create ssh keys'))+parser.add_option('--noplugins',+                     dest = 'no_plugins',+                     default = False,+                     action = 'store_true',+                     help = _('Do not execute any plugins')) parser.add_option('-s', '--server',                      dest = 'FAS_URL',                      default = None,@@ -538,7 +543,24 @@ class MakeShellAccounts(BaseClient):             for role in members:                 email_file.write("%s-%s: %s\n" % (name, role, ','.join(members[role])))         email_file.close()-                    ++    def run_plugins(self):+        plugins_dir = config.get('plugins', 'plugins_dir').strip('"')++        plugin_names = set()+        for filename in os.path.listdir(plugins_dir):+            plugin_names.add(os.path.splitext(filename))++        for plugin_name in plugin_names:+            try:+                file, pathname, description = imp.find_module(plugin_name, [plugins_dir])+                plugin = imp.load_module(module_name, file, pathname, description)+                plugin.execute(config, self)+            except ImportError:+                pass+            except AttributeError:+                pass+         def enable():     temp = tempfile.mkdtemp('-tmp', 'fas-', config.get('global', 'temp').strip('"')) @@ -611,6 +633,8 @@ if __name__ == '__main__':             fas.remove_stale_homedirs()         if not opts.no_ssh_keys:             fas.create_ssh_keys()+        if not opts.no_plugins:+            fas.run_plugins()         fas.rm_tempdir()         fas.logout()     if opts.aliases: