本文整理汇总了Python中app.util.network.Network.rsa_key方法的典型用法代码示例。如果您正苦于以下问题:Python Network.rsa_key方法的具体用法?Python Network.rsa_key怎么用?Python Network.rsa_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.util.network.Network
的用法示例。
在下文中一共展示了Network.rsa_key方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _non_registered_slaves
# 需要导入模块: from app.util.network import Network [as 别名]
# 或者: from app.util.network.Network import rsa_key [as 别名]
def _non_registered_slaves(self, registered_slaves, slaves_to_validate):
"""
Return list of slave hosts that have failed to register with the master service.
:param slaves_to_validate: list of slave hostnames to check for
:type slaves_to_validate: list[str]
:return: list of slave hostnames that haven't registered with the master service yet
:rtype: list[str]
"""
registered_rsa_keys = []
for registered_slave in registered_slaves:
registered_rsa_keys.append(Network.rsa_key(registered_slave))
slaves_to_validate_rsa_key_host_pairs = {}
for slave_to_validate in slaves_to_validate:
slaves_to_validate_rsa_key_host_pairs[Network.rsa_key(slave_to_validate)] = slave_to_validate
non_registered_slave_hosts = []
for rsa_key in slaves_to_validate_rsa_key_host_pairs:
if rsa_key not in registered_rsa_keys:
non_registered_slave_hosts.append(slaves_to_validate_rsa_key_host_pairs[rsa_key])
return non_registered_slave_hosts
示例2: test_rsa_key_returns_output_without_ssh_rsa_str
# 需要导入模块: from app.util.network import Network [as 别名]
# 或者: from app.util.network.Network import rsa_key [as 别名]
def test_rsa_key_returns_output_without_ssh_rsa_str(self):
self._patch_popen_call_to_ssh_keyscan(0, b"a_host ssh-rsa thebytearray", None)
rsa_key = Network.rsa_key('a_host')
self.assertEquals(rsa_key, 'thebytearray')
示例3: test_rsa_key_returns_none_if_ssh_keyscan_error
# 需要导入模块: from app.util.network import Network [as 别名]
# 或者: from app.util.network.Network import rsa_key [as 别名]
def test_rsa_key_returns_none_if_ssh_keyscan_error(self):
self._patch_popen_call_to_ssh_keyscan(1, 'some_output', 'some_error"')
rsa_key = Network.rsa_key('some_host_that_causes_it_to_fail')
self.assertIsNone(rsa_key)