def add_client(self): conn = self.pyrfc.Connection(user=self.config.user, passwd=self.config.password, ashost=self.config.host, sysnr=self.config.sysnr, client=self.config.client) try: ping_sap(conn) except Exception, e: self.logger.warn('Could not ping SAP (%s), e:`%s`', self.config.name, format_exc(e))
def handle(self): with closing(self.odb.session()) as session: item = session.query(OutgoingSAP).filter_by(id=self.request.input.id).one() with self.outgoing.sap[item.name].conn.client() as client: start_time = time() ping_sap(client) response_time = time() - start_time self.response.payload.info = 'Ping OK, took:`{0:03.4f} s`'.format(response_time)
def add_client(self): # Decrypt the password if it is encrypted. if self.config.password.startswith(SECRETS.PREFIX): self.config.password = self.server.decrypt(self.config.password) conn = self.pyrfc.Connection(user=self.config.user, passwd=self.config.password, ashost=self.config.host, sysnr=self.config.sysnr, client=self.config.client) try: ping_sap(conn) except Exception: self.logger.warn('Could not ping SAP (%s), e:`%s`', self.config.name, format_exc()) self.client.put_client(conn)