src/cmd-koji-upload: conditionally use an explicit path for Python imports
When run in the RHCOS pipeline, the `koji-upload` command has trouble
sensing the correct path to do the import of `cosalib`.  This change
allows us to catch the ImportError and try an explicit path instead.
@@ -36,6 +36,11 @@ cosa_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, ("%s/cosalib" % cosa_dir))
sys.path.insert(0, cosa_dir)
+try:
+ from cosalib.build import _Build
+except ImportError:
+ # We're in the container and can't sense the cosa path
+ sys.path.insert(0, '/usr/lib/coreos-assembler/cosalib')
from cosalib.build import _Build
import koji
