def set_url_base_source_properties_test(self): data = RepoConfigurationData() data.url = "http://example.com/repo" data.type = URL_TYPE_BASEURL self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data))
def set_url_mirrorlist_properties_test(self): data = RepoConfigurationData() data.url = "http://forthehorde.com/mirrorlist?url" data.type = URL_TYPE_MIRRORLIST self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data))
def RepoConfiguration(self) -> Structure: """Get this repository configuration. :rtype: RepoConfigurationData data structure """ return RepoConfigurationData.to_structure( self.implementation.repo_configuration)
def description_test(self): """Test URL source description.""" rc = RepoConfigurationData() rc.url = "http://example.com/" self.url_source_interface.SetRepoConfiguration(rc.to_structure(rc)) self.assertEqual("http://example.com/", self.url_source_module.description)
def set_url_metalink_properties_test(self): data = RepoConfigurationData() data.url = "https://alianceFTW/metalink?nopesir" data.type = URL_TYPE_METALINK self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data))
def test_set_included_packages_properties(self): data = RepoConfigurationData() data.include_packages = ["python*", "perl", "rattlesnake", "<- what does not belong there"] self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def test_set_excluded_packages_properties(self): data = RepoConfigurationData() data.exclude_packages = ["foo", "bar", "foobar", "<-yep it's merge of the two!"] self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def test_set_cost_properties(self): data = RepoConfigurationData() data.cost = 2000 self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def test_disable_ssl_verification_properties(self): data = RepoConfigurationData() data.ssl_verification_enabled = False self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def test_set_name_properties(self): data = RepoConfigurationData() data.name = "Saitama" self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def test_set_proxy_properties(self): data = RepoConfigurationData() data.proxy = "http://*****:*****@super-cool-server.com" self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(data) )
def set_ssl_configuration_properties_test(self): data = RepoConfigurationData() ssl_conf = data.ssl_configuration ssl_conf.ca_cert_path = "file:///my/cool/cert" ssl_conf.client_cert_path = "file:///my/cool/client/cert" ssl_conf.client_key_path = "file:///my/cool/client/key/" self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data))
def set_invalid_proxy_properties_test(self): data = RepoConfigurationData() data.proxy = "https:///no/server/hostname" with self.assertRaises(InvalidValueError): self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data)) # new value shouldn't be set old_data = self.url_source_interface.RepoConfiguration old_data = RepoConfigurationData.from_structure(old_data) self.assertEqual(old_data.proxy, "")
def set_invalid_url_type_properties_test(self): data = RepoConfigurationData() data.url = "http://test" data.type = "DOES-NOT-EXISTS" with self.assertRaises(InvalidValueError): self._check_dbus_property("RepoConfiguration", RepoConfigurationData.to_structure(data)) # new value shouldn't be set old_data = self.url_source_interface.RepoConfiguration old_data = RepoConfigurationData.from_structure(old_data) self.assertEqual(old_data.url, "") self.assertEqual(old_data.type, URL_TYPE_BASEURL)
def create_proxy(self): """Create and set up a DBus source. :return: a DBus proxy of a source """ source_proxy = create_source(SOURCE_TYPE_URL) repo_configuration = RepoConfigurationData() repo_configuration.type = self.url_type repo_configuration.url = self.url source_proxy.RepoConfiguration = \ RepoConfigurationData.to_structure(repo_configuration) return source_proxy
def ssl_configuration_is_not_empty_properties_test(self): ssl_conf = SSLConfigurationData() ssl_conf.ca_cert_path = "file:///my/root/house" ssl_conf.client_cert_path = "file:///badge/with/yellow/access" ssl_conf.client_key_path = "file:///skeleton/head/key" repo_data = RepoConfigurationData() repo_data.ssl_configuration = ssl_conf self.url_source_interface.SetRepoConfiguration( RepoConfigurationData.to_structure(repo_data)) repo_data_2 = RepoConfigurationData.from_structure( self.url_source_interface.RepoConfiguration) self.assertFalse(repo_data_2.ssl_configuration.is_empty())
def create_proxy(self): """Create and set up a DBus source. :return: a DBus proxy of a source """ source_proxy = create_source(SOURCE_TYPE_URL) repo_configuration = RepoConfigurationData() repo_configuration.type = URL_TYPE_BASEURL repo_configuration.url = self.path source_proxy.SetRepoConfiguration( RepoConfigurationData.to_structure(repo_configuration)) return source_proxy
def set_source_url(self, url, url_type=constants.URL_TYPE_BASEURL, proxy=None): """ Switch to install source specified by URL """ # clean any old HDD ISO sources self._tear_down_existing_source() url_source_proxy = create_source(constants.SOURCE_TYPE_URL) repo_conf = RepoConfigurationData() repo_conf.url = url repo_conf.type = url_type repo_conf.proxy = proxy or "" url_source_proxy.SetRepoConfiguration( RepoConfigurationData.to_structure(repo_conf) ) set_source(self.payload.proxy, url_source_proxy)
def _set_source_configuration_from_opts(self, opts): """Configure the source based on the Anaconda options.""" source_proxy = self.get_source_proxy() if source_proxy.Type == SOURCE_TYPE_URL: # Get the repo configuration. repo_configuration = RepoConfigurationData.from_structure( source_proxy.RepoConfiguration) if opts.proxy: repo_configuration.proxy = opts.proxy if not conf.payload.verify_ssl: repo_configuration.ssl_verification_enabled = conf.payload.verify_ssl # Update the repo configuration. source_proxy.RepoConfiguration = \ RepoConfigurationData.to_structure(repo_configuration)
def set_from_opts(self, opts): """Set the payload from the Anaconda cmdline options. :param opts: a namespace of options """ # Set the source based on opts.method if it isn't already set # - opts.method is currently set by command line/boot options if opts.method and (not self.proxy.Sources or self._is_source_default()): try: source = SourceFactory.parse_repo_cmdline_string(opts.method) except PayloadSourceTypeUnrecognized: log.error("Unknown method: %s", opts.method) else: source_proxy = source.create_proxy() set_source(self.proxy, source_proxy) # Set up the current source. source_proxy = self.get_source_proxy() if source_proxy.Type == SOURCE_TYPE_URL: # Get the repo configuration. repo_configuration = RepoConfigurationData.from_structure( source_proxy.RepoConfiguration ) if opts.proxy: repo_configuration.proxy = opts.proxy if not conf.payload.verify_ssl: repo_configuration.ssl_verification_enabled = conf.payload.verify_ssl # Update the repo configuration. source_proxy.SetRepoConfiguration( RepoConfigurationData.to_structure(repo_configuration) ) # Set up packages. if opts.multiLib: configuration = self.get_packages_configuration() configuration.multilib_policy = MULTILIB_POLICY_ALL self.set_packages_configuration(configuration) # Reset all the other things now that we have new configuration. self._configure()
def default_repo_configuration_properties_test(self): data = RepoConfigurationData() data.name = self._generate_repo_name() self.assertEqual(self.url_source_interface.RepoConfiguration, RepoConfigurationData.to_structure(data))
def test_set_empty_repo_configuration_properties(self): self._check_dbus_property( "RepoConfiguration", RepoConfigurationData.to_structure(RepoConfigurationData()) )
def test_description(self): """Test URL source description.""" rc = RepoConfigurationData() rc.url = "http://example.com/" self.url_source_interface.SetRepoConfiguration(rc.to_structure(rc)) assert "http://example.com/" == self.url_source_module.description
def test_default_repo_configuration_properties(self): data = RepoConfigurationData() data.name = self._generate_repo_name() assert self.url_source_interface.RepoConfiguration == \ RepoConfigurationData.to_structure(data)