def test_get_fqhostname_return(self): ''' Test if proper hostname is used when RevDNS differ from hostname :return: ''' with patch('socket.gethostname', MagicMock(return_value='hostname')), \ patch('socket.getfqdn', MagicMock(return_value='very.long.and.complex.domain.name')), \ patch('socket.getaddrinfo', MagicMock(return_value=[(2, 3, 0, 'hostname', ('127.0.1.1', 0))])): self.assertEqual(network.get_fqhostname(), 'hostname')
def launch_server(): """ Start the salt master here """ hostname = get_fqhostname() ip = host_to_ip(hostname) log.debug("Hellostack start server %s" % ip) master_opts = salt.config.client_config("/etc/salt/master") master = salt.master.Master(master_opts) master.start()