Esempio n. 1
0
def find_entries_with_different_content(config_xml, skip_disabled):
    """
    Find entries where their content doesn't match what is published in the information system. 
    """
    try:
        # Find all enabled config entries with ref ids
        config_dom = minidom.parse(config_xml)
        config_entries = infosys_lib.parse_entries(config_dom,
                                                   skip_missing_ref_id=True,
                                                   skip_disabled=skip_disabled)

        # Create an info systems list from factory config
        infosystems = infosys_lib.parse_info_systems(config_dom)

        has_ress = False
        for infosys in infosystems:
            if infosystems[infosys].lower() == 'ress':
                has_ress = True
                break
        if has_ress:
            # Update path with condor
            condor_path = infosys_lib.parse_condor_path(config_dom)
            os.environ["CONDOR_CONFIG"] = condor_path + "/etc/condor_config"
            condorExe.set_path(condor_path + "/bin", condor_path + "/sbin")
    except:
        print("Error parsing the the config file '%s', exiting the tool." %
              config_xml)
        sys.exit(2)

    # Retrieve info systems entries
    bdii_entries = {}
    ress_entries = {}
    tg_entries = {}
    for infosys, type in infosystems.iteritems():
        if type.lower() == 'bdii':
            bdii_entries.update(infosys_lib.query_bdii(infosys))

        elif type.lower() == 'ress':
            ress_entries.update(infosys_lib.query_ress(infosys))

        elif type.lower() == 'tg':
            tg_entries.update(infosys_lib.query_teragrid())

    id_match_bdii_entries = find_entries_id_match(bdii_entries, config_entries,
                                                  'bdii')
    id_match_ress_entries = find_entries_id_match(ress_entries, config_entries,
                                                  'ress')
    id_match_tg_entries = find_entries_id_match(tg_entries, config_entries,
                                                'tg')

    return id_match_bdii_entries, id_match_ress_entries, id_match_tg_entries
def find_entries_with_ids_not_published(config_xml, skip_disabled):
    """
    Find config entries not published in the information systems.
    """
    try:
        # Find all enabled config entries with ref ids
        config_dom = minidom.parse(config_xml)
        config_entries = infosys_lib.parse_entries(config_dom, skip_missing_ref_id=True, skip_disabled=skip_disabled)
                    
        # Create an info systems list from factory config
        infosystems = infosys_lib.parse_info_systems(config_dom)
        
        has_ress = False
        for infosys in infosystems:
            if infosystems[infosys].lower() == 'ress':
                has_ress = True
                break
        if has_ress:  
            # Update path with condor 
            condor_path = infosys_lib.parse_condor_path(config_dom)
            os.environ["CONDOR_CONFIG"] = condor_path + "/etc/condor_config"
            condorExe.set_path(condor_path + "/bin", condor_path + "/sbin")
    except: 
        print "Error parsing the the config file '%s', exiting the tool." % config_xml
        sys.exit(2) 

    # Retrieve info systems entries 
    bdii_entries = {}
    ress_entries = {}
    tg_entries = {}
    for infosys, type in infosystems.iteritems():
        if type.lower() == 'bdii':
            bdii_entries.update(infosys_lib.query_bdii(infosys))
                
        elif type.lower() == 'ress':
            ress_entries.update(infosys_lib.query_ress(infosys))
                
        elif type.lower() == 'tg':
            tg_entries.update(infosys_lib.query_teragrid())
            

    id_not_found_bdii_entries = find_entries_id_not_found(bdii_entries, config_entries, 'bdii')
    id_not_found_ress_entries = find_entries_id_not_found(ress_entries, config_entries, 'ress')
    id_not_found_tg_entries = find_entries_id_not_found(tg_entries, config_entries, 'tg')

    return id_not_found_bdii_entries, id_not_found_ress_entries, id_not_found_tg_entries
Esempio n. 3
0
    def test_query_teragrid(self):
        """
        Test querying TeraGrid information systems
        """

        # Test that information is retrieved and populated (most values are defaults since TG does not publish the info)
        # There is no input to the function since it is specific to the url requested
        infosys_entries = query_teragrid()
        self.assertNotEqual(infosys_entries, {})
        keys = infosys_entries.keys()
        entry = infosys_entries[keys[0]]
        self.assertTrue(entry['site_name'] != '')
        self.assertEqual(entry['gridtype'], 'gt5')
        self.assertTrue(entry['gatekeeper'] != '')
        self.assertTrue(entry['wall_clocktime'] != 0)
        self.assertTrue(entry['ref_id'] != '')
        self.assertEqual(entry['ce_status'], 'production')
        self.assertEqual(entry['glexec_bin'], 'NONE')
        self.assertEqual(entry['work_dir'], 'auto')
        self.assertEqual(entry['source'], 'info.teragrid.org')
        self.assertEqual(entry['source_type'], 'TGIS')
        self.assertEqual(entry['GlueCEUniqueID'], 'N/A')
Esempio n. 4
0
 def test_query_teragrid(self):
     """
     Test querying TeraGrid information systems
     """
     
     # Test that information is retrieved and populated (most values are defaults since TG does not publish the info)
     # There is no input to the function since it is specific to the url requested
     infosys_entries = query_teragrid()
     self.assertNotEqual(infosys_entries, {})
     keys = infosys_entries.keys()
     entry = infosys_entries[keys[0]]
     self.assertTrue(entry['site_name'] != '')
     self.assertEqual(entry['gridtype'], 'gt5')
     self.assertTrue(entry['gatekeeper'] != '')
     self.assertTrue(entry['wall_clocktime'] != 0)
     self.assertTrue(entry['ref_id'] != '')
     self.assertEqual(entry['ce_status'], 'production')
     self.assertEqual(entry['glexec_bin'], 'NONE')
     self.assertEqual(entry['work_dir'], 'auto')
     self.assertEqual(entry['source'], 'info.teragrid.org')
     self.assertEqual(entry['source_type'], 'TGIS') 
     self.assertEqual(entry['GlueCEUniqueID'], 'N/A')