本文整理汇总了Python中nailgun.statistics.fuel_statistics.installation_info.InstallationInfo.get_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python InstallationInfo.get_attributes方法的具体用法?Python InstallationInfo.get_attributes怎么用?Python InstallationInfo.get_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.statistics.fuel_statistics.installation_info.InstallationInfo
的用法示例。
在下文中一共展示了InstallationInfo.get_attributes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_attributes_centos
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def test_get_attributes_centos(self):
self.skipTest("CentOS is unavailable in current release.")
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system="CentOS")
cluster_data = self.env.create_cluster(release_id=release[0].id)
cluster = Cluster.get_by_uid(cluster_data["id"])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(set(attr_key_list), set(attrs_dict.keys()))
示例2: test_get_attributes_exception_handled
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def test_get_attributes_exception_handled(self):
info = InstallationInfo()
variants = [
None,
{},
{'common': None},
{'common': {'libvirt_type': {}}},
{'common': {'libvirt_type': 3}},
]
for attrs in variants:
result = info.get_attributes(attrs, info.attributes_white_list)
self.assertDictEqual({}, result)
示例3: test_get_attributes_ubuntu
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def test_get_attributes_ubuntu(self):
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system="Ubuntu")
cluster_data = self.env.create_cluster(release_id=release[0].id)
cluster = Cluster.get_by_uid(cluster_data["id"])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(
# no vlan splinters for ubuntu
set(attr_key_list) - set(("vlan_splinters", "vlan_splinters_ovs")),
set(attrs_dict.keys()),
)
示例4: _do_test_attributes_in_white_list
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def _do_test_attributes_in_white_list(self, release,
expected_attributes):
cluster_data = self.env.create_cluster(
release_id=release.id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
info = InstallationInfo()
actual_attributes = info.get_attributes(
editable, info.attributes_white_list)
self.assertEqual(
set(expected_attributes),
set(actual_attributes.keys())
)
示例5: test_get_attributes_ubuntu
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def test_get_attributes_ubuntu(self):
self.env.upload_fixtures(['openstack'])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='Ubuntu')
cluster_data = self.env.create_cluster(
release_id=release[0].id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(
# No vlan splinters for ubuntu.
# And no mellanox related entries since 8.0.
set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser')),
set(attrs_dict.keys())
)
示例6: test_get_empty_attributes
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_attributes [as 别名]
def test_get_empty_attributes(self):
info = InstallationInfo()
trash_attrs = {'some': 'trash', 'nested': {'n': 't'}}
result = info.get_attributes(trash_attrs, info.attributes_white_list)
self.assertDictEqual({}, result)