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
 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')
 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')
 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)
 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)