def _create_connection(self): if None is self.connection: logger.debug('creating connection') # Updater automatically let kinit take ``KRB5_KTNAME`` # variable. If /etc/krb5.keytab doesn't exist, krbticket # tries to update the ticket with ``kinit -R`` as much as # possible. self.ticket = KrbTicket.get_or_init(self.username) self.ticket.updater_start() connection = hdfs.connect() assert connection is not None self.connection = connection # set nameservice _file_in_root = self.connection.ls("/")[0] self.nameservice = _file_in_root[:_file_in_root.rfind("/")]
def test_get_or_init(config): KrbCommand.kdestroy(config) ticket0 = KrbTicket.get_or_init(DEFAULT_PRINCIPAL, DEFAULT_KEYTAB) ticket1 = KrbTicket.get_or_init(DEFAULT_PRINCIPAL, DEFAULT_KEYTAB) assert_ticket(ticket0, ticket1)