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

Typo in --shed_target fails with cryptic connection aborted gaierror #217

Closed
peterjc opened this Issue May 21, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@peterjc
Copy link
Contributor

peterjc commented May 21, 2015

e.g.

$ planemo shed_create --shed_target insert_typo_here ~/repositories/pico_galaxy/packages/package_mira_4_0_2/ ; echo "$? returned"
Could not update package_mira_4_0_2
('Connection aborted.', gaierror(-2, 'Name or service not known')), 0 attempts left: None
('Connection aborted.', gaierror(-2, 'Name or service not known')), 0 attempts left: None
255 returned

It took me a long to to realise the problem here was a typo in the Tool Shed alias (I'd originally typed testoolshed instead of testtoolshed).

As an aside, the message "Could not update ..." appears to be from checking if the repository already exists (at the time or writing, it does not). This might be clearer depending where else the message appears:

$ git diff planemo/shed/__init__.py
diff --git a/planemo/shed/__init__.py b/planemo/shed/__init__.py
index 8cf62d2..b3acdd5 100644
--- a/planemo/shed/__init__.py
+++ b/planemo/shed/__init__.py
@@ -1047,7 +1047,7 @@ class RealizedRepositry(object):
             return repo_id
         except Exception as e:
             message = api_exception_to_message(e)
-            error("Could not update %s" % self.name)
+            error("Could not find %s" % self.name)
             error(message)
         return None

This same usability issue affects other commands too, e.g.

$ planemo shed_upload --shed_target insert_typo_here ~/repositories/pico_galaxy/packages/package_mira_4_0_2/ ; echo "$? returned"
cd '/mnt/galaxy/repositories/pico_galaxy/packages/package_mira_4_0_2' && git rev-parse HEAD
cd '/mnt/galaxy/repositories/pico_galaxy/packages/package_mira_4_0_2' && git diff --quiet
Could not find package_mira_4_0_2
('Connection aborted.', gaierror(-2, 'Name or service not known')), 0 attempts left: None
Repository [package_mira_4_0_2] does not exist in the targeted Tool Shed.
255 returned

I suggest planemo should catch this error and turn it into a more user-friendly error message, and/or do some pre-validation of the --shed_target argument?

@peterjc peterjc added the enhancement label May 21, 2015

@erasche

This comment has been minimized.

Copy link
Member

erasche commented May 21, 2015

+1 for prevalidation of shed target

@jmchilton jmchilton closed this in 12c7bdf May 21, 2015

@jmchilton

This comment has been minimized.

Copy link
Member

jmchilton commented May 21, 2015

Thanks for the bug report @peterjc - I think it should be fixed with 12c7bdf. It will still dump a big stack trace but it the error message is very informative at least.

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented May 21, 2015

Yep, that's ugly but nevertheless, far more helpful. Thanks!

$ planemo shed_create --shed_target insert_typo_here ~/repositories/pico_galaxy/packages/package_mira_4_0_2/ ; echo "$? returned"
Traceback (most recent call last):
  File "/mnt/galaxy/repositories/planemo/.venv/bin/planemo", line 9, in <module>
    load_entry_point('planemo==0.12.0.dev0', 'console_scripts', 'planemo')()
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/click-4.0-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/planemo-0.12.0.dev0-py2.6.egg/planemo/commands/cmd_shed_create.py", line 21, in cli
    tsi = shed.tool_shed_client(ctx, **kwds)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/planemo-0.12.0.dev0-py2.6.egg/planemo/shed/__init__.py", line 325, in tool_shed_client
    url = _tool_shed_url(kwds)
  File "/mnt/galaxy/repositories/planemo/.venv/lib/python2.6/site-packages/planemo-0.12.0.dev0-py2.6.egg/planemo/shed/__init__.py", line 622, in _tool_shed_url
    raise ValueError(message)
ValueError: Invalid shed url specified [insert_typo_here]. Please specify a valid HTTP address or one of ['toolshed', 'testtoolshed', 'local']
1 returned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment