- Timestamp:
- Apr 7, 2012, 5:44:00 PM (13 years ago)
- Location:
- dassmodus/trunk/dassmodus/nosferatu/nosferatu
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
dassmodus/trunk/dassmodus/nosferatu/nosferatu/auto_configrules.py
r990 r991 542 542 # It must have one item for each of the resources. 543 543 dird_resources = [ 544 [ 'catalog' , 'R_CATALOG', dird_cat_items ], 545 [ 'storage' , 'R_STORAGE', dird_store_items ], 546 [ 'fileset' , 'R_FILESET', dird_fs_items ], 547 [ 'pool' , 'R_POOL', dird_pool_items ], 548 [ 'jobdefs' , 'R_JOBDEFS', dird_job_items ], 549 [ 'client' , 'R_CLIENT', dird_cli_items ], 550 [ 'counter' , 'R_COUNTER', dird_counter_items ], 551 [ 'messages' , 'R_MSGS', lib_msgs_items ], 552 [ 'job' , 'R_JOB', dird_job_items ], 553 [ 'director' , 'R_DIRECTOR', dird_dir_items ], 544 554 [ 'console' , 'R_CONSOLE', dird_con_items ], 545 [ 'jobdefs' , 'R_JOBDEFS', dird_job_items ],546 555 [ 'schedule' , 'R_SCHEDULE', dird_sch_items ], 547 [ 'messages' , 'R_MSGS', lib_msgs_items ],548 [ 'counter' , 'R_COUNTER', dird_counter_items ],549 [ 'storage' , 'R_STORAGE', dird_store_items ],550 [ 'catalog' , 'R_CATALOG', dird_cat_items ],551 [ 'fileset' , 'R_FILESET', dird_fs_items ],552 [ 'director' , 'R_DIRECTOR', dird_dir_items ],553 [ 'job' , 'R_JOB', dird_job_items ],554 [ 'client' , 'R_CLIENT', dird_cli_items ],555 [ 'pool' , 'R_POOL', dird_pool_items ],556 556 ] 557 557 -
dassmodus/trunk/dassmodus/nosferatu/nosferatu/tools/generate_web2py_db_model.py
r990 r991 52 52 53 53 54 55 56 def item2field(item): 54 def item2field(confshort, item): 57 55 if item.name == 'where' : # where cannot be a column name in sqlite 58 56 item.name = 'where_' … … 62 60 if item.name.endswith('pool'): 63 61 refname = 'pool' 64 fieldtype = 'reference dird_conf__%s' % (refname) 62 print '### ' + refname 63 64 fieldtype = 'reference %s_conf__%s' % (confshort,refname) 65 65 defaultvalue = 0 66 66 return """ Field('%s','%s', default=%s), """ %(item.name, fieldtype , defaultvalue) … … 70 70 if item.type == "store_bool": 71 71 fieldtype = "boolean" 72 print "#####%s %s %s" % (item.name, item.defaultvalue, defaultvalue)72 #print "#####%s %s %s" % (item.name, item.defaultvalue, defaultvalue) 73 73 return """ Field('%s','%s', default=%s), """ %(item.name, fieldtype , defaultvalue) 74 74 return """ Field('%s','%s', default='%s'), """ %(item.name, fieldtype , defaultvalue) … … 81 81 dir_res_list = list() 82 82 83 confshort = 'dird' 83 84 for res in auto_configrules.dird_resources: 84 85 res_name = res[0] … … 88 89 print 89 90 #print res_name 90 print """db.define_table(' dird_conf__%s', """ % (res_name)91 for item in res_items: 92 item.required=False 93 item.printall=True 94 print item2field( item)95 print """ format='%(name)s')""" 96 97 98 91 print """db.define_table('%s_conf__%s', """ % (confshort,res_name) 92 for item in res_items: 93 item.required=False 94 item.printall=True 95 print item2field(confshort,item) 96 print """ format='%(name)s')""" 97 98 99 confshort = 'stored' 99 100 stor_res_list = list() 100 101 for res in auto_configrules.stored_resources: … … 105 106 print 106 107 #print res_name 107 print """db.define_table(' stored_conf__%s', """ % (res_name)108 for item in res_items: 109 item.required=False 110 item.printall=True 111 print item2field( item)112 print """ format='%(name)s')""" 113 114 115 108 print """db.define_table('%s_conf__%s', """ % (confshort,res_name) 109 for item in res_items: 110 item.required=False 111 item.printall=True 112 print item2field(confshort,item) 113 print """ format='%(name)s')""" 114 115 116 confshort = 'filed' 116 117 filed_res_list = list() 117 118 for res in auto_configrules.filed_resources: … … 122 123 print 123 124 #print res_name 124 print """db.define_table('filed_conf__%s', """ % (res_name) 125 for item in res_items: 126 item.required=False 127 item.printall=True 128 print item2field(item) 129 print """ format='%(name)s')""" 130 131 132 133 134 135 136 137 138 139 140 for res in dir_res_list: 141 # print """db.define_table('dird_conf__%s', 142 # Field('name','string'), 143 # format = '%%(name)s') 144 # """ % (res) 145 125 print """db.define_table('%s_conf__%s', """ % (confshort,res_name) 126 for item in res_items: 127 item.required=False 128 item.printall=True 129 print item2field(confshort,item) 130 print """ format='%(name)s')""" 131 132 confshort = 'cons' 133 cons_res_list = list() 134 for res in auto_configrules.console_resources: 135 res_name = res[0] 136 res_type = res[1] 137 res_items = res[2] 138 cons_res_list.append(res_name) 139 print 140 #print res_name 141 print """db.define_table('%s_conf__%s', """ % (confshort,res_name) 142 for item in res_items: 143 item.required=False 144 item.printall=True 145 print item2field(confshort,item) 146 print """ format='%(name)s')""" 147 148 149 150 151 152 for res in dir_res_list: 146 153 print """db.define_table('dird_conf__%s_link', 147 154 Field('%s','reference dird_conf__%s'), 148 155 format = '%%(id)s') 149 156 """ % (res,res,res) 150 151 152 153 157 print """db.define_table('dird_conf', 154 158 Field('name','string'),""" 159 155 160 for res in dir_res_list: 156 161 print " Field('dird_conf__%s', 'reference dird_conf__%s_link')," % (res,res ) … … 160 165 161 166 162 163 164 #for item in auto_configrules.dird_cat_items: 165 # item.required=False 166 # print """ 167 # Field('%s','reference dird_conf_catalog'), 168 # """ 167 for res in stor_res_list: 168 print """db.define_table('stord_conf__%s_link', 169 Field('%s','reference stord_conf__%s'), 170 format = '%%(id)s') 171 """ % (res,res,res) 172 print """db.define_table('stord_conf', 173 Field('name','string'),""" 174 175 for res in stor_res_list: 176 print " Field('stord_conf__%s', 'reference stord_conf__%s_link')," % (res,res ) 177 print """ format='%(name)s') 178 """ 179 180 181 182 for res in filed_res_list: 183 print """db.define_table('filed_conf__%s_link', 184 Field('%s','reference filed_conf__%s'), 185 format = '%%(id)s') 186 """ % (res,res,res) 187 print """db.define_table('filed_conf', 188 Field('name','string'),""" 189 190 for res in filed_res_list: 191 print " Field('filed_conf__%s', 'reference filed_conf__%s_link')," % (res,res ) 192 print """ format='%(name)s') 193 """ 194 195 196 197 198 for res in cons_res_list: 199 print """db.define_table('cons_conf__%s_link', 200 Field('%s','reference cons_conf__%s'), 201 format = '%%(id)s') 202 """ % (res,res,res) 203 print """db.define_table('cons_conf', 204 Field('name','string'),""" 205 206 for res in cons_res_list: 207 print " Field('cons_conf__%s', 'reference cons_conf__%s_link')," % (res,res ) 208 print """ format='%(name)s') 209 """ 210 211 212 #Abhängikeiten: 213 # dird 214 # job/jobdefs ->client 215 # -> pool 216 # -> fileset 217 # -> pool 218 # -> messages 219 # -> schedule 220 # -> storage 221 # -> jobdefs 222 # -> job 223 # messages -> catalog 224 # counter -> catalog 225 # storage -> device 226 # director -> messages 227 # client -> catalog 228 # pool -> catalog, storage 229 230 231 # Reihenfolge: 232 # storage->catalog->fileset->pool->jobdefs->client-> 233 # counter->messages->job->director 234 235 236 237 # stored: 238 # autochanger -> device 239 # storage -> messages 240 # messages -> catalog 241 242 # filed: 243 # messages -> catalog 244 # client/filedaemon -> messages 245 246 247 248 249
Note:
See TracChangeset
for help on using the changeset viewer.