Skip to content

Commit

Permalink
Some code format updates
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Apr 26, 2023
1 parent 734c4e1 commit ec37ce6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions reportportal_client/services/client_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ def _read_client_id():

def _store_client_id(client_id):
config = __read_config()
try:
if not os.path.exists(RP_FOLDER_PATH):
os.makedirs(RP_FOLDER_PATH)
config.set(__NoSectionConfigParser.DEFAULT_SECTION, CLIENT_ID_PROPERTY,
client_id)
with open(RP_PROPERTIES_FILE_PATH, 'w') as fp:
config.write(fp)
except (PermissionError, IOError) as error:
logger.exception('[%s] Unknown exception has occurred. '
'Skipping client ID saving.', error)
if not os.path.exists(RP_FOLDER_PATH):
os.makedirs(RP_FOLDER_PATH)
config.set(__NoSectionConfigParser.DEFAULT_SECTION, CLIENT_ID_PROPERTY,
client_id)
with open(RP_PROPERTIES_FILE_PATH, 'w') as fp:
config.write(fp)


def get_client_id():
"""Return unique client ID of the instance, generate new if not exists."""
client_id = _read_client_id()
if not client_id:
client_id = str(uuid4())
_store_client_id(client_id)
try:
_store_client_id(client_id)
except (PermissionError, IOError) as error:
logger.exception('[%s] Unknown exception has occurred. '
'Skipping client ID saving.', error)
return client_id

0 comments on commit ec37ce6

Please sign in to comment.