Beispiel #1
0
    def _publish_isos(self, repo_group, config, progress_callback=None):
        """
        This just decides what the http and https publishing directories should be, cleans them up,
        and then calls publish_isos method in export_utils

        :param repo_group:          metadata describing the repository group. Used to retrieve the
                                    working directory and group id.
        :type  repo_group:          pulp.plugins.model.RepositoryGroup
        :param config:              plugin configuration instance
        :type config:               pulp.plugins.config.PluginCallConfiguration
        :param progress_callback:   callback to report progress info to publish_conduit. This function is
                                    expected to take the following arguments: type_id, a string, and
                                    status, which is a dict
        :type progress_callback:    function
        """

        http_publish_dir = os.path.join(constants.GROUP_EXPORT_HTTP_DIR, repo_group.id).rstrip('/')
        https_publish_dir = os.path.join(constants.GROUP_EXPORT_HTTPS_DIR, repo_group.id).rstrip('/')
        image_prefix = config.get(constants.ISO_PREFIX_KEYWORD) or repo_group.id

        # Clean up the old export publish directories.
        shutil.rmtree(http_publish_dir, ignore_errors=True)
        shutil.rmtree(https_publish_dir, ignore_errors=True)

        # If publishing isn't enabled for http or https, set the path to None
        if not config.get(constants.PUBLISH_HTTP_KEYWORD):
            http_publish_dir = None
        if not config.get(constants.PUBLISH_HTTPS_KEYWORD):
            https_publish_dir = None

        export_utils.publish_isos(repo_group.working_dir, image_prefix, http_publish_dir,
                                  https_publish_dir, config.get(constants.ISO_SIZE_KEYWORD),
                                  progress_callback)
Beispiel #2
0
    def _publish_isos(self, repo, config, progress_callback=None):
        """
        Extracts the necessary configuration information for the ISO creator and then calls it.

        :param repo:                metadata describing the repository
        :type  repo:                pulp.plugins.model.Repository
        :param config:              plugin configuration instance
        :type  config:              pulp.plugins.config.PluginCallConfiguration
        :param progress_callback:   callback to report progress info to publish_conduit. This function is
                                        expected to take the following arguments: type_id, a string, and
                                        status, which is a dict
        :type  progress_callback:   function
        """
        http_publish_dir = os.path.join(constants.EXPORT_HTTP_DIR, repo.id).rstrip('/')
        https_publish_dir = os.path.join(constants.EXPORT_HTTPS_DIR, repo.id).rstrip('/')
        image_prefix = config.get(constants.ISO_PREFIX_KEYWORD) or repo.id

        # Clean up the old export publish directories.
        shutil.rmtree(http_publish_dir, ignore_errors=True)
        shutil.rmtree(https_publish_dir, ignore_errors=True)

        # If publishing isn't enabled for http or https, set the path to None
        if not config.get(constants.PUBLISH_HTTP_KEYWORD):
            http_publish_dir = None
        if not config.get(constants.PUBLISH_HTTPS_KEYWORD):
            https_publish_dir = None

        export_utils.publish_isos(repo.working_dir, image_prefix, http_publish_dir, https_publish_dir,
                                  config.get(constants.ISO_SIZE_KEYWORD), progress_callback)