• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python repo.Repo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pulp_auto.repo.Repo的典型用法代码示例。如果您正苦于以下问题:Python Repo类的具体用法?Python Repo怎么用?Python Repo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Repo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_02_check_role_permission

    def test_02_check_role_permission(self):
        # create users
        self.user.create(self.pulp)
        self.assertPulpOK()

        self.user2.create(self.pulp)
        self.assertPulpOK()

        # add users to the role
        self.role.add_user(
            self.pulp,
            data={'login': self.user.data['login']}
        )
        self.assertPulp(code=200)

        self.role.add_user(
            self.pulp,
            data={'login': self.user2.data['login']}
        )
        self.assertPulp(code=200)

        # check users' permissions
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)

        with self.user_pulp2.asserting(True):
            Repo.list(self.user_pulp2)
开发者ID:alexxa,项目名称:pulp-automation,代码行数:27,代码来源:test_8_role_permissions.py


示例2: test_15_check_bindings_removed

 def test_15_check_bindings_removed(self):
     self.role.delete(self.pulp)
     self.assertPulpOK()
     #check that after role deletion user binding are also removed
     with self.assertRaises(AssertionError):
         with self.user_pulp.asserting(True):
             Repo.list(self.user_pulp)
开发者ID:lenfree,项目名称:pulp-automation,代码行数:7,代码来源:test_6_roles.py


示例3: test_04_check_role_permission

    def test_04_check_role_permission(self):
        # create users
        self.user.create(self.pulp)
        self.assertPulpOK()

        self.user2.create(self.pulp)
        self.assertPulpOK()

        # add users to the role
        self.role.add_user(
            self.pulp,
            self.user.id
        )
        self.assertPulp(code=200)

        self.role.add_user(
            self.pulp,
            self.user2.id
        )
        self.assertPulp(code=200)

        # check users' permissions, that thay can access resource after been added to specific role
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)

        with self.user_pulp2.asserting(True):
            Repo.list(self.user_pulp2)
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:27,代码来源:test_08_role_permissions.py


示例4: test_02_copy_repo1_to_repo2

 def test_02_copy_repo1_to_repo2(self):
     with self.pulp.asserting(True):
         response = self.repo2.copy(self.pulp, self.repo1.id, data={})
     Task.wait_for_report(self.pulp, response)
     
     #check that the number of modules are the same
     repo1 = Repo.get(self.pulp, self.repo1.id)
     repo2 = Repo.get(self.pulp, self.repo2.id)
     self.assertEqual(repo1.data['content_unit_counts'], repo2.data['content_unit_counts'])
开发者ID:RedHatQE,项目名称:pulp-automation,代码行数:9,代码来源:test_01_rpm_repo_copy.py


示例5: test_02_get_repo

 def test_02_get_repo(self):
     repo = Repo.get(self.pulp, self.repo.id)
     self.assertEqual(repo.id, self.repo.id)
     self.repo.reload(self.pulp)
     self.assertEqual(self.repo, repo)
     #get unexistant repo
     with self.assertRaises(AssertionError):
         Repo.get(self.pulp, 'some_id')
     self.assertPulp(code=404)
开发者ID:jeremycline,项目名称:pulp-automation,代码行数:9,代码来源:test_2_rpm_repo.py


示例6: test_07_sync_repo

 def test_07_sync_repo(self):
     x = Repo.get(self.pulp, self.repo.id).data['content_unit_counts']['puppet_module']
     response = self.repo.sync(self.pulp)
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     y = Repo.get(self.pulp, self.repo.id).data['content_unit_counts']['puppet_module']
     #FIXME result can change with time as number of modules is not constant!
     #check that the second i.e. updated query was also processed.
     self.assertTrue(x != y)
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:9,代码来源:test_11_puppet_modules_repo.py


示例7: RepoTest

class RepoTest(pulp_test.PulpTest):
    def setUp(self):
        super(RepoTest, self).setUp()
        self.repo = Repo(data={'id': type(self).__name__ + "_repo"})
        self.feed = 'http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/'
        # assert connection works
        self.pulp.send(login.request())
        self.assertPulpOK()

    def tearDown(self):
        self.repo.delete(self.pulp)
开发者ID:alexxa,项目名称:pulp-automation,代码行数:11,代码来源:test_3_race.py


