added --node option throughout calls
[monitor.git] / grouprins.py
index 5ebe912..eb89e6a 100755 (executable)
@@ -17,14 +17,14 @@ from monitor import util
 from monitor import const
 from monitor import database
 from monitor import parser as parsermodule
-from monitor.pcu import reboot
+from monitor import reboot
 from monitor.wrapper import plc
 api = plc.getAuthAPI()
 
 import traceback
 from optparse import OptionParser
 
-from nodecommon import *
+from monitor.common import *
 from nodequery import verify,query_to_dict,node_select
 from monitor.model import *
 import os
@@ -33,7 +33,7 @@ import time
 
 import bootman                 # debug nodes
 import mailmonitor     # down nodes without pcu
-from emailTxt import mailtxt
+from monitor.wrapper.emailTxt import mailtxt
 import sys
 
 class Reboot(object):
@@ -73,6 +73,7 @@ class Reboot(object):
                                        return ret
 
                                except Exception,e:
+                                       email_exception()
                                        print traceback.print_exc(); print e
 
                                        # NOTE: this failure could be an implementation issue on
@@ -95,6 +96,7 @@ class Reboot(object):
                                        return ret
 
                                except Exception,e:
+                                       email_exception()
                                        print traceback.print_exc(); print e
 
                                        # NOTE: this failure could be an implementation issue on
@@ -138,6 +140,7 @@ class Reboot(object):
                try:
                        return mailmonitor.reboot(host)
                except Exception, e:
+                       email_exception(host)
                        print traceback.print_exc(); print e
                        return False
 
@@ -261,6 +264,7 @@ for host in hostnames:
                try:
                        node = api.GetNodes(host)[0]
                except:
+                       email_exception()
                        print traceback.print_exc(); 
                        print "FAILED GETNODES for host: %s" % host
                        continue
@@ -285,6 +289,7 @@ for host in hostnames:
                                        # todo: send thank you, etc.
                                        mailmonitor.reboot(host)
                                except Exception, e:
+                                       email_exception()
                                        print traceback.print_exc(); print e
 
                                continue
@@ -355,6 +360,7 @@ for host in hostnames:
                print "Killed by interrupt"
                sys.exit(0)
        except:
+               email_exception()
                print traceback.print_exc();
                print "Continuing..."