diff options
author | John Eckersberg <jeckersb@redhat.com> | 2008-01-21 00:08:18 -0500 |
---|---|---|
committer | John Eckersberg <jeckersb@redhat.com> | 2008-01-21 00:08:18 -0500 |
commit | 768a14b36a15aedaa0b8e8bdf626b5bcc45704f8 (patch) | |
tree | 09b7f3408124525721fea03624490b586544260c /func | |
parent | 4c33d7b726bea55a4cfbd4e5034041a8ed8416f1 (diff) | |
download | func-768a14b36a15aedaa0b8e8bdf626b5bcc45704f8.tar.gz func-768a14b36a15aedaa0b8e8bdf626b5bcc45704f8.tar.xz func-768a14b36a15aedaa0b8e8bdf626b5bcc45704f8.zip |
clean up sshing and flesh out how the create function works.
this should be the template for everything else.
Diffstat (limited to 'func')
-rw-r--r-- | func/minion/modules/netapp/common.py | 8 | ||||
-rw-r--r-- | func/minion/modules/netapp/vol.py | 34 |
2 files changed, 30 insertions, 12 deletions
diff --git a/func/minion/modules/netapp/common.py b/func/minion/modules/netapp/common.py index 53d46d6..ab63cbc 100644 --- a/func/minion/modules/netapp/common.py +++ b/func/minion/modules/netapp/common.py @@ -2,6 +2,8 @@ import subprocess SSH = '/usr/bin/ssh' +class GenericSSHException(Exception): pass + def ssh(user, host, command): cmd = subprocess.Popen([SSH, "%s@%s" % (user, host), command], executable=SSH, @@ -11,4 +13,8 @@ def ssh(user, host, command): shell=False) (out, err) = cmd.communicate() - return out + + if err: + raise GenericSSHException, err + else: + return out diff --git a/func/minion/modules/netapp/vol.py b/func/minion/modules/netapp/vol.py index ca3981c..ff70ce2 100644 --- a/func/minion/modules/netapp/vol.py +++ b/func/minion/modules/netapp/vol.py @@ -12,7 +12,12 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## +import re from func.minion.modules import func_module +from common import * + +class NetappCommandError(Exception): pass + class Vol(func_module.FuncModule): # Update these if need be. @@ -20,61 +25,68 @@ class Vol(func_module.FuncModule): api_version = "0.0.1" description = "Interface to the 'vol' command" - def create(self, *args): + def create(self, filer, *args): """ TODO: Document me ... """ - pass + + create_re = """Creation of volume .* has completed.""" + + output = ssh('root', filer, ' '.join(args)) + if re.search(create_re, output): + return True + else: + raise NetappCommandError, output - def clone(self, *args): + def clone(self, filer, *args): """ TODO: Document me ... """ pass - def destroy(self): + def destroy(self, filer, *args): """ TODO: Document me ... """ pass - def offline(self): + def offline(self, filer, *args): """ TODO: Document me ... """ pass - def status(self): + def status(self, filer, *args): """ TODO: Document me ... """ pass - def size(self): + def size(self, filer, *args): """ TODO: Document me ... """ pass - def options(self): + def options(self, filer, *args): """ TODO: Document me ... """ pass - def rename(self): + def rename(self, filer, *args): """ TODO: Document me ... """ pass - def restrict(self): + def restrict(self, filer, *args): """ TODO: Document me ... """ pass - def split(self): + def split(self, filer, *args): """ TODO: Document me ... """ |