6 class get_boot_state(Test):
8 Continually checks the boot_state of the specified node until
9 either the node reaches boot, the node reaches debug or the
12 Timeout represents the ammout of time (in minutes) we should
13 continue trying before quitting.
15 Sleep represnet the ammount of time (in seconds) to wait in
18 Returns the boot state of the node.
20 def call(self, hostname, timeout = 5, sleep = 30):
23 auth = self.config.auth
26 nodes = api.GetNodes(auth, [hostname], ['hostname'])
28 raise Exception, "No such hostname %(hostname)s" % locals()
30 start_time = time.time()
31 end_time = start_time + (timeout * 60)
34 nodes = api.GetNodes(auth, [hostname], ['boot_state'])
36 boot_state = node['boot_state']
37 if self.config.verbose:
38 utils.header("%(hostname)s boot_state is %(boot_state)s" % locals())
40 if boot_state in ['boot', 'debug']:
42 elif time.time() < end_time:
48 if self.config.verbose:
49 if boot_state in ['boot']:
50 utils.header("%(hostname)s correctly installed and booted" % locals())
52 utils.header("%(hostname)s not fully booted" % locals())
56 if __name__ == '__main__':
57 args = tuple(sys.argv[1:])
58 get_boot_state()(*args)