示例8: setUpClass

 def setUpClass(cls):
     super(SimpleOrphanTest, cls).setUpClass()
     # prepare orphans by syncing and deleting a repo
     # make sure the repo is gone
     repo_config = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
     repo = Repo(repo_config)
     repo.delete(cls.pulp)
     # create and sync repo
     cls.repo, _, _ = create_yum_repo(cls.pulp, **repo_config)
     Task.wait_for_report(cls.pulp, cls.repo.sync(cls.pulp))
     # this is where orphans appear
     Task.wait_for_report(cls.pulp, cls.repo.delete(cls.pulp))
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:12,代码来源:test_10_orphans.py


示例9: test_02_copy_repo_to_repo_copy_and_publish

    def test_02_copy_repo_to_repo_copy_and_publish(self):
        with self.pulp.asserting(True):
            response = self.repo_copy.copy(self.pulp, self.repo.id, data={})
        Task.wait_for_report(self.pulp, response)
        
        #check that the number of modules are the same
        repo = Repo.get(self.pulp, self.repo.id)
        repo_copy = Repo.get(self.pulp, self.repo_copy.id)
        self.assertEqual(repo.data['content_unit_counts'], repo_copy.data['content_unit_counts'])

        with self.pulp.asserting(True):        
            response = self.repo_copy.publish(self.pulp, self.distributor_copy.id)
        Task.wait_for_report(self.pulp, response)        
开发者ID:RedHatQE,项目名称:pulp-automation,代码行数:13,代码来源:test_02_iso_repo.py


示例10: test_99_node_unbind_repo

 def test_99_node_unbind_repo(self):
     self.node.unbind_repo(self.pulp, self.repo.id, self.node_distributor.id)
     self.assertPulpOK()
     # nodes keep the repos after updating
     child_repos = Repo.list(self.pulp_child)
     for repo in child_repos:
         Task.wait_for_report(self.pulp_child, repo.delete(self.pulp_child))
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:7,代码来源:test_01_cud.py


示例11: test_11_two_roles_two_users

    def test_11_two_roles_two_users(self):
        # create users
        self.user.create(self.pulp)
        self.assertPulpOK()

        self.user2.create(self.pulp)
        self.assertPulpOK()

        # grant permissions
        self.role.grant_permission(self.pulp, self.role.id, "/", ["READ", "EXECUTE"])
        self.role.grant_permission(self.pulp, self.role.id, "/repositories/", ["READ", "EXECUTE"])
        self.assertPulpOK()

        self.role2.grant_permission(self.pulp, self.role2.id, "/", ["READ", "EXECUTE"])
        self.role2.grant_permission(self.pulp, self.role2.id, "/repositories/", ["READ", "EXECUTE"])
        self.assertPulpOK()

        # add users to roles
        self.role.add_user(
            self.pulp,
            self.user.id
        )
        self.assertPulp(code=200)

        self.role2.add_user(
            self.pulp,
            self.user.id
        )
        self.assertPulp(code=200)

        self.role2.add_user(
            self.pulp,
            self.user2.id
        )
        self.assertPulp(code=200)

        # check users' permissions
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)

        with self.user_pulp2.asserting(True):
            Repo.list(self.user_pulp2)

        # revoke permissions from role2
        self.role2.revoke_permission(self.pulp, self.role2.id, "/", ["READ", "EXECUTE"])
        self.role2.revoke_permission(self.pulp, self.role2.id, "/repositories/", ["READ", "EXECUTE"])
        self.assertPulpOK()

        # check users' permissions
        # user should still be able to access resource as it belongs to other role
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)
        # user2 should not be able to access resource as no more pemissions are granted to it
        with self.assertRaises(AssertionError):
            with self.user_pulp2.asserting(True):
                Repo.list(self.user_pulp2)
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:56,代码来源:test_08_role_permissions.py


