7 class get_boot_state(Test):
9 Continually checks the boot_state of the specified node until
10 either the node reaches boot, the node reaches debug or the
13 Timeout represents the ammout of time (in minutes) we should
14 continue trying before quitting.
16 Sleep represnet the ammount of time (in seconds) to wait in
19 Returns the boot state of the node.
21 def call(self, hostname, timeout = 5, sleep = 30):
24 auth = self.config.auth
27 nodes = api.GetNodes(auth, [hostname], ['hostname'])
29 raise Exception, "No such hostname %(hostname)s" % locals()
31 start_time = time.time()
32 end_time = start_time + (timeout * 60)
35 nodes = api.GetNodes(auth, [hostname], ['boot_state'])
37 boot_state = node['boot_state']
38 if self.config.verbose:
39 utils.header("%(hostname)s boot_state is %(boot_state)s" % locals())
41 if boot_state in ['boot', 'debug']:
43 elif time.time() < end_time:
49 if self.config.verbose:
50 if boot_state in ['boot']:
51 utils.header("%(hostname)s correctly installed and booted" % locals())
53 utils.header("%(hostname)s not fully booted" % locals())
57 if __name__ == '__main__':
58 args = tuple(sys.argv[1:])
59 get_boot_state()(*args)