Skip to content

Commit

Permalink
Issue #221 Do a separate check, one for username, the other for passw…
Browse files Browse the repository at this point in the history
…ord.

If the username is missing, continue to log an error and raise a NameError.
However, if the password is missing, log a warning and continue, to support cloud-based
instances.
  • Loading branch information
bikegeek committed Aug 7, 2023
1 parent efafc22 commit f2bf469
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions METdbLoad/ush/read_load_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,13 @@ def read_db_connect(self, root):
root.xpath('connection')[0].xpath('user')[0].text
self.connection['db_password'] = \
root.xpath('connection')[0].xpath('password')[0].text

if ((not self.connection['db_user']):
logging.warning("!!! XML expecting user and password tags")
raise NameError("Missing required user tag")

# For AWS users, an empty password is acceptable.
if ((not self.connection['db_user']) or
(not self.connection['db_password'])):
if not self.connection['db_password']:
logging.warning("!!! XML expecting user and password tags")

if root.xpath('connection')[0].xpath('management_system'):
Expand Down

0 comments on commit f2bf469

Please sign in to comment.