self.options=options
self.busy=[]
- def locate (self, hostname_or_ip):
+ # let's be flexible
+ def locate (self, hostname_or_ip, busy=False):
for (h,i,u) in self.pool:
- if h==hostname_or_ip or i==hostname_or_ip:
+ if h.find(hostname_or_ip)>=0 or i.find(hostname_or_ip)>=0 :
+ if busy:
+ self.busy.append(h)
return (h,i,u)
return None
def next_free (self):
# if preferred is provided, let's re-order
+ if self.options.quiet:
+ print 'TestPool is looking for a free IP address',
for (host,ip,user_data) in self.pool:
if host in self.busy:
continue
- utils.header('TestPool : checking %s'%host)
+ if not self.options.quiet:
+ utils.header('TestPool : checking %s'%host)
+ if self.options.quiet:
+ print '.',
if not TestPool.check_ping (host):
- utils.header('%s is available'%host)
+ if not self.options.quiet:
+ utils.header('%s is available'%host)
+ else:
+ print ''
self.busy.append(host)
return (host,ip,user_data)
else: