示例#1
0
    def search_containers(self, image, cids, output):
        f = Scan(image, cids, output, self.ac)
        try:
            if f.get_release():

                t = timeit.Timer(f.scan).timeit(number=1)
                logging.debug("Scanned chroot for image {0}"
                              " completed in {1} seconds"
                              .format(image, t))
                try:
                    timeit.Timer(f.report_results).timeit(number=1)
                    image_rpms = f._get_rpms()
                    self.rpms[image] = image_rpms
                except Exception as error:
                    self.failed_scan = str(error)
            else:
                # This is not a RHEL image or container
                f._report_not_rhel(image)
        except subprocess.CalledProcessError:
            pass

        # umount and clean up temporary container
        f.DM.unmount_path(f.dest)
        f.DM._clean_temp_container_by_path(f.dest)

        self.threads_complete += 1
        self.cur_scan_threads -= 1
示例#2
0
    def search_containers(self, image, cids, output):
        f = Scan(image, cids, output, self.ac)
        try:
            if f.get_release():

                t = timeit.Timer(f.scan).timeit(number=1)
                logging.debug("Scanned chroot for image {0}"
                              " completed in {1} seconds".format(image, t))
                try:
                    timeit.Timer(f.report_results).timeit(number=1)
                    image_rpms = f._get_rpms()
                    self.rpms[image] = image_rpms
                except Exception, error:
                    self.failed_scan = str(error)
            else:
示例#3
0
    def search_containers(self, image, cids, output):
        f = Scan(image, cids, output, self.ac)
        try:
            if f.get_release():

                t = timeit.Timer(f.scan).timeit(number=1)
                logging.debug("Scanned chroot for image {0}"
                              " completed in {1} seconds"
                              .format(image, t))
                try:
                    timeit.Timer(f.report_results).timeit(number=1)
                    image_rpms = f._get_rpms()
                    self.rpms[image] = image_rpms
                except Exception, error:
                    self.failed_scan = str(error)
            else:
示例#4
0
    def search_containers(self, image, cids, output):
        try:
            f = Scan(image, cids, output, self.ac)
        except Exception as e:
            # We don't know all types of docker/atomic exception, so we catch
            # all these exceptions to avoid daemon freezing
            self.failed_scan = str(e)
            self.threads_complete += 1
            self.cur_scan_threads -= 1
            return

        try:
            if f.get_release():

                t = timeit.Timer(f.scan).timeit(number=1)
                logging.debug("Scanned chroot for image {0}"
                              " completed in {1} seconds".format(image, t))
                try:
                    timeit.Timer(f.report_results).timeit(number=1)
                    image_rpms = f._get_rpms()
                    self.rpms[image] = image_rpms
                except Exception as error:
                    self.failed_scan = str(error)
            else:
                # This is not a RHEL image or container
                f._report_not_rhel(image)
        except subprocess.CalledProcessError:
            pass

        # umount and clean up temporary container
        try:
            f.unmount()
        except ValueError as e:
            logging.error("Unmount error: {}".format(e.msg))
        except Exception as e:
            # We don't know all types of docker/atomic exception, so we catch
            # all these exceptions to avoid daemon freezing
            logging.error("Docker: {}".format(e.msg()))

        self.threads_complete += 1
        self.cur_scan_threads -= 1
示例#5
0
    def search_containers(self, image, cids, output):
        try:
            f = Scan(image, cids, output, self.ac)
        except Exception as e:
            # We don't know all types of docker/atomic exception, so we catch
            # all these exceptions to avoid daemon freezing
            self.failed_scan = str(e)
            self.threads_complete += 1
            self.cur_scan_threads -= 1
            return

        try:
            if f.get_release():

                t = timeit.Timer(f.scan).timeit(number=1)
                logging.debug("Scanned chroot for image {0}"
                              " completed in {1} seconds"
                              .format(image, t))
                try:
                    timeit.Timer(f.report_results).timeit(number=1)
                    image_rpms = f._get_rpms()
                    self.rpms[image] = image_rpms
                except Exception as error:
                    self.failed_scan = str(error)
            else:
                # This is not a RHEL image or container
                f._report_not_rhel(image)
        except subprocess.CalledProcessError:
            pass

        # umount and clean up temporary container
        try:
            f.unmount()
        except ValueError as e:
            logging.error("Unmount error: {}".format(e.msg))
        except Exception as e:
            # We don't know all types of docker/atomic exception, so we catch
            # all these exceptions to avoid daemon freezing
            logging.error("Docker: {}".format(e.msg()))

        self.threads_complete += 1
        self.cur_scan_threads -= 1