def test_ensure_repo_structure_idempotency(self):
        # Test
        structure.ensure_repo_structure(self.cli)
        repo_section = structure.ensure_repo_structure(self.cli)

        # Verify
        self.assertTrue(repo_section is not None)
        self.assertEqual(repo_section.name, structure.SECTION_REPO)
    def test_ensure_repo_structure_no_root(self):
        # Test
        repo_section = structure.ensure_repo_structure(self.cli)

        # Verify
        self.assertTrue(repo_section is not None)
        self.assertEqual(repo_section.name, structure.SECTION_REPO)
        puppet_root_section = self.cli.find_section(structure.SECTION_ROOT)
        self.assertTrue(puppet_root_section is not None)
 def setUp(self):
     super(SectionRetrievalTests, self).setUp()
     structure.ensure_repo_structure(self.cli)
Example #4
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.AllCopyCommand(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.SrpmCopyCommand(context))
    # 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.DistributionRemoveCommand(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.SearchDistributionsCommand(context))
    contents_section.add_command(contents.SearchErrataCommand(context))

    # Add the group section, all its subsections, and commands
    group_export_section = structure.repo_group_export_section(context.cli)
    renderer = status.RpmGroupExportStatusRenderer(context)
    group_export_section.add_command(export.RpmGroupExportCommand(context, renderer,
                                                                  ids.EXPORT_GROUP_DISTRIBUTOR_ID))
    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(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(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 = status.RpmStatusRenderer(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 = status.RpmExportStatusRenderer(context)
    repo_export_section.add_command(export.RpmExportCommand(context))
    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))
Example #5
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.RpmRepoCreateCommand(context))
    repo_section.add_command(repo.RpmRepoUpdateCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(repo.RpmRepoListCommand(context))
    repo_section.add_command(repo.RpmRepoSearchCommand(context))

    copy_section = structure.repo_copy_section(context.cli)
    copy_section.add_command(copy.RpmCopyCommand(context))
    copy_section.add_command(copy.SrpmCopyCommand(context))
    copy_section.add_command(copy.DrpmCopyCommand(context))
    copy_section.add_command(copy.ErrataCopyCommand(context))
    copy_section.add_command(copy.DistributionCopyCommand(context))
    copy_section.add_command(copy.PackageGroupCopyCommand(context))
    copy_section.add_command(copy.PackageCategoryCopyCommand(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.DistributionRemoveCommand(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.SearchDistributionsCommand(context))
    contents_section.add_command(contents.SearchErrataCommand(context))

    uploads_section = structure.repo_uploads_section(context.cli)
    uploads_section.add_command(package.CreateRpmCommand(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(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 = status.RpmStatusRenderer(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))

    export_section = structure.repo_export_section(context.cli)
    renderer = status.RpmIsoStatusRenderer(context)
    export_section.add_command(export.RpmIsoExportCommand(context))
    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))