(self, rdb)
This will edit a health check with the supplied information
This will edit a health check with the supplied information
This will edit a health check with the supplied information
def editMonitor(self, rdb):
        ''' This will edit a health check with the supplied information '''
        if self.config['CRYPTO_ENABLED'] is True:
            crypto = Fernet(self.config['CRYPTO_KEY'])
            try:
                self.data = crypto.encrypt(json.dumps(self.data))
            except:
                return False
            self.encrypted = True
        mondata = {
            'name': self.name,
            'ctype': self.ctype,
            'uid': self.uid,
            'url': self.url,
            'failcount': 0,
            'status': self.status,
            'data': self.data,
            'encrypted' : self.encrypted
        }
        results = r.table('monitors').get(self.cid).update(mondata).run(rdb)
        if results['replaced'] == 1:
            qdata = {}
            qdata['item'] = mondata
            qdata['action'] = 'edit'
            qdata['type'] = 'monitor'
            qdata['item']['cid'] = self.cid
            for dc in ["dc1queue", "dc2queue"]:
                q1 = r.table(dc).insert(qdata).run(rdb)
            return True
        else:
            return False
def editMonitor ( self , rdb ) : if self . config [ 'CRYPTO_ENABLED' ] is True : crypto = Fernet ( self . config [ 'CRYPTO_KEY' ] ) try : self . data = crypto . encrypt ( json . dumps ( self . data ) ) except : return False self . encrypted = True mondata = { 'name' : self . name , 'ctype' : self . ctype , 'uid' : self . uid , 'url' : self . url , 'failcount' : 0 , 'status' : self . status , 'data' : self . data , 'encrypted' : self . encrypted } results = r . table ( 'monitors' ) . get ( self . cid ) . update ( mondata ) . run ( rdb ) if results [ 'replaced' ] == 1 : qdata = { } qdata [ 'item' ] = mondata qdata [ 'action' ] = 'edit' qdata [ 'type' ] = 'monitor' qdata [ 'item' ] [ 'cid' ] = self . cid for dc in [ "dc1queue" , "dc2queue" ] : q1 = r . table ( dc ) . insert ( qdata ) . run ( rdb ) return True else : return False