diff options
author | John Eckersberg <jeckersb@redhat.com> | 2008-01-27 17:46:14 -0500 |
---|---|---|
committer | John Eckersberg <jeckersb@redhat.com> | 2008-01-27 17:46:14 -0500 |
commit | 795ceeca5b8f62a0e9d370f083f317ebda1f7d57 (patch) | |
tree | 443154f05c37da429f6f004526f5a8c48bebfe77 /func/minion | |
parent | 16fa763ad4af4dff50ec50339614ac8a592e8590 (diff) | |
download | third_party-func-795ceeca5b8f62a0e9d370f083f317ebda1f7d57.tar.gz third_party-func-795ceeca5b8f62a0e9d370f083f317ebda1f7d57.tar.xz third_party-func-795ceeca5b8f62a0e9d370f083f317ebda1f7d57.zip |
Load classes under __init__ objects to break this down some more
Diffstat (limited to 'func/minion')
-rwxr-xr-x | func/minion/module_loader.py | 10 | ||||
-rw-r--r-- | func/minion/modules/netapp/vol/__init__.py (renamed from func/minion/modules/netapp/vol.py) | 8 | ||||
-rw-r--r-- | func/minion/modules/netapp/vol/clone.py | 45 |
3 files changed, 50 insertions, 13 deletions
diff --git a/func/minion/module_loader.py b/func/minion/module_loader.py index 37bc515..3068ea8 100755 --- a/func/minion/module_loader.py +++ b/func/minion/module_loader.py @@ -32,9 +32,6 @@ def module_walker(topdir): for filename in files: # ASSUMPTION: all module files will end with .py, .pyc, .pyo if filename[-3:] == ".py" or filename[-4:] == ".pyc" or filename[-4:] == ".pyo": - # we don't really care about __init__ files, though we do requure them - if filename[:8] == "__init__": - continue # the normpath is important, since we eventually replace /'s with .'s # in the module name, and foo..bar doesnt work -akl module_files.append(os.path.normpath("%s/%s" % (root, filename))) @@ -59,9 +56,10 @@ def load_modules(blacklist=None): module_name_part = fn[len(module_file_path):] dirname, basename = os.path.split(module_name_part) - if basename == "__init__.py": - continue - if basename[-3:] == ".py": + if basename[:8] == "__init__": + modname = dirname + dirname = "" + elif basename[-3:] == ".py": modname = basename[:-3] elif basename[-4:] in [".pyc", ".pyo"]: modname = basename[:-4] diff --git a/func/minion/modules/netapp/vol.py b/func/minion/modules/netapp/vol/__init__.py index d0bb3d9..b1ee2fe 100644 --- a/func/minion/modules/netapp/vol.py +++ b/func/minion/modules/netapp/vol/__init__.py @@ -14,7 +14,7 @@ import re from func.minion.modules import func_module -from common import * +from func.minion.modules.netapp.common import * class Vol(func_module.FuncModule): @@ -36,12 +36,6 @@ class Vol(func_module.FuncModule): output = ssh('root', filer, cmd_opts) return check_output(regex, output) - def clone(self, filer, args): - """ - TODO: Document me ... - """ - pass - def destroy(self, filer, args): """ TODO: Document me ... diff --git a/func/minion/modules/netapp/vol/clone.py b/func/minion/modules/netapp/vol/clone.py new file mode 100644 index 0000000..82b6723 --- /dev/null +++ b/func/minion/modules/netapp/vol/clone.py @@ -0,0 +1,45 @@ +## +## NetApp Filer 'vol.clone' Module +## +## Copyright 2007, Red Hat, Inc +## John Eckersberg <jeckersb@redhat.com> +## +## This software may be freely redistributed under the terms of the GNU +## general public license. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## + +import re +from func.minion.modules import func_module +from func.minion.modules.netapp.common import * + +class Clone(func_module.FuncModule): + + # Update these if need be. + version = "0.0.1" + api_version = "0.0.1" + description = "Interface to the 'vol' command" + + def create(self, filer, args): + """ + TODO: Document me ... + """ + return True + regex = """Creation of volume .* has completed.""" + param_check(args, ['name', 'aggr', 'size']) + + cmd_opts = ['vol', 'create'] + cmd_opts.extend([args['name'], args['aggr'], args['size']]) + + output = ssh('root', filer, cmd_opts) + return check_output(regex, output) + + def split(self, filer, args): + """ + TODO: Document me ... + """ + return True + |