本文整理匯總了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)