本文整理汇总了Python中nailgun.statistics.fuel_statistics.installation_info.InstallationInfo.get_installation_info方法的典型用法代码示例。如果您正苦于以下问题:Python InstallationInfo.get_installation_info方法的具体用法?Python InstallationInfo.get_installation_info怎么用?Python InstallationInfo.get_installation_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.statistics.fuel_statistics.installation_info.InstallationInfo
的用法示例。
在下文中一共展示了InstallationInfo.get_installation_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_installation_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_installation_info [as 别名]
def test_installation_info(self):
info = InstallationInfo()
nodes_params = [
{'roles': ['compute']},
{'roles': ['compute']},
{'roles': ['controller']}
]
self.env.create(
release_kwargs={
'operating_system': consts.RELEASE_OS.centos
},
cluster_kwargs={},
nodes_kwargs=nodes_params
)
unallocated_nodes_params = [
{'status': consts.NODE_STATUSES.discover},
{'status': consts.NODE_STATUSES.discover}
]
for unallocated_node in unallocated_nodes_params:
self.env.create_node(**unallocated_node)
info = info.get_installation_info()
self.assertEquals(1, info['clusters_num'])
self.assertEquals(len(nodes_params), info['allocated_nodes_num'])
self.assertEquals(len(unallocated_nodes_params),
info['unallocated_nodes_num'])
self.assertTrue('master_node_uid' in info)
self.assertTrue('contact_info_provided' in info['user_information'])
self.assertDictEqual(settings.VERSION, info['fuel_release'])
示例2: test_all_cluster_data_collected
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_installation_info [as 别名]
def test_all_cluster_data_collected(self):
self.env.create(nodes_kwargs=[{"roles": ["compute"]}])
self.env.create_node(status=consts.NODE_STATUSES.discover)
# Fetching installation info struct
info = InstallationInfo()
info = info.get_installation_info()
actual_cluster = info["clusters"][0]
# Creating cluster schema
cluster_schema = {}
for column in inspect(cluster_model.Cluster).columns:
cluster_schema[six.text_type(column.name)] = None
for rel in inspect(cluster_model.Cluster).relationships:
cluster_schema[six.text_type(rel.table.name)] = None
# Removing of not required fields
remove_fields = (
"tasks",
"cluster_changes",
"nodegroups",
"pending_release_id",
"releases",
"replaced_provisioning_info",
"notifications",
"deployment_tasks",
"name",
"replaced_deployment_info",
"ui_settings",
)
for field in remove_fields:
cluster_schema.pop(field)
# Renaming fields for matching
rename_fields = (
("plugins", "installed_plugins"),
("networking_configs", "network_configuration"),
("release_id", "release"),
)
for name_from, name_to in rename_fields:
cluster_schema.pop(name_from)
cluster_schema[name_to] = None
# If test failed here it means, that you have added properties
# to cluster and they are not exported into statistics.
# If you don't know what to do, contact fuel-stats team please.
for key in six.iterkeys(cluster_schema):
self.assertIn(key, actual_cluster)
示例3: test_installation_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_installation_info [as 别名]
def test_installation_info(self):
info = InstallationInfo()
nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
self.env.create(
release_kwargs={"operating_system": consts.RELEASE_OS.centos}, cluster_kwargs={}, nodes_kwargs=nodes_params
)
unallocated_nodes_params = [
{"status": consts.NODE_STATUSES.discover},
{"status": consts.NODE_STATUSES.discover},
]
for unallocated_node in unallocated_nodes_params:
self.env.create_node(**unallocated_node)
info = info.get_installation_info()
self.assertEquals(1, info["clusters_num"])
self.assertEquals(len(nodes_params), info["allocated_nodes_num"])
self.assertEquals(len(unallocated_nodes_params), info["unallocated_nodes_num"])
self.assertTrue("master_node_uid" in info)
self.assertTrue("contact_info_provided" in info["user_information"])
self.assertDictEqual(settings.VERSION, info["fuel_release"])
示例4: test_all_cluster_data_collected
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_installation_info [as 别名]
def test_all_cluster_data_collected(self):
self.env.create(nodes_kwargs=[{'roles': ['compute']}])
self.env.create_node(status=consts.NODE_STATUSES.discover)
# Fetching installation info struct
info = InstallationInfo()
info = info.get_installation_info()
actual_cluster = info['clusters'][0]
cluster_schema = self.get_model_schema(models.Cluster)
# Removing of not required fields
remove_fields = (
'tasks', 'cluster_changes', 'nodegroups',
'releases', 'replaced_provisioning_info', 'notifications',
'cluster_deployment_graphs', 'name', 'replaced_deployment_info',
'ui_settings'
)
for field in remove_fields:
cluster_schema.pop(field)
# Renaming fields for matching
rename_fields = (
('plugins', 'installed_plugins'),
('networking_configs', 'network_configuration'),
('release_id', 'release'),
('cluster_plugin_links', 'plugin_links'),
)
for name_from, name_to in rename_fields:
cluster_schema.pop(name_from)
cluster_schema[name_to] = None
# If test failed here it means, that you have added properties
# to cluster and they are not exported into statistics.
# If you don't know what to do, contact fuel-stats team please.
for key in six.iterkeys(cluster_schema):
self.assertIn(key, actual_cluster)