commit/galaxy-central: dan: Handle uninstalling Data Manager from Tool Shed corner case, where two different instantiations of a Data Manager have been installed, e.g. due to a new installable changeset revision.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/8a3d271d79bb/ changeset: 8a3d271d79bb user: dan date: 2013-03-13 18:26:31 summary: Handle uninstalling Data Manager from Tool Shed corner case, where two different instantiations of a Data Manager have been installed, e.g. due to a new installable changeset revision. affected #: 1 file diff -r 9159442d180f9f7baf282b93ad70ce6ddbecec32 -r 8a3d271d79bb6736b88b76918e4820d771c12250 lib/tool_shed/util/shed_util.py --- a/lib/tool_shed/util/shed_util.py +++ b/lib/tool_shed/util/shed_util.py @@ -1574,15 +1574,33 @@ root = tree.getroot() assert root.tag == 'data_managers', 'The file provided (%s) for removing data managers from is not a valid data manager xml file.' % ( shed_data_manager_conf_filename ) guids = [ data_manager_dict.get( 'guid' ) for data_manager_dict in metadata_dict.get( 'data_manager', {} ).get( 'data_managers', {} ).itervalues() if 'guid' in data_manager_dict ] + load_old_data_managers_by_guid = {} data_manager_config_has_changes = False config_elems = [] for elem in root: - if elem.tag != 'data_manager' or elem.get( 'guid', None ) not in guids: + # Match Data Manager elements by guid and installed_changeset_revision + elem_matches_removed_data_manager = False + if elem.tag == 'data_manager': + guid = elem.get( 'guid', None ) + if guid in guids: + tool_elem = elem.find( 'tool' ) + if tool_elem is not None: + installed_changeset_revision_elem = tool_elem.find( 'installed_changeset_revision' ) + if installed_changeset_revision_elem is not None: + if installed_changeset_revision_elem.text == repository.installed_changeset_revision: + elem_matches_removed_data_manager = True + else: + # This is a different version, which had been previously overridden + load_old_data_managers_by_guid[ guid ] = elem + if elem_matches_removed_data_manager: + data_manager_config_has_changes = True + else: config_elems.append( elem ) - else: - data_manager_config_has_changes = True - #remove data managers from in memory + # Remove data managers from in memory app.data_managers.remove_manager( guids ) + # Load other versions of any now uninstalled data managers, if any + for elem in load_old_data_managers_by_guid.itervalues(): + app.data_managers.load_manager_from_elem( elem ) # Persist the altered shed_data_manager_config file. if data_manager_config_has_changes: suc.data_manager_config_elems_to_xml_file( app, config_elems, shed_data_manager_conf_filename ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org