本文整理汇总了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()
示例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)
示例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()