From 7ade8c1f38efaa8817bd10df6b0928ef70822f6e Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: May 16 2023 22:32:47 +0000 Subject: `commit` command fails on 'containers' namespace Commit failed when 'uses_rpmautospec' tried to search for a specfile. There is no specfile in 'containers' namespace repository. JIRA: RHELCMP-11734 Signed-off-by: Ondrej Nosek --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index f14b055..b45ad8f 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -1872,8 +1872,15 @@ class Commands(object): # construct the git command # We do this via subprocess because the git module is terrible. cmd = ['git', 'commit'] - if not self.is_retired() and self.uses_rpmautospec: - cmd.append('--allow-empty') + if not self.is_retired(): + try: + # raises exception when a specfile is missing + # (for example when processing "containers" namespace repository) + uses_rpmautospec = self.uses_rpmautospec + except Exception: + uses_rpmautospec = False + if uses_rpmautospec: + cmd.append('--allow-empty') if signoff: cmd.append('-s') if self.quiet: