Пример #1
0
 def parse_arguments(self):
     """
     Routine for parsing argument from user.
     """
     parser = argparse.ArgumentParser()
     parser.add_argument("-C", "--Component", type=str, \
                     help='Components to be tested')
     parser.add_argument("-L", "--Labconfig", type=str, \
                     help='Lab configs to be used by the suite')
     parser.add_argument("-l", "--logfile", type=str, \
                     help='log file name')
     parser.add_argument("-s", "--summarylog", type=str, \
                     help='summary log file name')
     args = parser.parse_args()
     if args.Labconfig:
         SCRIPTNAME = os.path.basename(__file__)
         CNFG = relative_config_file([SCRIPTNAME, args.Labconfig],
                                     SCRIPTNAME)
         self.cfg = CNFG
         if args.Labconfig.startswith(Register.cloud_environment_prefix):
             os.environ["isaws"] = "yes"
     if args.Component:
         self.printer("%s | Components that are going to be \
             tested are %s." % (datetime.datetime.now(), args.Component))
         global CONFIGURATION_TO_BE_TESTED
         CONFIGURATION_TO_BE_TESTED = (self._strip_arguments(
             args.Component)).split(",")
     else:
         CONFIGURATION_TO_BE_TESTED = self.cfg["feature"]["stand-alone"][
             "config-test"]["nodes"]
     if args.logfile:
         self.logging_pad = args.logfile
        print "\n# STEP6: Revert Back planner and SRT to its previous state #\n"
        for householdid in householdid_list:
            cleanup_household(cfg, pps_port, protocol, pps_host, householdid,
                              pps_headers, timeout)
        configureSRT_instance = ConfigureSRT()
        configureSRT_instance.modify_srt(
            cfg, [[reg_src, "*", reg_dest, res_copy_type]])
        print message
        return tims_dict


if __name__ == '__main__':
    script_name = os.path.basename(__file__)
    # read config file
    sa = sys.argv
    cfg = relative_config_file(sa, script_name)
    if cfg['feature']['print_cfg']:
        print "\nThe following configuration is being used:\n"
        pprint(cfg)
        print
    L = doit_wrapper(cfg, True)
    status_value = []
    for key, val in dict.items(L):
        status_value.append(val[2])
    if status_value:
        if (1 in status_value) or (3 in status_value):
            exit(1)
        else:
            exit(0)
    else:
        exit(1)