def test_katello_pkg_goes_to_signed(current_actor_context):
    installed_rpm = [
        RPM(name='katello-ca-consumer-vm-098.example.com',
            version='1.0',
            release='1',
            epoch='(none)',
            packager='None',
            arch='noarch',
            pgpsig=''),
    ]

    current_actor_context.feed(InstalledRPM(items=installed_rpm))
    current_actor_context.run(config_model=mock_configs.CONFIG_ALL_SIGNED)
    assert current_actor_context.consume(InstalledRedHatSignedRPM)
    assert len(current_actor_context.consume(InstalledRedHatSignedRPM)[0].items) == 1
    assert not current_actor_context.consume(InstalledUnsignedRPM)[0].items
def test_all_rpms_signed(current_actor_context):
    installed_rpm = [
        RPM(name='sample01', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
            pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'),
        RPM(name='sample02', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample03', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
            pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 5326810137017186'),
        RPM(name='sample04', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
            pgpsig='SOME_OTHER_SIG_X')
    ]

    current_actor_context.feed(InstalledRPM(items=installed_rpm))
    current_actor_context.run(config_model=mock_configs.CONFIG_ALL_SIGNED)
    assert current_actor_context.consume(InstalledRedHatSignedRPM)
    assert len(current_actor_context.consume(InstalledRedHatSignedRPM)[0].items) == 4
    assert not current_actor_context.consume(InstalledUnsignedRPM)[0].items
Beispiel #3
0
    def process(self):
        output = get_installed_rpms()

        result = InstalledRPM()
        for entry in output:
            entry = entry.strip()
            if not entry:
                continue
            name, version, release, epoch, packager, arch, pgpsig = entry.split('|')
            result.items.append(RPM(
                name=name,
                version=version,
                epoch=epoch,
                packager=packager,
                arch=arch,
                release=release,
                pgpsig=pgpsig))
        self.produce(result)
 def process(self):
     output = check_output([
         '/bin/rpm', '-qa', '--queryformat',
         r'%{NAME}|%{VERSION}|%{RELEASE}|%|EPOCH?{%{EPOCH}}:{}||%|ARCH?{%{ARCH}}:{}|\n'
     ]).decode('utf-8')
     result = InstalledRPM()
     for entry in output.split('\n'):
         entry = entry.strip()
         if not entry:
             continue
         name, version, release, epoch, arch = entry.split('|')
         result.items.append(
             RPM(name=name,
                 version=version,
                 epoch=epoch,
                 arch=arch,
                 release=release))
     self.produce(result)
def test_actor_execution_with_signed_unsigned_data(current_actor_context):
    installed_rpm = [
        RPM(name='sample01', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'),
        RPM(name='sample02', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample03', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 5326810137017186'),
        RPM(name='sample04', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample05', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 938a80caf21541eb'),
        RPM(name='sample06', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample07', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID fd372689897da07a'),
        RPM(name='sample08', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample09', version='0.1', release='1.sm01', epoch='1', arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 45689c882fa658e0')]

    current_actor_context.feed(InstalledRPM(items=installed_rpm))
    current_actor_context.run()
    assert current_actor_context.consume(InstalledRedHatSignedRPM)
    assert len(current_actor_context.consume(InstalledRedHatSignedRPM)[0].items) == 5
    assert current_actor_context.consume(InstalledUnsignedRPM)
    assert len(current_actor_context.consume(InstalledUnsignedRPM)[0].items) == 4
Beispiel #6
0
 def process(self):
     output = check_output([
         '/bin/rpm',
         '-qa',
         '--queryformat',
         r'%{NAME}|%{VERSION}|%{RELEASE}|%|EPOCH?{%{EPOCH}}:{(none)}||%|PACKAGER?{%{PACKAGER}}:{(none)}||%|'
         r'ARCH?{%{ARCH}}:{}||%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{(none)}|}|\n'
     ])
     result = InstalledRPM()
     for entry in output.split('\n'):
         entry = entry.strip()
         if not entry:
             continue
         name, version, release, epoch, packager, arch, pgpsig = entry.split('|')
         result.items.append(RPM(
             name=name,
             version=version,
             epoch=epoch,
             packager=packager,
             arch=arch,
             release=release,
             pgpsig=pgpsig))
     self.produce(result)
def test_no_desktop_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledDesktopsFacts)[0]
    assert not message.gnome_installed and not message.kde_installed
def test_KDE_Gnome_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[Gnome_RPM, KDE_RPM]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledDesktopsFacts)[0]
    assert message.gnome_installed and message.kde_installed
def test_x32_x64(current_actor_context):
    problem_rpms = [
        RPM(name='brlapi',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='i686',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'
            ),
        RPM(name='gnome-online-accounts-devel',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='i686',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='geocode-glib-devel',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='i686',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 5326810137017186'
            ),
        RPM(name='brlapi',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='x86_64',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'
            ),
        RPM(name='gnome-online-accounts-devel',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='x86_64',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='geocode-glib-devel',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager="RH_PACKAGER",
            arch='x86_64',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 5326810137017186'
            )
    ]

    current_actor_context.feed(InstalledRPM(items=problem_rpms))
    current_actor_context.run()
    report = current_actor_context.consume(Report)[0].report
    assert report['title'] == (
        'Some packages have both 32bit and 64bit version installed which are known to'
        ' cause rpm transaction test to fail')
    assert {p['title'] for p in report['detail']['related_resources'] if p['scheme'] == 'package'} == \
           {'brlapi.i686', 'gnome-online-accounts-devel.i686', 'geocode-glib-devel.i686'}
def create_modulesfacts(installed_rpm):
    return InstalledRPM(items=installed_rpm)
def test_many_apps_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[okular_RPM, kdenetwork_RPM, kate_RPM, epiphany_PRM, polari_RPM]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledKdeAppsFacts)[0]
    assert len(message.installed_apps) == 3
def test_no_KDE_app_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[epiphany_PRM, polari_RPM]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledKdeAppsFacts)[0]
    assert not message.installed_apps
    epoch='1',
    packager=RH_PACKAGER,
    arch='noarch',
    pgpsig=
    'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51')
NO_AGENT_RPM = RPM(
    name='NoAgent',
    version='0.1',
    release='1.sm01',
    epoch='1',
    packager=RH_PACKAGER,
    arch='noarch',
    pgpsig=
    'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51')

INSTALLED_AGENT = InstalledRPM(items=[WA_AGENT_RPM])
NOT_INSTALLED_AGENT = InstalledRPM(items=[NO_AGENT_RPM])

BIOS_FIRMWARE = FirmwareFacts(firmware='bios')
EFI_FIRMWARE = FirmwareFacts(firmware='efi')

BIOS_PATH = '/boot/grub2/grubenv'
EFI_PATH = '/boot/efi/EFI/redhat/grubenv'


def test_hybrid_image(monkeypatch, tmpdir):
    grubenv_efi = tmpdir.join('grubenv_efi')
    grubenv_efi.write('grubenv')

    grubenv_boot = tmpdir.join('grubenv_boot')
    grubenv_boot.mksymlinkto('grubenv_efi')