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
def get_password(self): """Get The obfuscated password, obtained from .irodsA. Returns a string""" _, obf_password = irods.obfGetPw() return self.encode(obf_password)