Esempio n. 1
0
    def __init__(self, repo, publish_conduit, config):
        """
        Initialize the WebPublisher, adding the V1 and V2 publishers as its children. The V1
        publisher will publish any Image units found in the repository, and the V2 publisher will
        publish any Manifests and Blobs it finds in the repository.

        :param repo: Pulp managed Yum repository
        :type  repo: pulp.plugins.model.Repository
        :param publish_conduit: Conduit providing access to relative Pulp functionality
        :type  publish_conduit: pulp.plugins.conduits.repo_publish.RepoPublishConduit
        :param config: Pulp configuration for the distributor
        :type  config: pulp.plugins.config.PluginCallConfiguration
        """
        super(WebPublisher, self).__init__(
            step_type=constants.PUBLISH_STEP_WEB_PUBLISHER, repo=repo,
            publish_conduit=publish_conduit, config=config)

        predistributor = self.get_predistributor()
        if predistributor:
            end_date = predistributor["last_publish"]
            if end_date:
                date_filter = self.create_date_range_filter(end_date=end_date)
            else:
                return
        else:
            date_filter = None

        # Publish v1 content, and then publish v2 content
        self.add_child(v1_publish_steps.WebPublisher(repo, publish_conduit, config,
                                                     repo_content_unit_q=date_filter))
        self.add_child(V2WebPublisher(repo, publish_conduit, config,
                                      repo_content_unit_q=date_filter))
Esempio n. 2
0
 def test_init(self, get_working_dir, mock_images_step,
               mock_web_publish_step):
     mock_conduit = Mock()
     mock_config = {
         constants.CONFIG_KEY_DOCKER_PUBLISH_DIRECTORY: self.publish_dir
     }
     publisher = v1_publish_steps.WebPublisher(self.repo, mock_conduit,
                                               mock_config)
     self.assertEquals(publisher.children, [
         mock_images_step.return_value, mock_web_publish_step.return_value
     ])