#!/usr/bin/python # tool for running ROCKS builds # partly based on examples in: # http://www.ibm.com/developerworks/aix/library/au-pythocli/ import optparse def main(): """Runs program and handles command line options""" p = optparse.OptionParser(description='Tool for running ROCKS node builds. This development version does not have all needed features (related to node safety). Use with care.', prog='build-ctrl.py', version='build-ctrl.py 0.01', usage='%prog [host]') p.add_option('-t', '--test', action='store_true', help='hardware test mode builds') p.add_option('-p', '--prod', action='store_true', help='production mode builds') p.add_option('--show-pxeconfig', action='store_true', help='list pxe config file for node') p.add_option('--show-rocks', action='store_true', help='"rocks list host" for node') p.add_option('-s', '--shoot-node', action='store_true', help='"shoot-node", preps for rebuild and tries to initiate rebuild if node if up') options, arguments = p.parse_args() if len(arguments) == 1: print arguments else: p.print_help() if __name__ == '__main__': main()