def ssh(self, processors=1): StopWatch.start(f"total p={processors} c=1") r = Host.ssh(hosts, command="hostname", processors=processors) StopWatch.stop(f"total p={processors} c=1") return r
def test_internal_ping(self): StopWatch.start("total _ping") for host in hosts: location = { 'ip': host, 'count': 1, } StopWatch.start(f"ping {host}") result = Host._ping(location) StopWatch.stop(f"ping {host}") StopWatch.stop("total _ping") assert result['success']
def test_internal_ssh(self): print() StopWatch.start("total _ssh") for host in hosts: location = { 'host': host, 'username': os.environ['USER'], 'key': '~/.ssh/id_rsa.pub', 'command': 'uname -a' } StopWatch.start(f"ssh {host}") result = Host._ssh(location) StopWatch.stop(f"ssh {host}") StopWatch.stop("total _ssh") assert result.success
def test_internal_ping(self): HEADING() StopWatch.start("total _ping") for host in hosts: location = { 'ip': host, 'count': 1, } StopWatch.start(f"ping {host}") result = Host._ping(location) StopWatch.stop(f"ping {host}") StopWatch.stop("total _ping") if b'Access denied' in result['stdout'] and sys.platform == "win32": print("ERROR: This test must be run in an administrative " "terminal") assert result['success']
def ping(self, processors=1): StopWatch.start(f"total p={processors} c=1") r = Host.ping(hosts, processors=processors, count=1) StopWatch.stop(f"total p={processors} c=1") return r