def connect_infos(self, host, port, user, zone): """Same as connect but with information on the server in parameters port is an integer, host, user and zone are strings""" conn, err_msg = irods.rcConnect(host, port, user, zone) if not conn: self.conn = None return err_msg.status self.conn = conn return irods.clientLoginWithObfPassword(conn, self.cfg.password)
def rods_connect(): """ A basic iRODS connection mechanism that connects using the current iRODS environment """ status, env = irods.getRodsEnv() assert status == 0, 'connect(): getRodsEnv() failed (%s): %s' % ( status, irods.strerror( status ) ) conn, err = irods.rcConnect( env.rodsHost, env.rodsPort, env.rodsUserName, env.rodsZone ) assert err.status == 0, 'connect(): rcConnect() failed (%s): %s' % ( err.status, err.msg ) status, pw = irods.obfGetPw() assert status == 0, 'connect(): getting password with obfGetPw() failed (%s): %s' % ( status, irods.strerror( status ) ) status = irods.clientLoginWithObfPassword( conn, pw ) assert status == 0, 'connect(): logging in with clientLoginWithObfPassword() failed (%s): %s' % ( status, irods.strerror( status ) ) return env, conn