當前位置: 首頁>>代碼示例>>Python>>正文


Python Network.rsa_key方法代碼示例

本文整理匯總了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
開發者ID:eltonoliveira,項目名稱:ClusterRunner,代碼行數:28,代碼來源:deploy_subcommand.py

示例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')
開發者ID:eltonoliveira,項目名稱:ClusterRunner,代碼行數:6,代碼來源:test_network.py

示例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)
開發者ID:eltonoliveira,項目名稱:ClusterRunner,代碼行數:6,代碼來源:test_network.py


注:本文中的app.util.network.Network.rsa_key方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。