예제 #1
0
    def __init__(self, repo, publish_conduit, config):
        """
        :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__(constants.PUBLISH_STEP_WEB_PUBLISHER, repo,
                             publish_conduit, config)

        publish_dir = configuration.get_web_publish_dir(repo, config)
        self.web_working_dir = os.path.join(self.get_working_dir(), repo.id)
        master_publish_dir = configuration.get_master_publish_dir(repo, config)
        atomic_publish_step = AtomicDirectoryPublishStep(
            self.get_working_dir(), [(repo.id, publish_dir)],
            master_publish_dir,
            step_type=constants.PUBLISH_STEP_OVER_HTTP)
        atomic_publish_step.description = _('Making files available via web.')

        self.add_child(PublishContentStep(working_dir=self.web_working_dir))
        self.add_child(PublishMetadataStep(working_dir=self.web_working_dir))
        self.add_child(atomic_publish_step)
예제 #2
0
파일: web.py 프로젝트: bowlofeggs/pulp_deb
    def distributor_removed(self, repo, config):
        """
        Called when a distributor of this type is removed from a repository.
        This hook allows the distributor to clean up any files that may have
        been created during the actual publishing.

        The distributor may use the contents of the working directory in cleanup.
        It is not required that the contents of this directory be deleted by
        the distributor; Pulp will ensure it is wiped following this call.

        If this call raises an exception, the distributor will still be removed
        from the repository and the working directory contents will still be
        wiped by Pulp.

        :param repo: metadata describing the repository
        :type  repo: pulp.plugins.model.Repository

        :param config: plugin configuration
        :type  config: pulp.plugins.config.PluginCallConfiguration
        """
        # remove the directories that might have been created for this repo/distributor
        dir_list = [configuration.get_master_publish_dir(repo, config),
                    configuration.get_web_publish_dir(repo, config)]

        for repo_dir in dir_list:
            shutil.rmtree(repo_dir, ignore_errors=True)
예제 #3
0
파일: web.py 프로젝트: pombreda/pulp_deb
    def distributor_removed(self, repo, config):
        """
        Called when a distributor of this type is removed from a repository.
        This hook allows the distributor to clean up any files that may have
        been created during the actual publishing.

        The distributor may use the contents of the working directory in cleanup.
        It is not required that the contents of this directory be deleted by
        the distributor; Pulp will ensure it is wiped following this call.

        If this call raises an exception, the distributor will still be removed
        from the repository and the working directory contents will still be
        wiped by Pulp.

        :param repo: metadata describing the repository
        :type  repo: pulp.plugins.model.Repository

        :param config: plugin configuration
        :type  config: pulp.plugins.config.PluginCallConfiguration
        """
        # remove the directories that might have been created for this repo/distributor
        dir_list = [
            repo.working_dir,
            configuration.get_master_publish_dir(repo, config),
            configuration.get_web_publish_dir(repo, config)
        ]

        for repo_dir in dir_list:
            shutil.rmtree(repo_dir, ignore_errors=True)
예제 #4
0
파일: steps.py 프로젝트: sjtindell/pulp_deb
    def __init__(self, repo, publish_conduit, config):
        """
        :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__(constants.PUBLISH_STEP_WEB_PUBLISHER,
                                           repo, publish_conduit, config)

        publish_dir = configuration.get_web_publish_dir(repo, config)
        self.web_working_dir = os.path.join(self.get_working_dir(), repo.id)
        master_publish_dir = configuration.get_master_publish_dir(repo, config)
        atomic_publish_step = AtomicDirectoryPublishStep(self.get_working_dir(),
                                                         [(repo.id, publish_dir)],
                                                         master_publish_dir,
                                                         step_type=constants.PUBLISH_STEP_OVER_HTTP)
        atomic_publish_step.description = _('Making files available via web.')

        self.add_child(PublishContentStep(working_dir=self.web_working_dir))
        self.add_child(PublishMetadataStep(working_dir=self.web_working_dir))
        self.add_child(atomic_publish_step)
예제 #5
0
 def test_get_master_publish_dir(self):
     directory = configuration.get_master_publish_dir(
         self.repo, 'deb_distributor')
     self.assertEquals(
         directory,
         '/var/lib/pulp/published/deb/master/deb_distributor/foo')
예제 #6
0
 def test_get_master_publish_dir(self):
     directory = configuration.get_master_publish_dir(self.repo, self.config)
     self.assertEquals(directory, os.path.join(self.publish_dir, 'master', self.repo.id))