Skip to content

Commit

Permalink
getting the user's login name is now more robust via getpass.getuser
Browse files Browse the repository at this point in the history
  • Loading branch information
ndenny committed Jun 4, 2024
1 parent 4e6c5ca commit ec58699
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Bastion/HPSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import json
import socket
import logging
import getpass

from Bastion.Common import Thing, Unknown
import Bastion.Model
Expand Down Expand Up @@ -216,7 +217,7 @@ def __delitem__(self, path):
class HSI:
def __init__(self, xpath = None, **kwargs):
self.xpath = pathlib.Path( kwargs.get('xpath', "/usr/local/bin/hsi") )
self.login = kwargs.get('login', os.getlogin())
self.login = kwargs.get('login', getpass.getuser())
self.keytab = pathlib.Path(kwargs.get('keytab', '~/.private/hpss.unix.keytab')).expanduser()
self.procd = None

Expand Down Expand Up @@ -323,7 +324,7 @@ class Vault(Bastion.Model.Vault):
def __init__(self, name, **kwargs):
self.name = name
self.server = kwargs.get('server', socket.gethostname())
self.login = kwargs.get('login', os.getlogin())
self.login = kwargs.get('login', getpass.getuser())
self.keytab = pathlib.Path( kwargs.get('keytab', "~/.private/hpss.unix.keytab") ).expanduser()
self.root = kwargs.get('root', None)
self.hpath = pathlib.Path( kwargs.get('hpath', '/opt/hsi') )
Expand Down

0 comments on commit ec58699

Please sign in to comment.