def post_install(self): super().post_install() data = self._get_source_configuration() # Following up on the "remote delete" earlier, we removed the remote from # /ostree/repo/config. But we want it in /etc, so re-add it to /etc/ostree/remotes.d, # using the sysroot path. # # However, we ignore the case where the remote already exists, which occurs when the # content itself provides the remote config file. # # Note here we use the deployment as sysroot, because it's that version of /etc that we # want. from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \ ChangeOSTreeRemoteTask task = ChangeOSTreeRemoteTask(data, use_root=True, root=conf.target.system_root) task.run() # Handle bootloader configuration from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \ ConfigureBootloader task = ConfigureBootloader(sysroot=conf.target.system_root, is_dirinstall=conf.target.is_directory) task.run()
def install_test(self, sysroot_cls, gio_file_cls): """Test the ChangeOSTreeRemoteTask installation task.""" data = self._get_data() repo = self._get_repo(sysroot_cls) task = ChangeOSTreeRemoteTask(data, physroot="/physroot") task.run() self._check_remote_changed(repo, sysroot_file=None)
def post_install_test(self, sysroot_cls, gio_file_cls): """Test the ChangeOSTreeRemoteTask post-installation task.""" data = self._get_data() repo = self._get_repo(sysroot_cls) sysroot_file = gio_file_cls.new_for_path("/sysroot") task = ChangeOSTreeRemoteTask(data, sysroot="/sysroot") task.run() self._check_remote_changed(repo, sysroot_file)
def options_test(self, sysroot_cls, gio_file_cls, conf_mock): """Test the remote options of the ChangeOSTreeRemoteTask task.""" options = { "gpg-verify": False, "tls-permissive": True, } data = self._get_data() repo = self._get_repo(sysroot_cls) conf_mock.payload.verify_ssl = False data.gpg_verification_enabled = False task = ChangeOSTreeRemoteTask(data, physroot="/physroot") task.run() self._check_remote_changed(repo, sysroot_file=None, options=options)
def _execute_run_once(self, use_sysroot, gpg_verify, verify_ssl, gio_file_mock, conf_mock, sysroot_mock): new_mock = sysroot_mock.new() repo_mock = MagicMock() new_mock.get_repo.return_value = [None, repo_mock] conf_mock.payload.verify_ssl = verify_ssl path_mock = gio_file_mock.new_for_path() data = RPMOSTreeConfigurationData() data.url = "url" data.osname = "osname" data.gpg_verification_enabled = gpg_verify data.ref = "ref" data.remote = "remote" task = ChangeOSTreeRemoteTask(data, use_sysroot, "/physroot") task.run() repo_mock.remote_change.assert_called_once() the_call = repo_mock.remote_change.mock_calls[0] name, args, kwargs = the_call print(the_call, name, args, kwargs) self.assertEqual(len(args), 6) if use_sysroot: self.assertEqual(args[0], path_mock) else: self.assertEqual(args[0], None) self.assertEqual(args[2], "remote") self.assertEqual(args[3], "url") expected = {} if not gpg_verify: expected["gpg-verify"] = False if not verify_ssl: expected["tls-permissive"] = True var = args[4] self.assertEqual(type(var), Variant) self.assertDictEqual(var.unpack(), expected)