Example #1
0
 def setUp(self):
     super(TestRefreshContentSourcesCommand, self).setUp()
     self.context = MagicMock(
         config={'output': {
             'poll_frequency_in_seconds': 1
         }})
     self.prompt = Mock()
     self.context.prompt = self.prompt
     self.renderer = PublishStepStatusRenderer(self.context)
     self.command = RefreshContentSourcesCommand(self.context,
                                                 self.renderer)
     step_details = {
         'source_id': '1',
         'succeeded': None,
         'url': 'mock-url',
         'added_count': '2',
         'deleted_count': '0',
         'errors': []
     }
     self.step = {
         reporting_constants.PROGRESS_STEP_TYPE_KEY: u'foo_step',
         reporting_constants.PROGRESS_STEP_UUID: u'abcde',
         reporting_constants.PROGRESS_DESCRIPTION_KEY: u'foo description',
         reporting_constants.PROGRESS_DETAILS_KEY: [step_details],
         reporting_constants.PROGRESS_STATE_KEY:
         reporting_constants.STATE_NOT_STARTED,
         reporting_constants.PROGRESS_ITEMS_TOTAL_KEY: 1,
         reporting_constants.PROGRESS_NUM_PROCESSED_KEY: 0,
         reporting_constants.PROGRESS_ERROR_DETAILS_KEY: []
     }
Example #2
0
    def __init__(self, context):
        super(RpmStatusRenderer, self).__init__(context)

        self.publish_steps_renderer = PublishStepStatusRenderer(context)

        # Sync Steps
        self.metadata_last_state = constants.STATE_NOT_STARTED
        self.download_last_state = constants.STATE_NOT_STARTED
        self.distribution_sync_last_state = constants.STATE_NOT_STARTED
        self.errata_last_state = constants.STATE_NOT_STARTED
        self.comps_last_state = constants.STATE_NOT_STARTED

        # Publish Steps
        self.publish_steps_last_state = dict.fromkeys(
            constants.PUBLISH_STEPS, constants.STATE_NOT_STARTED)

        self.distribution_publish_last_state = constants.STATE_NOT_STARTED
        self.generate_metadata_last_state = constants.STATE_NOT_STARTED
        self.publish_http_last_state = constants.STATE_NOT_STARTED
        self.publish_https_last_state = constants.STATE_NOT_STARTED

        # UI Widgets
        self.metadata_spinner = self.prompt.create_spinner()
        self.download_bar = self.prompt.create_progress_bar()
        self.distribution_sync_bar = self.prompt.create_progress_bar()
        self.errata_spinner = self.prompt.create_spinner()
        self.comps_spinner = self.prompt.create_spinner()

        self.packages_bar = self.prompt.create_progress_bar()
        self.distribution_publish_bar = self.prompt.create_progress_bar()
        self.generate_metadata_spinner = self.prompt.create_spinner()
        self.publish_http_spinner = self.prompt.create_spinner()
        self.publish_https_spinner = self.prompt.create_spinner()
