File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 11import errno
22import json
33import os
4+ import platform
45import stat
56import sys
67import time
78from datetime import datetime , timedelta , timezone
9+ from pathlib import Path
810from urllib .parse import parse_qs
911
1012import jwt
@@ -441,6 +443,18 @@ def get_auth_provider(
441443 pass
442444 # ELSE
443445 if interactive :
446+ lockfile_path = Path .home () / ".config/chromium/SingletonLock"
447+
448+ if Path (lockfile_path ).is_symlink () and not str (
449+ Path (lockfile_path ).resolve ()
450+ ).__contains__ (platform .node ()):
451+ # https://github.com/equinor/sumo-wrapper-python/issues/193
452+ print (
453+ "\n \n \033 [1mDetected chromium lockfile for different node; using firefox to authenticate.\033 [0m"
454+ )
455+ os .environ ["BROWSER" ] = "firefox"
456+ pass
457+
444458 return AuthProviderInteractive (client_id , authority , resource_id )
445459 # ELSE
446460 if devicecode :
Original file line number Diff line number Diff line change 11import logging
2- import platform
32from argparse import ArgumentParser
4- from pathlib import Path
53
64from sumo .wrapper import SumoClient
75
@@ -69,16 +67,6 @@ def main():
6967 if mode != "silent" :
7068 print ("Login to Sumo environment: " + env )
7169
72- if mode == "interactive" :
73- lockfile_path = Path .home () / ".config/chromium/SingletonLock"
74-
75- if Path (lockfile_path ).is_symlink () and not str (
76- Path (lockfile_path ).resolve ()
77- ).__contains__ (platform .node ()):
78- # https://github.com/equinor/sumo-wrapper-python/issues/193
79- is_interactive = False
80- is_devicecode = True
81-
8270 sumo = SumoClient (
8371 env ,
8472 interactive = is_interactive ,
You can’t perform that action at this time.
0 commit comments