From 03137e5c0ae1af95a139666b88fa236abea720a5 Mon Sep 17 00:00:00 2001
From: Jan Kaluza <jkaluza@redhat.com>
Date: Oct 17 2017 07:35:54 +0000
Subject: Use 'no_deps' when asking for odcs compose and define sigkeys. Also fix logging in various places.


---

diff --git a/freshmaker/config.py b/freshmaker/config.py
index 59c949a..f962379 100644
--- a/freshmaker/config.py
+++ b/freshmaker/config.py
@@ -250,6 +250,10 @@ class Config(object):
             'type': bool,
             'default': True,
             'desc': 'Whether to enable SSL verification over HTTP with ODCS.'},
+        'odcs_sigkeys': {
+            'type': list,
+            'default': [],
+            'desc': 'List of sigkeys IDs to use when requesting compose.'},
         'krb_auth_using_keytab': {
             'type': bool,
             'default': True,
diff --git a/freshmaker/errata.py b/freshmaker/errata.py
index afbbc83..940b002 100644
--- a/freshmaker/errata.py
+++ b/freshmaker/errata.py
@@ -155,6 +155,7 @@ class Errata(object):
 
         # For each NVR, check that all the rpms are signed.
         for nvr in nvrs:
+            log.info("Checking whether the build %s is signed", str(nvr))
             build = self._errata_rest_get("build/%s" % str(nvr))
             if "rpms_signed" not in build or not build["rpms_signed"]:
                 return False
diff --git a/freshmaker/handlers/errata/errata_advisory_rpms_signed.py b/freshmaker/handlers/errata/errata_advisory_rpms_signed.py
index 663f0f6..701331b 100644
--- a/freshmaker/handlers/errata/errata_advisory_rpms_signed.py
+++ b/freshmaker/handlers/errata/errata_advisory_rpms_signed.py
@@ -206,7 +206,8 @@ class ErrataAdvisoryRPMsSignedHandler(BaseHandler):
         if not conf.dry_run:
             with krb_context():
                 new_compose = odcs.new_compose(
-                    compose_source, 'tag', packages=packages)
+                    compose_source, 'tag', packages=packages,
+                    sigkeys=conf.odcs_sigkeys, flags=["no_deps"])
         else:
             new_compose = self._fake_odcs_new_compose(
                 compose_source, 'tag', packages=packages)
diff --git a/freshmaker/lightblue.py b/freshmaker/lightblue.py
index a6c8894..235fed2 100644
--- a/freshmaker/lightblue.py
+++ b/freshmaker/lightblue.py
@@ -210,7 +210,8 @@ class ContainerImage(dict):
         # must be the same by definition.
         if "repositories" not in self or len(self["repositories"]) == 0:
             log.warning("Container image %s does not have 'repositories' set "
-                        "in Lightblue, this is suspicious.")
+                        "in Lightblue, this is suspicious.",
+                        self["brew"]["build"])
             self.update({"content_sets": []})
             return
 
@@ -678,10 +679,14 @@ class LightBlue(object):
 
                     children_image_layers_count = parent_build_layers_count + 1
                     if parent is None and children_image_layers_count > 2:
-                        log.error(
-                            'No parent image is found from LightBlue, whose '
-                            'top layer is %s and which has %d layers',
-                            parent_top_layer, parent_build_layers_count)
+                        err = "Cannot find parent of image %s with layer %s " \
+                            "and layer count %d in Lightblue, Lightblue data " \
+                            "is probably incomplete" % (
+                                image['brew']['build'], parent_top_layer,
+                              parent_build_layers_count)
+                        log.error(err)
+                        if not images[-1]['error']:
+                            images[-1]['error'] = err
 
                     if parent:
                         parent.resolve_content_sets(self)
@@ -778,6 +783,15 @@ class LightBlue(object):
                 if parent:
                     parent.resolve_content_sets(self)
                     parent.resolve_commit(srpm_name)
+                elif len(layers) > 2:
+                    err = "Cannot find parent of image %s with layer %s " \
+                          "and layer count %d in Lightblue, Lightblue data " \
+                          "is probably incomplete" % (
+                              image['brew']['build'], layers[1],
+                              len(layers) - 1)
+                    log.error(err)
+                    if not image['error']:
+                        image['error'] = err
                 image['parent'] = parent
             rebuild_list.insert(0, image)
             return rebuild_list

