diff options
author | Peter Amstutz | 2020-04-30 11:53:15 -0400 |
---|---|---|
committer | Peter Amstutz | 2020-04-30 12:01:37 -0400 |
commit | e3d45f22bf1943bcba5b09a7e78254ebaacf9f95 (patch) | |
tree | 53c41d60016b3628e6cc8b7c4660635ffc9f62ad /bh20sequploader/main.py | |
parent | 5c05facbdb1e35556256cd11d6a814822ebb6159 (diff) | |
download | bh20-seq-resource-e3d45f22bf1943bcba5b09a7e78254ebaacf9f95.tar.gz bh20-seq-resource-e3d45f22bf1943bcba5b09a7e78254ebaacf9f95.tar.lz bh20-seq-resource-e3d45f22bf1943bcba5b09a7e78254ebaacf9f95.zip |
Handle running in a container with no username
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
Diffstat (limited to 'bh20sequploader/main.py')
-rw-r--r-- | bh20sequploader/main.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py index 4c4711d..10d1029 100644 --- a/bh20sequploader/main.py +++ b/bh20sequploader/main.py @@ -62,11 +62,16 @@ def main(): external_ip = urllib.request.urlopen('https://ident.me').read().decode('utf8') + try: + username = getpass.getuser() + except KeyError: + username = "unknown" + properties = { "sequence_label": seqlabel, "upload_app": "bh20-seq-uploader", "upload_ip": external_ip, - "upload_user": "%s@%s" % (getpass.getuser(), socket.gethostname()) + "upload_user": "%s@%s" % (username, socket.gethostname()) } col.save_new(owner_uuid=UPLOAD_PROJECT, name="%s uploaded by %s from %s" % |