File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
reportportal_client/services Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
3
## [ Unreleased]
4
+ ### Fixed
5
+ - Client crash in case of Client ID saving error, by @HardNorth
4
6
5
7
## [ 5.3.1]
6
8
### Added
Original file line number Diff line number Diff line change 15
15
16
16
import configparser
17
17
import io
18
+ import logging
18
19
import os
19
20
from uuid import uuid4
20
21
24
25
RP_PROPERTIES_FILE_PATH
25
26
26
27
28
+ logger = logging .getLogger (__name__ )
29
+ logger .addHandler (logging .NullHandler ())
30
+
27
31
class __NoSectionConfigParser (configparser .ConfigParser ):
28
32
DEFAULT_SECTION = 'DEFAULT'
29
33
@@ -64,12 +68,16 @@ def _read_client_id():
64
68
65
69
def _store_client_id (client_id ):
66
70
config = __read_config ()
67
- if not os .path .exists (RP_FOLDER_PATH ):
68
- os .makedirs (RP_FOLDER_PATH )
69
- config .set (__NoSectionConfigParser .DEFAULT_SECTION , CLIENT_ID_PROPERTY ,
70
- client_id )
71
- with open (RP_PROPERTIES_FILE_PATH , 'w' ) as fp :
72
- config .write (fp )
71
+ try :
72
+ if not os .path .exists (RP_FOLDER_PATH ):
73
+ os .makedirs (RP_FOLDER_PATH )
74
+ config .set (__NoSectionConfigParser .DEFAULT_SECTION , CLIENT_ID_PROPERTY ,
75
+ client_id )
76
+ with open (RP_PROPERTIES_FILE_PATH , 'w' ) as fp :
77
+ config .write (fp )
78
+ except (PermissionError , IOError ) as error :
79
+ logger .exception ('[%s] Unknown exception has occurred. '
80
+ 'Skipping client ID saving.' , error )
73
81
74
82
75
83
def get_client_id ():
You can’t perform that action at this time.
0 commit comments