Beispiel #1
0
    def test_init(self):
        config = PluginCallConfiguration(None, {
            constants.PUBLISH_HTTPS_KEYWORD: True,
            constants.PUBLISH_HTTP_KEYWORD: True})
        step = publish.Publisher(self.publisher.get_repo(),
                                 self.publisher.get_conduit(),
                                 config, YUM_DISTRIBUTOR_ID)
        self.assertTrue(isinstance(step.children[-1], publish.GenerateListingFileStep))
        self.assertTrue(isinstance(step.children[-2], publish.GenerateListingFileStep))
        self.assertTrue(isinstance(step.children[-3], publish.AtomicDirectoryPublishStep))
        atomic_publish = step.children[-3]
        repo = self.publisher.get_repo()
        target_publish_locations = [
            ['/', os.path.join(configuration.get_https_publish_dir(config),
                               configuration.get_repo_relative_path(repo, config))],
            ['/', os.path.join(configuration.get_http_publish_dir(config),
                               configuration.get_repo_relative_path(repo, config))]
        ]
        self.assertEquals(atomic_publish.publish_locations, target_publish_locations)

        # verify that listing file steps got the correct arguments
        http_step = step.children[-1]
        https_step = step.children[-2]
        self.assertEqual(http_step.target_dir, target_publish_locations[1][1])
        self.assertEqual(http_step.root_dir, configuration.get_http_publish_dir(config))
        self.assertEqual(https_step.target_dir, target_publish_locations[0][1])
        self.assertEqual(https_step.root_dir, configuration.get_https_publish_dir(config))
    def test_get_http_publish_dir_default(self):

        config = self._generate_call_config()

        http_publish_dir = configuration.get_http_publish_dir(config)

        self.assertEqual(http_publish_dir, configuration.HTTP_PUBLISH_DIR)
    def test_get_http_publish_dir_configured(self):

        configured_http_publish_dir = '/not/default/publish/dir/'
        config = self._generate_call_config(http_publish_dir=configured_http_publish_dir)

        http_publish_dir = configuration.get_http_publish_dir(config)

        self.assertEqual(http_publish_dir, configured_http_publish_dir)
Beispiel #4
0
    def _get_root_publish_dir(self):
        """
        Returns the publish directory path for the predistributor

        :return: path to the publish directory of the predistirbutor
        :rtype: str
        """
        if self.predistributor["config"].get("https", False):
            return yum_config.get_https_publish_dir(self.get_config())
        else:
            return yum_config.get_http_publish_dir(self.get_config())
def migrate():
    """Clean up published orphaned directory structure."""
    _logger.debug("Cleaning up published https yum directories.")
    walk_and_clean_directories(configuration.get_https_publish_dir(config))
    _logger.debug("Cleaning up published yum http yum directories.")
    walk_and_clean_directories(configuration.get_http_publish_dir(config))