コード例 #1
0
ファイル: publish.py プロジェクト: pombreda/pulp_puppet
    def __init__(self, repo, publish_conduit, config, is_cancelled_call):
        self.repo = repo
        self.publish_conduit = publish_conduit
        self.config = config
        self.is_cancelled_call = is_cancelled_call

        self.progress_report = PublishProgressReport(self.publish_conduit)
コード例 #2
0
ファイル: publish.py プロジェクト: bmbouter/pulp_puppet
    def __init__(self, repo, publish_conduit, config, is_cancelled_call):
        self.repo = repo
        self.publish_conduit = publish_conduit
        self.config = config
        self.is_cancelled_call = is_cancelled_call

        self.progress_report = PublishProgressReport(self.publish_conduit)
コード例 #3
0
    def setUp(self):
        super(PuppetStatusRendererTests, self).setUp()
        self.renderer = PuppetStatusRenderer(self.context)

        self.sync_report = SyncProgressReport.from_progress_dict(
            IMPORTER_REPORT)
        self.publish_report = PublishProgressReport.from_progress_dict(
            DISTRIBUTOR_REPORT)
コード例 #4
0
    def setUp(self):
        super(PuppetStatusRendererTests, self).setUp()
        self.renderer = PuppetStatusRenderer(self.context)

        self.config['logging'] = {'filename' : 'test-extension-status.log'}

        self.sync_report = SyncProgressReport.from_progress_dict(IMPORTER_REPORT)
        self.publish_report = PublishProgressReport.from_progress_dict(DISTRIBUTOR_REPORT)
コード例 #5
0
    def setUp(self):
        super(PuppetStatusRendererTests, self).setUp()
        self.renderer = PuppetStatusRenderer(self.context)

        self.config['logging'] = {'filename': 'test-extension-status.log'}

        self.sync_report = SyncProgressReport.from_progress_dict(
            IMPORTER_REPORT)
        self.publish_report = PublishProgressReport.from_progress_dict(
            DISTRIBUTOR_REPORT)
コード例 #6
0
ファイル: status.py プロジェクト: jlsherrill/pulp
    def display_report(self, progress_report):

        # Sync Steps
        if constants.IMPORTER_ID in progress_report:
            sync_report = SyncProgressReport.from_progress_dict(progress_report[constants.IMPORTER_ID])
            self._display_sync_metadata_step(sync_report)
            self._display_sync_modules_step(sync_report)

        # Publish Steps
        if constants.DISTRIBUTOR_ID in progress_report:
            publish_report = PublishProgressReport.from_progress_dict(progress_report[constants.DISTRIBUTOR_ID])
            self._display_publish_modules_step(publish_report)
            self._display_publish_metadata_step(publish_report)
            self._display_publish_http_https_step(publish_report)
コード例 #7
0
    def display_report(self, progress_report):

        # Sync Steps
        if constants.IMPORTER_ID in progress_report:
            sync_report = SyncProgressReport.from_progress_dict(
                progress_report[constants.IMPORTER_ID])
            self._display_sync_metadata_step(sync_report)
            self._display_sync_modules_step(sync_report)

        # Publish Steps
        if constants.DISTRIBUTOR_ID in progress_report:
            publish_report = PublishProgressReport.from_progress_dict(
                progress_report[constants.DISTRIBUTOR_ID])
            self._display_publish_modules_step(publish_report)
            self._display_publish_metadata_step(publish_report)
            self._display_publish_http_https_step(publish_report)
コード例 #8
0
ファイル: publish.py プロジェクト: pombreda/pulp_puppet
class PuppetModulePublishRun(object):
    """
    Used to perform a single publish of a puppet repository. This class will
    maintain state relevant to the run and should not be reused across runs.

    :ivar repo: repository being published
    :type repo: pulp.plugins.model.Repository

    :ivar publish_conduit: used to communicate with Pulp for this repo's run
    :type publish_conduit: pulp.plugins.conduits.repo_publish.RepoPublishConduit

    :ivar config: configuration to use for the run
    :type config: pulp.plugins.config.PluginCallConfiguration

    :ivar is_cancelled_call: call to check to see if the run has been cancelled
    :type is_cancelled_call: callable
    """
    def __init__(self, repo, publish_conduit, config, is_cancelled_call):
        self.repo = repo
        self.publish_conduit = publish_conduit
        self.config = config
        self.is_cancelled_call = is_cancelled_call

        self.progress_report = PublishProgressReport(self.publish_conduit)

    def perform_publish(self):
        """
        Performs the publish operation according to the configured state of the
        instance. The report to be sent back to Pulp is returned from this call.
        This call will make calls into the conduit's progress update as
        appropriate.

        This call executes serially. No threads are created by this call. It
        will not return until either a step fails or the entire publish is
        completed.

        :return: the report object to return to Pulp from the publish call
        :rtype:  pulp.plugins.model.PublishReport
        """
        _logger.info('Beginning publish for repository <%s>' % self.repo.id)

        try:
            modules = self._modules_step()

            if modules is not None:
                self._metadata_step(modules)
        finally:
            # One final update before finishing
            self.progress_report.update_progress()

            report = self.progress_report.build_final_report()
            return report

    def _modules_step(self):
        """
        Performs all of the necessary actions in the modules section of the
        publish. Calls in here should *only* update the modules-related steps
        in the progress report.

        :return: list of modules in the repository; None if the modules step
                 failed
        :rtype:  list of pulp.plugins.model.AssociatedUnit
        """
        self.progress_report.modules_state = STATE_RUNNING
        # Do not update here; the counts need to be set first by the
        # symlink_modules call.

        start_time = datetime.now()

        try:
            self._init_build_dir()
            modules = self._retrieve_repo_modules()
            self._symlink_modules(modules)
        except Exception, e:
            _logger.exception(
                'Exception during modules step for repository <%s>' %
                self.repo.id)

            self.progress_report.modules_state = STATE_FAILED
            self.progress_report.modules_error_message = _(
                'Error assembling modules')
            self.progress_report.modules_exception = e
            self.progress_report.modules_traceback = sys.exc_info()[2]

            end_time = datetime.now()
            duration = end_time - start_time
            self.progress_report.modules_execution_time = duration.seconds

            self.progress_report.update_progress()

            return None

        self.progress_report.modules_state = STATE_SUCCESS

        end_time = datetime.now()
        duration = end_time - start_time
        self.progress_report.modules_execution_time = duration.seconds

        self.progress_report.update_progress()

        return modules
コード例 #9
0
ファイル: publish.py プロジェクト: bmbouter/pulp_puppet
class PuppetModulePublishRun(object):
    """
    Used to perform a single publish of a puppet repository. This class will
    maintain state relevant to the run and should not be reused across runs.

    :ivar repo: repository being published
    :type repo: pulp.plugins.model.Repository

    :ivar publish_conduit: used to communicate with Pulp for this repo's run
    :type publish_conduit: pulp.plugins.conduits.repo_publish.RepoPublishConduit

    :ivar config: configuration to use for the run
    :type config: pulp.plugins.config.PluginCallConfiguration

    :ivar is_cancelled_call: call to check to see if the run has been cancelled
    :type is_cancelled_call: callable
    """

    def __init__(self, repo, publish_conduit, config, is_cancelled_call):
        self.repo = repo
        self.publish_conduit = publish_conduit
        self.config = config
        self.is_cancelled_call = is_cancelled_call

        self.progress_report = PublishProgressReport(self.publish_conduit)

    def perform_publish(self):
        """
        Performs the publish operation according to the configured state of the
        instance. The report to be sent back to Pulp is returned from this call.
        This call will make calls into the conduit's progress update as
        appropriate.

        This call executes serially. No threads are created by this call. It
        will not return until either a step fails or the entire publish is
        completed.

        :return: the report object to return to Pulp from the publish call
        :rtype:  pulp.plugins.model.PublishReport
        """
        _logger.info('Beginning publish for repository <%s>' % self.repo.id)

        try:
            modules = self._modules_step()

            if modules is not None:
                self._metadata_step(modules)
        finally:
            # One final update before finishing
            self.progress_report.update_progress()

            report = self.progress_report.build_final_report()
            return report

    def _modules_step(self):
        """
        Performs all of the necessary actions in the modules section of the
        publish. Calls in here should *only* update the modules-related steps
        in the progress report.

        :return: list of modules in the repository; None if the modules step
                 failed
        :rtype:  list of pulp.plugins.model.AssociatedUnit
        """
        self.progress_report.modules_state = STATE_RUNNING
        # Do not update here; the counts need to be set first by the
        # symlink_modules call.

        start_time = datetime.now()

        try:
            self._init_build_dir()
            modules = self._retrieve_repo_modules()
            self._symlink_modules(modules)
        except Exception, e:
            _logger.exception('Exception during modules step for repository <%s>' % self.repo.id)

            self.progress_report.modules_state = STATE_FAILED
            self.progress_report.modules_error_message = _('Error assembling modules')
            self.progress_report.modules_exception = e
            self.progress_report.modules_traceback = sys.exc_info()[2]

            end_time = datetime.now()
            duration = end_time - start_time
            self.progress_report.modules_execution_time = duration.seconds

            self.progress_report.update_progress()

            return None

        self.progress_report.modules_state = STATE_SUCCESS

        end_time = datetime.now()
        duration = end_time - start_time
        self.progress_report.modules_execution_time = duration.seconds

        self.progress_report.update_progress()

        return modules
コード例 #10
0
    def setUp(self):
        super(PuppetStatusRendererTests, self).setUp()
        self.renderer = PuppetStatusRenderer(self.context)

        self.sync_report = SyncProgressReport.from_progress_dict(IMPORTER_REPORT)
        self.publish_report = PublishProgressReport.from_progress_dict(DISTRIBUTOR_REPORT)