Example #1
0
 def get_config_entries_data(self):
   common.logit("\nCollecting  configuration file data. It will be question/answer time.")
   os.environ["PATH"] = "%s/bin:%s" %(self.wms.condor_location(),os.environ["PATH"])
   os.environ["CONDOR_CONFIG"] = self.wms.condor_config()
   common.logit("Using %s" % (os.environ["CONDOR_CONFIG"])) 
   self.config_entries_list = {}  # config files entries elements
   while 1:
     yn = common.ask_yn("Do you want to fetch entries from RESS")
     if yn == 'y':
       ress_data     = self.get_ress_data()
       filtered_data = self.apply_filters_to_ress(ress_data)
       self.ask_user(filtered_data)
     ## - tmp/permanent removal of BDII query as too may results occur 12/14/10 -
     ## yn = common.ask_yn("Do you want to fetch entries from BDII")
     ## if yn == 'y':
     ##   bdii_data     = self.get_bdii_data()
     ##   filtered_data = self.apply_filters_to_bdii(bdii_data)
     ##   self.ask_user(filtered_data)
     yn = common.ask_yn("Do you want to add manual entries")
     if yn == 'y':
       self.additional_entry_points()
     if len(self.config_entries_list) > 0:
       break
     common.logerr("You have no entry points. You need at least 1. Check your ini file's entry_vos and entry_filters attributes..")
   common.logit("Configuration file questioning complete.\n")
Example #2
0
  def ask_user(self,ress_entries):
    ress_keys=ress_entries.keys()
    ress_keys.sort()

    print "Found %i additional entries" % len(ress_keys)
    if len(ress_keys) == 0:
      return
    yn = common.ask_yn("Do you want to use them all")
    if yn == "y":
        # simply copy all of them
        for key in ress_keys:
            self.config_entries_list[key] = ress_entries[key]
        return

    print "This is the list of entries found in RESS:"
    for key in ress_keys:
        print "[%s] %s(%s)"%(string.ljust(key,20),ress_entries[key]['gatekeeper'],ress_entries[key]['rsl'])

    print "Select the indexes you want to include"
    print "Use a , separated list to include more than one"
    while 1:
      idxes = raw_input("Please select: ")
      idx_arr = idxes.split(',')
      problems = 0
      for idx in idx_arr:
        if not (idx in ress_keys):
          print "'%s' is not a valid index!" % idx
          problems=1
          break
      if problems:
        continue

      # got them
      break

    yn = common.ask_yn("Do you want to customize them")
    if yn == "y":
      # customize them
      for idx in idx_arr:
        work_dir = raw_input("Work dir for '%s': [%s] " % (idx,ress_entries[idx]['work_dir']))
        if work_dir != "":
          ress_entries[idx]['work_dir'] = work_dir
        site_name=raw_input("Site name for '%s': [%s] " % (idx,ress_entries[idx]['site_name']))
        if site_name != "":
          ress_entries[idx]['site_name'] = site_name

      if self.glidein.use_glexec() == "y":
        glexec_path = raw_input("gLExec path for '%s': [%s] "%(idx,ress_entries[idx]['glexec_path']))
        if glexec_path != "":
          ress_entries[idx]['glexec_path'] = glexec_path

    for idx in idx_arr:
      self.config_entries_list[idx] = ress_entries[idx]

    return
 def remove(self):
   if not os.path.isfile(self.config_file()):
     return 
   if os.getuid() != 0:
     common.logit("\nA privilege separation config file exists but you are not root user\n so we cannot remove it at this time.")
     yn = common.ask_yn("Do you want to proceed")
     if yn == "n":
       common.logerr("Terminating at your request")
Example #4
0
  def select_schedds_to_monitor(self,default_schedds):
    while 1:
      common.logit("\nThe following schedds have been found:")
      for i in range(len(default_schedds)):
        common.logit(" [%i] %s"%(i+1,default_schedds[i]))
      yn = common.ask_yn("Do you want to monitor all of them")
      if yn == "y":
        schedds = default_schedds
        break
      print "Select the schedd indexes you want to monitor"
      print "Use a , separated list to monitor more than one"

      while 1:
        problem = False
        schedds=[]
        idxes = raw_input("Please select: ")
        idx_arr = idxes.split(',')
        for i in range(len(idx_arr)):
          try:
            nr = int(idx_arr[i])
            if (nr < 1) or (nr > len(default_schedds)):
              common.logit("Index %i out of range" % nr)
              problem = True
              break
            schedds.append(default_schedds[nr-1])
          except:
            common.logit("'%s' is not a valid index!" % idx_arr[i])
            problem = True
            break
        if problem:
          os.system("sleep 1")
          continue
        # got them
        for i in range(len(schedds)):
         common.logit(" [%i] %s"%(i+1,schedds[i]))
        break
      yn = raw_input("Do you want to use these or try again?: (y/n) ")
      if yn == "y":
        break 
    return schedds