def __validate_tarball__(self, tarball): """ Attempts to verify that this is a valid Condor tarball. - the first level of the directory structure is the Condor release with a format 'condor-*'. - the tarball contains the condor-*/configure_condor script. """ if self.install_type() == "rpm": self.__check_condor_version__() return common.logit("... validating condor tarball: %s" % tarball) if not os.path.isfile(tarball): common.logerr("File (%s) not found" % (tarball)) try: fd = tarfile.open(tarball, "r:gz") except: common.logerr("File (%s) not a valid tar.gz file" % (tarball)) try: try: first_entry = fd.next().name first_el = fd.getmember(first_entry) if not first_el.isdir(): common.logwarn( "File (%s) may not be a condor tarball! (found (%s), expected a subdirectory" % (tarball, first_entry) ) self.condor_first_dir = first_entry + "/" else: self.condor_first_dir = first_entry.split("/")[0] + "/" if self.condor_first_dir[:7] != "condor-": common.logerr( "File '%s' is not a condor tarball! (found '%s', expected 'condor-*/'" % (tarball, self.condor_first_dir) ) self.condor_version = re.sub("/", "", first_entry.split("-")[1]) common.logit("... condor version: %s" % (self.condor_version)) try: fd.getmember(self.condor_first_dir + "condor_configure") except: common.logerr( "Condor tarball (%s) missing %s" % (tarball, self.condor_first_dir + "condor_configure") ) except Exception, e: common.logerr("Condor tarball file is corrupted: %s" % (tarball)) finally: fd.close()
def apply_filters_to_bdii(self,bdii_data): #-- set up the python filter --- common.logit("Filters: %s" % self.glidein.entry_filters()) #-- using glexec? --- if self.glidein.use_glexec() == "y": def_glexec_bin='/opt/glite/sbin/glexec' else: def_glexec_bin='NONE' cluster_count={} bdii_entries={} python_filter_obj = self.get_python_filter(self.glidein.entry_filters()) for ldap_id in bdii_data.keys(): el2=bdii_data[ldap_id] # LDAP returns everything in lists... convert to values (i.e. get first element from list) scalar_el={} for k in el2.keys(): scalar_el[k]=el2[k][0] if not self.passed_python_filter(python_filter_obj,scalar_el): continue # has not passed the filter work_dir="." #-- some entries do not have all the attributes -- try: gatekeeper="%s:%s/jobmanager-%s" %\ (el2['GlueCEHostingCluster'][0], el2['GlueCEInfoGatekeeperPort'][0], el2['GlueCEInfoJobManager'][0]) rsl="(queue=%s)(jobtype=single)" % el2['GlueCEName'][0] except Exception, e: common.logwarn("This entry point (%s/%s) is being skipped. A required schema attribute missing: %s" % (el2['GlueCEName'][0],el2['GlueCEHostingCluster'][0],e)) site_name = el2['Mds-Vo-name'][0] cluster_id ="bdii_%s" % site_name bdii_id={'type':'BDII','server':self.glidein.bdii_host(),'name':ldap_id} count=1 if cluster_count.has_key(cluster_id): count = cluster_count[cluster_id] + 1 cluster_count[cluster_id] = count if count == 1: key_name = cluster_id else: key_name = "%s_%i" % (cluster_id,count) if count == 2: # rename id -> id_1 key_name_tmp = "%s_1"%cluster_id bdii_entries[key_name_tmp] = bdii_entries[cluster_id] del bdii_entries[cluster_id] guess_glexec_bin = def_glexec_bin if guess_glexec_bin != 'NONE': if el2['GlueCEHostingCluster'][0][-3:] in ('gov','edu'): # these should be OSG guess_glexec_bin = 'OSG' else: # I assume everybody else uses glite software guess_glexec_bin = '/opt/glite/sbin/glexec' bdii_entries[key_name] = {'gatekeeper':gatekeeper, 'rsl':rsl,'gridtype':'gt2', 'work_dir':work_dir, 'site_name':site_name, 'glexec_path':guess_glexec_bin, 'is_ids':[bdii_id]}