Example #3
0
def initialize(context):
    structure.ensure_repo_structure(context.cli)
    upload_manager = _upload_manager(context)

    repo_section = structure.repo_section(context.cli)
    repo_section.add_command(repo_create_update.PkgRepoCreateCommand(context))
    repo_section.add_command(repo_create_update.PkgRepoUpdateCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(repo_list.RepoListCommand(context))
    repo_section.add_command(
        RepoSearchCommand(context, constants.REPO_NOTE_PKG))

    copy_section = structure.repo_copy_section(context.cli)
    copy_section.add_command(copy_commands.MsiCopyCommand(context))
    copy_section.add_command(copy_commands.MsmCopyCommand(context))
    copy_section.add_command(copy_commands.AllCopyCommand(context))

    remove_section = structure.repo_remove_section(context.cli)
    remove_section.add_command(remove.MsiRemoveCommand(context))
    remove_section.add_command(remove.MsmRemoveCommand(context))

    contents_section = structure.repo_contents_section(context.cli)
    contents_section.add_command(contents.SearchMsiCommand(context))
    contents_section.add_command(contents.SearchMsmCommand(context))

    uploads_section = structure.repo_uploads_section(context.cli)
    for cls_ in [
            package.CreateMsiCommand, package.CreateMsmCommand,
            upload.ResumeCommand, upload.CancelCommand, upload.ListCommand
    ]:
        uploads_section.add_command(cls_(context, upload_manager))

    sync_section = structure.repo_sync_section(context.cli)
    renderer = status.PackageStatusRenderer(context)
    sync_section.add_command(
        sync_publish.RunSyncRepositoryCommand(context, renderer))
    sync_section.add_command(sync_publish.SyncStatusCommand(context, renderer))

    publish_section = structure.repo_publish_section(context.cli)
    renderer = PublishStepStatusRenderer(context)
    distributor_id = ids.TYPE_ID_DISTRIBUTOR_WIN
    publish_section.add_command(
        sync_publish.RunPublishRepositoryCommand(context, renderer,
                                                 distributor_id))
    publish_section.add_command(
        sync_publish.PublishStatusCommand(context, renderer))

    sync_schedules_section = structure.repo_sync_schedules_section(context.cli)
    sync_schedules_section.add_command(
        sync_schedules.PkgCreateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgUpdateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgDeleteScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgListScheduleCommand(context))

    sync_schedules_section.add_command(
        sync_schedules.PkgNextRunCommand(context))
Example #4
0
 def __init__(self, context):
     """
     :param context: The client context.
     :type context: pulp.client.extensions.core.ClientContext
     """
     super(SourcesSection, self).__init__(self.NAME, self.DESCRIPTION)
     self.add_command(ListCommand(context))
     renderer = PublishStepStatusRenderer(context)
     self.add_command(RefreshContentSourcesCommand(context, renderer))
Example #5
0
    def __init__(self, context):
        super(PackageStatusRenderer, self).__init__(context)

        self.publish_steps_renderer = PublishStepStatusRenderer(context)

        # Publish Steps
        self.publish_steps_last_state = dict.fromkeys(
            constants.PUBLISH_STEPS, constants.STATE_NOT_STARTED)

        self.publish_http_last_state = constants.STATE_NOT_STARTED
        self.publish_https_last_state = constants.STATE_NOT_STARTED

        # UI Widgets
        self.packages_bar = self.prompt.create_progress_bar()
        self.publish_http_spinner = self.prompt.create_spinner()
        self.publish_https_spinner = self.prompt.create_spinner()
Example #6
0
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        PulpCliSection.__init__(self, 'repo', _('list repositories and manage repo groups'))

        self.context = context
        self.prompt = context.prompt  # for easier access

        self.add_command(repo_commands.ListRepositoriesCommand(context, include_all_flag=False))
        self.add_command(DownloadRepositoryCommand(context, PublishStepStatusRenderer(context)))

        # Subsections
        self.add_subsection(RepoGroupSection(context))
        self.add_subsection(RepoHistorySection(context))
Example #7
0
def initialize(context):
    structure.ensure_repo_structure(context.cli)
    upload_manager = _upload_manager(context)

    repo_section = structure.repo_section(context.cli)
    repo_section.add_command(repo_create_update.RpmRepoCreateCommand(context))
    repo_section.add_command(repo_create_update.RpmRepoUpdateCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(repo_list.RpmRepoListCommand(context))
    repo_section.add_command(
        RepoSearchCommand(context, constants.REPO_NOTE_RPM))

    copy_section = structure.repo_copy_section(context.cli)
    copy_section.add_command(copy_commands.RpmCopyCommand(context))
    copy_section.add_command(copy_commands.ErrataCopyCommand(context))
    copy_section.add_command(copy_commands.DistributionCopyCommand(context))
    copy_section.add_command(copy_commands.PackageGroupCopyCommand(context))
    copy_section.add_command(copy_commands.PackageCategoryCopyCommand(context))
    copy_section.add_command(
        copy_commands.PackageEnvironmentCopyCommand(context))
    copy_section.add_command(copy_commands.AllCopyCommand(context))
    copy_section.add_command(copy_commands.SrpmCopyCommand(context))
    copy_section.add_command(copy_commands.YumRepoMetadataFileCommand(context))
    copy_section.add_command(copy_commands.DrpmCopyCommand(context))

    # Disabled as per 950690. We'll likely be able to add these back once the new
    # yum importer is finished and DRPMs are properly handled.
    # copy_section.add_command(copy_commands.DrpmCopyCommand(context))

    remove_section = structure.repo_remove_section(context.cli)
    remove_section.add_command(remove.RpmRemoveCommand(context))
    remove_section.add_command(remove.SrpmRemoveCommand(context))
    remove_section.add_command(remove.DrpmRemoveCommand(context))
    remove_section.add_command(remove.ErrataRemoveCommand(context))
    remove_section.add_command(remove.PackageGroupRemoveCommand(context))
    remove_section.add_command(remove.PackageCategoryRemoveCommand(context))
    remove_section.add_command(remove.PackageEnvironmentRemoveCommand(context))
    remove_section.add_command(remove.DistributionRemoveCommand(context))
    remove_section.add_command(remove.YumMetadataFileRemoveCommand(context))

    contents_section = structure.repo_contents_section(context.cli)
    contents_section.add_command(contents.SearchRpmsCommand(context))
    contents_section.add_command(contents.SearchDrpmsCommand(context))
    contents_section.add_command(contents.SearchSrpmsCommand(context))
    contents_section.add_command(contents.SearchPackageGroupsCommand(context))
    contents_section.add_command(
        contents.SearchPackageCategoriesCommand(context))
    contents_section.add_command(
        contents.SearchPackageEnvironmentsCommand(context))
    contents_section.add_command(contents.SearchDistributionsCommand(context))
    contents_section.add_command(contents.SearchErrataCommand(context))
    contents_section.add_command(
        contents.SearchYumMetadataFileCommand(context))

    # Add the group section, all its subsections, and commands
    group_export_section = structure.repo_group_export_section(context.cli)
    renderer = PublishStepStatusRenderer(context)
    group_export_section.add_command(
        export.RpmGroupExportCommand(context, renderer))
    group_export_section.add_command(
        export.GroupExportStatusCommand(context, renderer))

    uploads_section = structure.repo_uploads_section(context.cli)
    uploads_section.add_command(
        package.CreateRpmCommand(context, upload_manager))
    uploads_section.add_command(
        package.CreateSrpmCommand(context, upload_manager))
    uploads_section.add_command(
        errata.CreateErratumCommand(context, upload_manager))
    uploads_section.add_command(
        package_group.CreatePackageGroupCommand(context, upload_manager))
    uploads_section.add_command(
        category.CreatePackageCategoryCommand(context, upload_manager))
    uploads_section.add_command(
        comps.CreateCompsCommand(context, upload_manager))
    uploads_section.add_command(
        environment.CreatePackageEnvironmentCommand(context, upload_manager))
    uploads_section.add_command(upload.ResumeCommand(context, upload_manager))
    uploads_section.add_command(upload.CancelCommand(context, upload_manager))
    uploads_section.add_command(upload.ListCommand(context, upload_manager))

    sync_section = structure.repo_sync_section(context.cli)
    renderer = status.RpmStatusRenderer(context)
    sync_section.add_command(
        sync_publish.RunSyncRepositoryCommand(context, renderer))
    sync_section.add_command(sync_publish.SyncStatusCommand(context, renderer))

    publish_section = structure.repo_publish_section(context.cli)
    renderer = PublishStepStatusRenderer(context)
    distributor_id = ids.TYPE_ID_DISTRIBUTOR_YUM
    publish_section.add_command(
        sync_publish.RunPublishRepositoryCommand(context, renderer,
                                                 distributor_id))
    publish_section.add_command(
        sync_publish.PublishStatusCommand(context, renderer))

    repo_export_section = structure.repo_export_section(context.cli)
    renderer = PublishStepStatusRenderer(context)
    repo_export_section.add_command(export.RpmExportCommand(context, renderer))
    repo_export_section.add_command(
        sync_publish.PublishStatusCommand(context,
                                          renderer,
                                          description=DESC_EXPORT_STATUS))

    sync_schedules_section = structure.repo_sync_schedules_section(context.cli)
    sync_schedules_section.add_command(
        sync_schedules.RpmCreateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.RpmUpdateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.RpmDeleteScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.RpmListScheduleCommand(context))

    sync_schedules_section.add_command(
        sync_schedules.RpmNextRunCommand(context))