Esempio n. 1
0
    def SetConfiguration(self, data: Structure):
        """Set the source configuration.

        :param data: a structure of the type RPMOSTreeConfigurationData
        """
        self.implementation.set_configuration(
            RPMOSTreeConfigurationData.from_structure(data))
Esempio n. 2
0
    def Configuration(self) -> Structure:
        """The source configuration.

        :return: a structure of the type RPMOSTreeConfigurationData
        """
        return RPMOSTreeConfigurationData.to_structure(
            self.implementation.configuration)
Esempio n. 3
0
    def _get_source_configuration(self):
        """Get the configuration of the RPM OSTree source.

        :return: an instance of RPMOSTreeConfigurationData
        """
        source_proxy = self.get_source_proxy()

        return RPMOSTreeConfigurationData.from_structure(
            source_proxy.Configuration)
Esempio n. 4
0
 def process_kickstart(self, data):
     """Process the kickstart data."""
     configuration = RPMOSTreeConfigurationData()
     configuration.osname = data.ostreesetup.osname
     configuration.remote = data.ostreesetup.remote
     configuration.url = data.ostreesetup.url
     configuration.ref = data.ostreesetup.ref
     configuration.gpg_verification_enabled = not data.ostreesetup.nogpg
     self.set_configuration(configuration)
Esempio n. 5
0
 def _get_data(self):
     """Create the RPM OSTree configuration data."""
     data = RPMOSTreeConfigurationData()
     data.url = "url"
     data.osname = "osname"
     data.ref = "ref"
     data.remote = "remote"
     return data
Esempio n. 6
0
def _make_config_data():
    """Create OSTree configuration data for testing

    :return RPMOSTreeConfigurationData: a data instance with all fields filled
    """
    data = RPMOSTreeConfigurationData()
    data.url = "url"
    data.osname = "osname"
    data.gpg_verification_enabled = True
    data.ref = "ref"
    data.remote = "remote"
    return data
Esempio n. 7
0
    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)
Esempio n. 8
0
 def __init__(self):
     super().__init__()
     self._configuration = RPMOSTreeConfigurationData()
     self.configuration_changed = Signal()