def get_resources(tmpDirOption = ''): logging.debug('get_resources: entered...') try: resources = su.parseKeyValueFile(os.path.join(RepositoryRoot, 'Resources.txt')) robotJobsDir = resources['robotsjobdir'] if tmpDirOption: tmpOutDir = tmpDirOption else: tmpOutDir = resources['tmpout'] ryw.give_news2('<BR>outgoing data placed in: ' + tmpOutDir, logging.info) searchFile = resources['searchfile'] viewRoot = resources['viewroot'] objectstoreroots = resources['objectstore'].split(';') firstRoot = objectstoreroots[0] robotPresent = ryw.has_robot(resources) except: ryw.give_bad_news('get_resources failed.', logging.critical) return (False, None, None, None, None, None, None, None) logging.debug('get_resources succeeded.') logging.debug('get_resources: robotJobsDir, tmpOutDir, searchFile, viewRoot' + robotJobsDir + tmpOutDir + searchFile + viewRoot + firstRoot) return (True, resources, robotJobsDir, tmpOutDir, searchFile, viewRoot, firstRoot, robotPresent)
def generate_table(resources,dirlist): robotPresent = ryw.has_robot(resources) if robotPresent: print_burn_all_buttons() print_del_all_button() print javascriptString print '<TABLE class="search">' tmpout = resources['tmpout'] for i in dirlist: print make_row(tmpout,i, resources) print "</TABLE>"
def make_row(tmpdir,imgdir, resources): import time try: d = {"imageName":imgdir} dir = os.path.join(tmpdir,imgdir) d['file_url'] = "file:///" + os.path.abspath(dir) + \ "/repository/html/index.html" d['recipient'] = open( \ os.path.join(dir, "repository", "usercredentials")).readline().strip() d['date'] = time.ctime(os.stat(dir).st_ctime) if ryw.has_robot(resources): d['robot_string'] = rowStringRobot % d return rowString % d else: d['robot_string'] = '' return rowString % d except: logging.info('make_row: unknown directory: ' + tmpdir + ', ' + imgdir) return ''
def burnRequested(form): image = form.getfirst("Img","") if not image: print "No Image specified to burn" sys.exit(1) withRobot = form.getfirst('withRobot', '') success, resources = get_resources() if not success: ryw.give_bad_news("Error parsing resource file",logging.error) sys.exit(1) tmpout = resources['tmpout'] image = os.path.join(tmpout,image) if not os.path.exists(image): ryw.give_bad_news("specified image doesnt exist",logging.info) sys.exit(1) robotPresent = ryw.has_robot(resources) if robotPresent and withRobot: submitRobotRequest(image,resources['robotsjobdir']) sys.stdout.write("True") else: burnWithCopyToDVD(image,resources['robotsjobdir'])
def burnAll(): print '<TITLE>Burning All Outing Disc Images</TITLE>' ryw_view.print_logo() success,resources = get_resources() if not success: ryw.give_bad_news("main: error parsing resource file",logging.error) sys.exit(1) robotPresent = ryw.has_robot(resources) if not robotPresent: ryw.give_bad_news("burning all in one go only works with robot. Resource file indicates robot is not present",logging.info) sys.exit(1) outdir = resources['tmpout'] robotsjobdir = resources['robotsjobdir'] for i in [os.path.join(outdir,k) for k in os.listdir(outdir)]: submitRobotRequest(i,robotsjobdir) ryw.give_good_news("Successfully submitted write request to robot for all outgoing images",logging.debug) ryw_view.print_footer()