def test_kernelcmdline_config_no_version(monkeypatch): mocked_run = MockedRun() monkeypatch.setattr(stdlib, 'run', mocked_run) monkeypatch.setattr(api, 'consume', mocked_consume_no_version) monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_S390X)) kernelcmdlineconfig.process() assert not mocked_run.commands
def test_kernelcmdline_config(monkeypatch): mocked_run = MockedRun() monkeypatch.setattr(stdlib, 'run', mocked_run) monkeypatch.setattr(api, 'consume', mocked_consume) kernelcmdlineconfig.process() assert mocked_run.commands and len(mocked_run.commands) == 2 assert ['grubby', '--update-kernel=/boot/vmlinuz-{}'.format( KERNEL_VERSION), '--args=some_key2=some_value2'] == mocked_run.commands.pop() assert ['grubby', '--update-kernel=/boot/vmlinuz-{}'.format( KERNEL_VERSION), '--args=some_key1=some_value1'] == mocked_run.commands.pop()
def test_kernelcmdline_config_intel(monkeypatch): mocked_run = MockedRun() monkeypatch.setattr(stdlib, 'run', mocked_run) monkeypatch.setattr(api, 'consume', mocked_consume) monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_X86_64)) kernelcmdlineconfig.process() assert mocked_run.commands and len(mocked_run.commands) == 2 assert ['grubby', '--update-kernel=/boot/vmlinuz-{}'.format( KERNEL_VERSION), '--args=some_key2=some_value2'] == mocked_run.commands.pop() assert ['grubby', '--update-kernel=/boot/vmlinuz-{}'.format( KERNEL_VERSION), '--args=some_key1=some_value1'] == mocked_run.commands.pop()
def process(self): configs = None ff = next(self.consume(FirmwareFacts), None) if not ff: raise StopActorExecutionError( 'Could not identify system firmware', details={ 'details': 'Actor did not receive FirmwareFacts message.' }) if ff.firmware == 'bios' and os.path.ismount('/boot/efi'): configs = ['/boot/grub2/grub.cfg', '/boot/efi/EFI/redhat/grub.cfg'] kernelcmdlineconfig.process(configs)
def process(self): kernelcmdlineconfig.process()
def test_kernelcmdline_config_no_version(monkeypatch): mocked_run = MockedRun() monkeypatch.setattr(stdlib, 'run', mocked_run) monkeypatch.setattr(api, 'consume', mocked_consume_no_version) kernelcmdlineconfig.process() assert not mocked_run.commands