Skip to content

Commit

Permalink
Ticket: log properties if they are not in ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Sep 21, 2024
1 parent 4f1dce0 commit b4a74ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions voctopublish/model/ticket_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import re
from os.path import join

LOG = logging.getLogger('Ticket')

class Ticket:
"""
Expand Down Expand Up @@ -57,14 +58,15 @@ def _get_str(self, key, optional=False, try_default=False):
value = self.__get_property(key)
if not value:
if try_default:
logging.warning(
LOG.warning(
f"optional property '{key}' was not in ticket, trying default"
)
value = self.__get_default(key)
elif optional:
logging.warning(f"optional property '{key}' was not in ticket")
LOG.warning(f"optional property '{key}' was not in ticket")
if not optional and value in (None, ""):
raise TicketException(f"Property '{key}' is missing or empty in ticket")
LOG.debug(f"{key!r} = {value!r}")
return value

def _get_list(self, key, optional=False, try_default=False, split_by=","):
Expand Down

0 comments on commit b4a74ab

Please sign in to comment.