当前位置: 首页>>代码示例>>Python>>正文


Python CI.get_uid_by_content_object方法代码示例

本文整理汇总了Python中ralph.cmdb.models_ci.CI.get_uid_by_content_object方法的典型用法代码示例。如果您正苦于以下问题:Python CI.get_uid_by_content_object方法的具体用法?Python CI.get_uid_by_content_object怎么用?Python CI.get_uid_by_content_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ralph.cmdb.models_ci.CI的用法示例。


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

示例1: setUp

# 需要导入模块: from ralph.cmdb.models_ci import CI [as 别名]
# 或者: from ralph.cmdb.models_ci.CI import get_uid_by_content_object [as 别名]
    def setUp(self):
        self.user = create_user(
            'api_user',
            '[email protected]',
            'password',
            is_superuser=True
        )
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        self.post_data_puppet = {
            'configuration_version': self.puppet_cv,
            'host': 's11111.dc2',
            'kind': 'apply',
            'status': 'failed',
            'time': '2012-11-14 13:00:00',
        }

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        self.post_data_git = {
            'author': 'Jan Kowalski',
            'changeset': self.git_changeset,
            'comment': self.git_comment,
            'file_paths': '/some/path',
        }

        temp_venture = Venture.objects.create(name='TempTestVenture')
        if settings.AUTOCI:
            self.ci = CI.get_by_content_object(temp_venture)
        else:
            CIImporter().import_single_object(temp_venture)
            self.ci = CI.objects.create(
                name='TempTestVentureCI',
                uid=CI.get_uid_by_content_object(temp_venture),
                type_id=4,
            )

        self.cmdb_new_value = 'nv_%s' % random.randrange(0, 1000)
        self.cmdb_old_value = 'ov_%s' % random.randrange(0, 1000)
        self.post_data_cmdb_change = {
            'ci': '/api/v0.9/ci/%d/' % self.ci.pk,
            'comment': 'test api',
            'field_name': 'child',
            'new_value': self.cmdb_new_value,
            'old_value': self.cmdb_old_value,
            'time': '2012-11-15 12:00:00',
        }
        cache.clear()
开发者ID:andrzej-jankowski,项目名称:ralph,代码行数:49,代码来源:tests_api.py

示例2: setUp

# 需要导入模块: from ralph.cmdb.models_ci import CI [as 别名]
# 或者: from ralph.cmdb.models_ci.CI import get_uid_by_content_object [as 别名]
    def setUp(self):
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        puppet_bundle = Bundle(
            data={
                'configuration_version': self.puppet_cv,
                'host': 's11111.dc2',
                'kind': 'apply',
                'status': 'failed',
                'time': '2012-11-14 13:00:00'
            })
        puppet_resource = CIChangePuppetResource()
        puppet_resource.obj_create(bundle=puppet_bundle)

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        git_bundle = Bundle(
            data={
                'author': 'Jan Kowalski',
                'changeset': self.git_changeset,
                'comment': self.git_comment,
                'file_paths': '/some/path',
            })
        git_resource = CIChangeGitResource()
        git_resource.obj_create(bundle=git_bundle)

        temp_venture = Venture.objects.create(name='TempTestVenture')
        self.ci = CI.objects.create(
            name='TempTestVentureCI',
            uid=CI.get_uid_by_content_object(temp_venture),
            type_id=4)
        self.cmdb_new_value = 'nv_%s' % random.randrange(0, 1000)
        self.cmdb_old_value = 'ov_%s' % random.randrange(0, 1000)
        cmdb_bundle = Bundle(
            data={
                'ci': '/api/v0.9/ci/%d/' % self.ci.pk,
                'comment': 'test api',
                'field_name': 'child',
                'new_value': self.cmdb_new_value,
                'old_value': self.cmdb_old_value,
                'time': '2012-11-15 12:00:00'
            })
        cmdb_resource = CIChangeCMDBHistoryResource()
        cmdb_resource.obj_create(bundle=cmdb_bundle)
开发者ID:damjanek,项目名称:ralph,代码行数:45,代码来源:tests_api.py

示例3: setUp

# 需要导入模块: from ralph.cmdb.models_ci import CI [as 别名]
# 或者: from ralph.cmdb.models_ci.CI import get_uid_by_content_object [as 别名]
    def setUp(self):
        self.user = create_user("api_user", "[email protected]", "password", is_superuser=True)
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        self.post_data_puppet = {
            "configuration_version": self.puppet_cv,
            "host": "s11111.dc2",
            "kind": "apply",
            "status": "failed",
            "time": "2012-11-14 13:00:00",
        }

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        self.post_data_git = {
            "author": "Jan Kowalski",
            "changeset": self.git_changeset,
            "comment": self.git_comment,
            "file_paths": "/some/path",
        }

        temp_venture = Venture.objects.create(name="TempTestVenture")
        if settings.AUTOCI:
            self.ci = CI.get_by_content_object(temp_venture)
        else:
            CIImporter().import_single_object(temp_venture)
            self.ci = CI.objects.create(
                name="TempTestVentureCI", uid=CI.get_uid_by_content_object(temp_venture), type_id=4
            )

        self.cmdb_new_value = "nv_%s" % random.randrange(0, 1000)
        self.cmdb_old_value = "ov_%s" % random.randrange(0, 1000)
        self.post_data_cmdb_change = {
            "ci": "/api/v0.9/ci/%d/" % self.ci.pk,
            "comment": "test api",
            "field_name": "child",
            "new_value": self.cmdb_new_value,
            "old_value": self.cmdb_old_value,
            "time": "2012-11-15 12:00:00",
        }
        cache.clear()
开发者ID:ReJeCtAll,项目名称:ralph,代码行数:42,代码来源:tests_api.py


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