Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the configured tool_path when loading data managers #3989

Merged
merged 4 commits into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/galaxy/tools/data_manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__( self, app, xml_filename=None):
continue
self.load_from_xml( filename )
if self.app.config.shed_data_manager_config_file:
self.load_from_xml( self.app.config.shed_data_manager_config_file, store_tool_path=False, replace_existing=True )
self.load_from_xml( self.app.config.shed_data_manager_config_file, store_tool_path=True, replace_existing=True )

def load_from_xml( self, xml_filename, store_tool_path=True, replace_existing=False ):
try:
Expand All @@ -57,7 +57,7 @@ def load_from_xml( self, xml_filename, store_tool_path=True, replace_existing=Fa
tool_path = '.'
self.tool_path = tool_path
for data_manager_elem in root.findall( 'data_manager' ):
self.load_manager_from_elem( data_manager_elem, replace_existing=replace_existing )
self.load_manager_from_elem( data_manager_elem, tool_path=tool_path, replace_existing=replace_existing )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be tool_path=self.tool_path because tool_path is undefined if store_tool_path is False.


def load_manager_from_elem( self, data_manager_elem, tool_path=None, add_manager=True, replace_existing=False ):
try:
Expand Down
18 changes: 16 additions & 2 deletions lib/tool_shed/galaxy_install/tools/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@
from tool_shed.util import xml_util

log = logging.getLogger( __name__ )
# <data_managers tool_path="/var/galaxy/data_managers">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably a dev remnant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is exactly what it is. I even reminded myself to remove it before pushing.



class DataManagerHandler( object ):

def __init__( self, app ):
self.app = app

@property
def data_managers_path( self ):
tree, error_message = xml_util.parse_xml( self.app.config.shed_data_manager_config_file )
if tree:
root = tree.getroot()
data_managers_path = root.get( 'tool_path', None )
return data_managers_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data_managers_path is undefined if bool(tree) is False



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove one blank line to make flake8 happy?

def data_manager_config_elems_to_xml_file( self, config_elems, config_filename ):
"""
Persist the current in-memory list of config_elems to a file named by the value
of config_filename.
"""
data_managers_path = self.data_managers_path
lock = threading.Lock()
lock.acquire( True )
try:
fh = open( config_filename, 'wb' )
fh.write( '<?xml version="1.0"?>\n<data_managers>\n' )
if data_managers_path is not None:
fh.write( '<?xml version="1.0"?>\n<data_managers tool_path="%s">\n ' % data_managers_path )
else:
fh.write( '<?xml version="1.0"?>\n<data_managers>\n ' )
for elem in config_elems:
fh.write( xml_util.xml_to_string( elem ) )
fh.write( '</data_managers>\n' )
Expand Down Expand Up @@ -158,4 +172,4 @@ def remove_from_data_manager( self, repository ):
self.app.data_managers.load_manager_from_elem( elem )
# Persist the altered shed_data_manager_config file.
if data_manager_config_has_changes:
self.data_manager_config_elems_to_xml_file( config_elems, shed_data_manager_conf_filename )
self.data_manager_config_elems_to_xml_file( config_elems, shed_data_manager_conf_filename )