Пример #1
0
def scan(images=True):
    """ scanning method that will scan all images or containers """

    client = DockerClient()
    emu = Emulator()

    objs = client.images() if images is True else client.containers()

    # If there are no images/containers on the machine, objs will be ['']
    if objs == ['']:
        return

    # does actual work here!
    for im in objs:
        try:
            emu.create_dirs()
            mount_obj(emu.tmp_image_dir, im, client.info()['Storage Driver'])

            if emu.is_applicable():

                print "scanning " + im[:12]
                emu.intial_setup()

                emu.chroot_and_run()

                emu.unmount()
            else:
                print im[:12] + " is not RHEL based"

            unmount_obj(emu.tmp_image_dir, client.info()['Storage Driver'])
            emu.remove_dirs()

        except MountError as dme:
            raise ValueError(str(dme))

    emu.gather_data(images)
Пример #2
0
def scan(images=True):
    """ scanning method that will scan all images or containers """

    client = DockerClient()
    emu = Emulator()

    objs = client.images() if images is True else client.containers()

    # If there are no images/containers on the machine, objs will be ['']
    if objs == ['']:
        return

    # does actual work here!
    for im in objs:
        try:
            emu.create_dirs()
            mount_obj(emu.tmp_image_dir, im, client.info()['Storage Driver'])

            if emu.is_applicable():

                print "scanning " + im[:12]
                emu.intial_setup()

                emu.chroot_and_run()

                emu.unmount()
            else:
                print im[:12] + " is not RHEL based"

            unmount_obj(emu.tmp_image_dir, client.info()['Storage Driver'])
            emu.remove_dirs()

        except MountError as dme:
            raise ValueError(str(dme))

    emu.gather_data(images)