def parseargs(self): parser = OptParser(option_class=OptChecker, description=' '.join(self.description.split()), version='%prog version $Revision: $') parser.set_usage( '%prog is a utility script used by gprecoverseg, and gpaddmirrors and is not intended to be run separately.' ) parser.remove_option('-h') parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-c', '--confinfo', type='string') parser.add_option('-b', '--batch-size', type='int', default=DEFAULT_SEGHOST_NUM_WORKERS, metavar='<batch_size>') parser.add_option('-f', '--force-overwrite', dest='forceoverwrite', action='store_true', default=False) parser.add_option('-l', '--log-dir', dest="logfileDirectory", type="string") # Parse the command line arguments options, _ = parser.parse_args() return options
def parseargs(): parser = OptParser(option_class=OptChecker , description=' '.join(DESCRIPTION.split()) , version='%prog version $Revision: #12 $' ) parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option('-f', '--file', default='', help='the name of a file containing the re-sync file list.') parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-h', '-?', '--help', action='help', help='show this help message and exit.', default=False) parser.add_option('--usage', action="briefhelp") parser.add_option('-d', '--master_data_directory', type='string', dest="masterDataDirectory", metavar="<master data directory>", help="Optional. The master host data directory. If not specified, the value set for $MASTER_DATA_DIRECTORY will be used.", default=get_masterdatadir() ) parser.add_option('-a', help='don\'t ask to confirm repairs', dest='confirm', default=True, action='store_false') """ Parse the command line arguments """ (options, args) = parser.parse_args() if len(args) > 0: logger.error('Unknown argument %s' % args[0]) parser.exit() return options, args
def parseargs(): parser = OptParser(option_class=OptChecker, description=' '.join(DESCRIPTION.split()), version='%prog version $Revision: #12 $') parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option( '-f', '--file', default='', help='the name of a file containing the re-sync file list.') parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-h', '-?', '--help', action='help', help='show this help message and exit.', default=False) parser.add_option('--usage', action="briefhelp") parser.add_option( '-d', '--master_data_directory', type='string', dest="masterDataDirectory", metavar="<master data directory>", help= "Optional. The master host data directory. If not specified, the value set for $MASTER_DATA_DIRECTORY will be used.", default=get_masterdatadir()) parser.add_option('-a', help='don\'t ask to confirm repairs', dest='confirm', default=True, action='store_false') """ Parse the command line arguments """ (options, args) = parser.parse_args() if len(args) > 0: logger.error('Unknown argument %s' % args[0]) parser.exit() return options, args
def parse_command_line(): parser = OptParser(option_class=OptChecker, description=' '.join(_description.split())) parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option('--start', action='store_true', help='Start the Greenplum Performance Monitor web server.') parser.add_option('--stop', action='store_true', help='Stop the Greenplum Performance Monitor web server.') parser.add_option('--restart', action='store_true', help='Restart the Greenplum Performance Monitor web server.') parser.add_option('--status', action='store_true', help='Display the status of the Gerrnplum Performance Monitor web server.') parser.add_option('--setup', action='store_true', help='Setup the Greenplum Performance Monitor web server.') parser.add_option('--version', action='store_true', help='Display version information') parser.add_option('--upgrade', action='store_true', help='Upgrade a previous installation of the Greenplum Performance Monitors web UI') parser.set_defaults(verbose=False,filters=[], slice=(None, None)) # Parse the command line arguments (options, args) = parser.parse_args() if options.version: version() sys.exit(0) # check for too many options opt_count = 0 if options.start: opt_count+=1 if options.stop: opt_count+=1 if options.setup: opt_count+=1 if options.upgrade: opt_count+=1 if options.status: opt_count+=1 if opt_count > 1: parser.print_help() parser.exit() return options, args
def parseargs(self): parser = OptParser(option_class=OptChecker, description=' '.join(self.description.split()), version='%prog version $Revision: $') parser.set_usage( '%prog is a utility script used by gprecoverseg, and gpaddmirrors and is not intended to be run separately.' ) parser.remove_option('-h') #TODO we may not need the verbose flag parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-c', '--confinfo', type='string') parser.add_option('-b', '--batch-size', type='int', default=DEFAULT_SEGHOST_NUM_WORKERS, metavar='<batch_size>') parser.add_option('-f', '--force-overwrite', dest='forceoverwrite', action='store_true', default=False) parser.add_option('-l', '--log-dir', dest="logfileDirectory", type="string") parser.add_option( '', '--era', dest="era", help="coordinator era", ) # Parse the command line arguments self.options, _ = parser.parse_args() if not self.options.confinfo: raise Exception('Missing --confinfo argument.') if not self.options.logfileDirectory: raise Exception('Missing --log-dir argument.') self.logger = gplog.setup_tool_logging( os.path.split(self.file_name)[-1], unix.getLocalHostname(), unix.getUserName(), logdir=self.options.logfileDirectory) if self.options.batch_size <= 0: self.logger.warn('batch_size was less than zero. Setting to 1.') self.options.batch_size = 1 if self.options.verbose: gplog.enable_verbose_logging() self.seg_recovery_info_list = recoveryinfo.deserialize_list( self.options.confinfo) if len(self.seg_recovery_info_list) == 0: raise Exception( 'No segment configuration values found in --confinfo argument')