示例#1
0
def startItUp():
    conn = meConnector.createEC2connection()
    try:
        strayInstances = False
        meReservations = conn.get_all_instances()
        for reservation in meReservations:
            for instance in reservation.instances:
                if (instance.state != 'terminated'):
                    strayInstances = True
                    badInstance = instance
    except Exception, e:
        meTools.mailIt(email,'Error with get_all_instances()!', 'Exception:\n\n%s' % e)
示例#2
0
 def post(self):
     instanceID = str(self.request.get('instanceID'))
     conn = meConnector.createEC2connection()
     try:
         meInstances = conn.get_all_instances(instanceID)
         for reservation in meInstances:
             for instance in reservation.instances:
                 if instance.state == 'running':
                     meTools.mailIt(email,'Instance Running!','InstanceID: %s is %s' % (instance.id,instance.state))
                 elif instance.state == 'terminated':
                     meTools.mailIt(email,'Instance Terminated?!','InstanceID: %s is %s' % (instance.id,instance.state))
                 else:
                     addChkInstanceTask(instanceID)
                     meTools.mailIt(email,'Instance NOT Running!','Trying again in 50 seconds.\nInstanceID: %s is %s' %
                                                                                (instance.id,instance.state))
     except Exception, e:
         meTools.mailIt(email,'Error with get_all_instances()!', 'Exception:\n\n%s' % e)