Initial checkin of new API implementation
[plcapi.git] / PLC / BootStates.py
1 #
2 # Functions for interacting with the node_bootstates table in the database
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
6 #
7 # $Id$
8 #
9
10 from PLC.Parameter import Parameter
11
12 class BootStates(list):
13     """
14     Representation of the node_bootstates table in the database.
15     """
16
17     fields = {
18         'boot_state': Parameter(int, "Node boot state"),
19         }
20
21     def __init__(self, api):
22         sql = "SELECT * FROM node_bootstates"
23         
24         for row in api.db.selectall(sql):
25             self.append(row['boot_state'])