示例12: test_06_two_roles_two_users

    def test_06_two_roles_two_users(self):
        # create users
        self.user.create(self.pulp)
        self.assertPulpOK()

        self.user2.create(self.pulp)
        self.assertPulpOK()

        # grant permissions
        self.role.grant_permission(self.pulp, data={"role_id": self.role.data['id'], "resource": "/", "operations": ["READ", "EXECUTE"]})
        self.role.grant_permission(self.pulp, data={"role_id": self.role.data['id'], "resource": "/repositories/", "operations": ["READ", "EXECUTE"]})
        self.assertPulpOK()

        self.role2.grant_permission(self.pulp, data={"role_id": self.role2.data['id'], "resource": "/", "operations": ["READ", "EXECUTE"]})
        self.role2.grant_permission(self.pulp, data={"role_id": self.role2.data['id'], "resource": "/repositories/", "operations": ["READ", "EXECUTE"]})
        self.assertPulpOK()

        # add users to roles
        self.role.add_user(
            self.pulp,
            data={'login': self.user.data['login']}
        )
        self.assertPulp(code=200)

        self.role2.add_user(
            self.pulp,
            data={'login': self.user.data['login']}
        )
        self.assertPulp(code=200)

        self.role2.add_user(
            self.pulp,
            data={'login': self.user2.data['login']}
        )
        self.assertPulp(code=200)

        # check users' permissions
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)

        with self.user_pulp2.asserting(True):
            Repo.list(self.user_pulp2)

        # revoke permissions from role2
        self.role2.revoke_permission(self.pulp, data={"role_id": self.role2.data['id'], "resource": "/", "operations": ["READ", "EXECUTE"]})
        self.role2.revoke_permission(self.pulp, data={"role_id": self.role2.data['id'], "resource": "/repositories/", "operations": ["READ", "EXECUTE"]})
        self.assertPulpOK()

        # check users' permissions
        with self.user_pulp.asserting(True):
            Repo.list(self.user_pulp)

        with self.assertRaises(AssertionError):
            with self.user_pulp2.asserting(True):
                Repo.list(self.user_pulp2)
开发者ID:alexxa,项目名称:pulp-automation,代码行数:55,代码来源:test_8_role_permissions.py


示例13: pulp_repo_url

def pulp_repo_url(pulp, repo_id, distributor_type_id='yum_distributor'):
    '''return repo content url for given repo id or None'''
    repo = Repo.get(pulp, repo_id)
    # this should at most 1 item (for any given type)
    distributors = [distributor for distributor in repo.list_distributors(pulp) \
        if distributor['distributor_type_id'] == distributor_type_id]
    if not distributors:
        return None
    return Distributor(data=distributors[0]).content_url(pulp)
开发者ID:dparalen,项目名称:pulp-automation,代码行数:9,代码来源:upload.py


示例14: test_04_check_that_one_iso

 def test_04_check_that_one_iso(self):
     # check that there is precisly one module
     dest_repo2 = Repo.get(self.pulp, self.dest_repo2.id)
     self.assertEqual(dest_repo2.data["content_unit_counts"]["iso"], 1)
     # check that one exact module copied i.e. perform the search by modules name
     response = self.dest_repo2.within_repo_search(
         self.pulp, data={"criteria": {"type_ids": ["iso"], "filters": {"unit": {"name": "test.iso"}}}}
     )
     self.assertPulp(code=200)
     result = Association.from_response(response)
     # this means that only one module found with that name
     self.assertTrue(len(result) == 1)
开发者ID:preethit,项目名称:pulp-automation,代码行数:12,代码来源:test_17_iso_repo_orphans_and_copy.py


示例15: test_04_search_repo_in_repos

 def test_04_search_repo_in_repos(self):
     # search among puppet-repos by id
     repo = Repo.search(
         self.pulp,
         data={
             "criteria": {
                 "sort": None,
                 "fields": None,
                 "limit": None,
                 "filters": {"$and": [{"id": "SimplePuppetSearchRepoTest"}, {"notes._repo-type": "puppet-repo"}]},
                 "skip": None,
             }
         },
     )
     self.assertIn(Repo({"id": self.repo.id}, ["id"], ["id"]), repo)
开发者ID:pombredanne,项目名称:pulp-automation,代码行数:15,代码来源:test_12_puppet_repo_and_modules_search.py


示例16: test_05_search_repo_with_regexp

 def test_05_search_repo_with_regexp(self):
     # search puppet-repos with .*repo.*
     repo = Repo.search(
         self.pulp,
         data={
             "criteria": {
                 "sort": None,
                 "fields": None,
                 "limit": None,
                 "filters": {"$and": [{"notes._repo-type": "puppet-repo"}, {"id": {"$regex": ".*Repo.*"}}]},
                 "skip": None,
             }
         },
     )
     # asserting to 2 as we have two repos matched the pattern
     self.assertTrue(len(repo) == 2)
