Skip to content

Commit

Permalink
Print warning when failed to register a graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo F committed Feb 11, 2024
1 parent d9c43d1 commit 52c8bca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tuptime
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def output_hub(db_rows, sis, arg):
if arg.endst != db_rows[-1]['endst']:
# Graceful register must be performed at shutdown by the init manager, with _tuptime user
# or a privileged one. No one needs to do in other moment. A normal user can't write into DB
print('Graceful shutdown in DB = mismatch. Are you allowed?')
print('Graceful shutdown in DB = mismatch')
sys.exit(1)
print('Graceful shutdown in DB = ok')
return
Expand Down Expand Up @@ -1263,10 +1263,11 @@ def main():
db_conn.commit()
logging.info('DB info = update ok')

except sqlite3.OperationalError:
except sqlite3.OperationalError as exc:
if arg.endst:
logging.warning('DB warning = skip register a graceful shutdown')
logging.info('DB info = skip update')
logging.warning('DB warning = skip register a graceful shutdown, %s', exc)
else:
logging.info('DB info = skip update values, %s', exc)

else:
logging.info('DB info = skip by arg.update')
Expand Down

0 comments on commit 52c8bca

Please sign in to comment.