开发者ID:pombredanne,项目名称:pulp-automation,代码行数:16,代码来源:test_12_puppet_repo_and_modules_search.py


示例17: setUpClass

    def setUpClass(cls):
        super(SimpleRepoCopyTest, cls).setUpClass()
        #Destination repo
        feed = None
        dest_repo_name = cls.__name__ + '_copy'
        dest_repo1 = Repo({'id': dest_repo_name})
        dest_repo1.delete(cls.pulp)
        cls.dest_repo1, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        #2nd Destination Repo
        dest_repo_name = cls.__name__ + '_copy1'
        dest_repo2 = Repo({'id': dest_repo_name})
        dest_repo2.delete(cls.pulp)
        cls.dest_repo2, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        # Source repo
        default_repo_config = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
        source_repo_name = cls.__name__ + '_repo'
        source_repo = Repo({'id': source_repo_name})
        source_repo.delete(cls.pulp)
        cls.source_repo, _, _ = create_yum_repo(cls.pulp, source_repo_name, default_repo_config.feed)
        sync_task = Task.from_response(cls.source_repo.sync(cls.pulp))[0]
        sync_task.wait(cls.pulp)
开发者ID:alexxa,项目名称:pulp-automation,代码行数:23,代码来源:test_12_yum_repo_copy.py


示例18: test_06_child_repo_content

    def test_06_child_repo_content(self):
        # access the content of the pulp_child node
        # please note when the repo is created on the other node,
        # the distributor id used by default is yum_distributor

        # make sure the repo was published on the child node
        # the repo ID and distributor ID are the same on both the nodes
        child_repo = Repo.get(self.pulp_child, self.repo.id)
        response = child_repo.publish(self.pulp_child, self.distributor.id)
        assert response == ResponseLike(202), 'wrong response from the child node: %s' % response
        Task.wait_for_report(self.pulp_child, response)

        # fetch the repo content url on the child node
        repo_url = pulp_repo_url(self.pulp_child, self.repo.id)
        assert repo_url, 'invalid repo id on pulp_child node'
        # try accessing the content on the child node
        pkg_name = download_package_with_dnf(self.pulp_child, repo_url, 'bear')
        assert pkg_name == 'bear', 'not able to acces bear rpm on the child node'
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:18,代码来源:test_01_cud.py


示例19: setUpClass

    def setUpClass(cls):
        super(SimpleRepoCopyTest, cls).setUpClass()
        #Destination repo
        # make sure repos don't exist
        # no need to wait for repos.delete to happen
        feed = None
        dest_repo_name = cls.__name__ + '_copy'
        dest_repo1 = Repo({'id': dest_repo_name})
        dest_repo1.delete(cls.pulp)
        cls.dest_repo1, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        #2nd Destination Repo
        dest_repo_name = cls.__name__ + '_copy1'
        dest_repo2 = Repo({'id': dest_repo_name})
        dest_repo2.delete(cls.pulp)
        cls.dest_repo2, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        # Source repo
        default_repo_config = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
        source_repo_name = cls.__name__ + '_repo'
        source_repo = Repo({'id': source_repo_name})
        source_repo.delete(cls.pulp)
        cls.source_repo, _, _ = create_yum_repo(cls.pulp, source_repo_name, default_repo_config.feed)
        Task.wait_for_report(cls.pulp, cls.source_repo.sync(cls.pulp))
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:24,代码来源:test_12_yum_repo_copy.py


示例20: test_07_associate_importer

 def test_07_associate_importer(self):
     response = self.repo.associate_importer(
         self.pulp,
         data={
             'importer_type_id': 'yum_importer',
             'importer_config': {
                 'feed': self.feed
             }
         }
     )
     self.assertPulp(code=202)
     importer = Repo.from_report(response)['result']
     Task.wait_for_report(self.pulp, response)
     #https://bugzilla.redhat.com/show_bug.cgi?id=1076225
     self.assertEqual({
             'id': 'yum_importer',
             'importer_type_id': 'yum_importer',
             'repo_id': self.repo.id,
             'config': {
                 'feed': self.feed
             },
             'last_sync': None
         },
         importer)
开发者ID:lenfree,项目名称:pulp-automation,代码行数:24,代码来源:test_2_rpm_repo.py



注:本文中的pulp_auto.repo.Repo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python task.Task类代码示例发布时间:2022-05-25
下一篇:
Python util.generate_redirect_response函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap