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

shed_create did not use owner in .shed.yml and gave error message #246

Closed
peterjc opened this Issue Jul 4, 2015 · 6 comments

Comments

Projects
None yet
1 participant
@peterjc
Copy link
Contributor

peterjc commented Jul 4, 2015

$ cat package_blast_plus_2_2_31/.shed.yml
name: package_blast_plus_2_2_31
owner: iuc
homepage_url: https://github.com/peterjc/galaxy_blast/packages/package_blast_plus_2_2_31
remote_repository_url: https://github.com/peterjc/galaxy_blast/packages/package_blast_plus_2_2_31
description: NCBI BLAST+ 2.2.31 (binaries only) 
long_description: |
  This Tool Shed package is intended to be used as a dependency of the Galaxy wrappers
  for NCBI BLAST+ and any other tools which call the BLAST+ binaries internally.

  Development is hosted on GitHub https://github.com/peterjc/galaxy_blast/ which can
  be used for reporting any issues.
categories:
- Tool Dependency Packages
type: tool_dependency_definition

Notice that this said the owner should be iuc

$ planemo shed_create --shed_target testtoolshed package_blast_plus_2_2_31
Repository created
cd '/Users/peterjc/repositories/galaxy_blast/packages/package_blast_plus_2_2_31' && git rev-parse HEAD
cd '/Users/peterjc/repositories/galaxy_blast/packages/package_blast_plus_2_2_31' && git diff --quiet
Traceback (most recent call last):
  File "/usr/local/bin/planemo", line 9, in <module>
    load_entry_point('planemo==0.13.1', 'console_scripts', 'planemo')()
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Library/Python/2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/planemo-0.13.1-py2.7.egg/planemo/commands/cmd_shed_create.py", line 39, in cli
    exit_code = shed.for_each_repository(ctx, create, paths, **kwds)
  File "/Library/Python/2.7/site-packages/planemo-0.13.1-py2.7.egg/planemo/shed/__init__.py", line 594, in for_each_repository
    function(realized_repository)
  File "/Library/Python/2.7/site-packages/planemo-0.13.1-py2.7.egg/planemo/commands/cmd_shed_create.py", line 30, in create
    ctx, realized_repository, **kwds
  File "/Library/Python/2.7/site-packages/planemo-0.13.1-py2.7.egg/planemo/shed/__init__.py", line 198, in upload_repository
    if repo_id is None and kwds["force_repository_creation"]:
KeyError: 'force_repository_creation'

This actually created a repository with peterjc as the owner: https://testtoolshed.g2.bx.psu.edu/view/peterjc/package_blast_plus_2_2_31

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Jul 4, 2015

I then tried setting the owner via the command line,

$ planemo shed_create --shed_target testtoolshed package_blast_plus_2_2_31 --owner iuc
Unexpected response from galaxy: 400: {"err_msg": "You already own a repository named <b>package_blast_plus_2_2_31<\/b>, please choose a different name.", "err_code": 400008}

It seems stuck on using peterjc as the owner, not iuc :(

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Jul 4, 2015

I have just created https://testtoolshed.g2.bx.psu.edu/view/iuc/package_blast_plus_2_2_31 manually by logging into the website as the IUC account.

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Jul 4, 2015

According to @jmchilton this is probably because my ~/.planemo.yml has a key, and therefore does not bother to look at the specified owner/user.

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Oct 22, 2015

Just hit this again trying to create a repository owned by biopython (as per the .shed.yml file) but planemo created it owned by me.

$ planemo --version
planemo, version 0.14.1.dev0
$ more package_biopython_1_66/.shed.yml
name: package_biopython_1_66
owner: biopython
homepage_url: http://biopython.org
remote_repository_url: https://github.com/biopython/galaxy_packages/tree/master/package_biopython_1_66
description: Downloads and compiles version 1.66 of the Biopython package. 
long_description: |
  The Biopython Project is an international association of developers of freely available
  Python tools for computational molecular biology.
categories:
- Tool Dependency Packages
type: tool_dependency_definition
$ planemo shed_create -t testtoolshed -r package_biopython_1_66
Repository created
cd '/mnt/shared/users/pc40583/repositories/galaxy_packages/package_biopython_1_66' && git rev-parse HEAD
cd '/mnt/shared/users/pc40583/repositories/galaxy_packages/package_biopython_1_66' && git diff --quiet
Traceback (most recent call last):
  File "/home/pc40583/bin/planemo", line 8, in <module>
    load_entry_point('planemo==0.14.1.dev0', 'console_scripts', 'planemo')()
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/pc40583/lib/python2.7/site-packages/click-4.0-py2.7.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/pc40583/lib/python2.7/site-packages/planemo-0.14.1.dev0-py2.7.egg/planemo/commands/cmd_shed_create.py", line 39, in cli
    exit_code = shed.for_each_repository(ctx, create, paths, **kwds)
  File "/home/pc40583/lib/python2.7/site-packages/planemo-0.14.1.dev0-py2.7.egg/planemo/shed/__init__.py", line 597, in for_each_repository
    function(realized_repository)
  File "/home/pc40583/lib/python2.7/site-packages/planemo-0.14.1.dev0-py2.7.egg/planemo/commands/cmd_shed_create.py", line 30, in create
    ctx, realized_repository, **kwds
  File "/home/pc40583/lib/python2.7/site-packages/planemo-0.14.1.dev0-py2.7.egg/planemo/shed/__init__.py", line 199, in upload_repository
    if repo_id is None and kwds["force_repository_creation"]:
KeyError: 'force_repository_creation'

Thinking about this, keys are tied to user accounts. Once you have a repository on the Tool Shed, the owner can grant admin rights to other users.

Therefore given only the key for peterjc the expected result here should be a failure to create biopython/package_biopython_1_66 (not creating peterjc/package_biopython_1_66 and an error message).

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Mar 8, 2016

Just hit this bug again creating https://testtoolshed.g2.bx.psu.edu//peterjc/package_blast_plus_2_3_0 rather than under the IUC ownership:

[galaxy@ppserver galaxy_blast]$ planemo --version
planemo, version 0.24.0.dev0
[galaxy@ppserver galaxy_blast]$ planemo shed_create -t testtoolshed --owner iuc packages/package_blast_plus_2_3_0/
Repository created
cd '/mnt/galaxy/repositories/galaxy_blast/packages/package_blast_plus_2_3_0' && git rev-parse HEAD
cd '/mnt/galaxy/repositories/galaxy_blast/packages/package_blast_plus_2_3_0' && git diff --quiet
Traceback (most recent call last):
  File "/usr/bin/planemo", line 9, in <module>
    load_entry_point('planemo==0.24.0.dev0', 'console_scripts', 'planemo')()
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/planemo-0.24.0.dev0-py2.6.egg/planemo/commands/cmd_shed_create.py", line 39, in cli
    exit_code = shed.for_each_repository(ctx, create, paths, **kwds)
  File "/usr/lib/python2.6/site-packages/planemo-0.24.0.dev0-py2.6.egg/planemo/shed/__init__.py", line 687, in for_each_repository
    function(realized_repository)
  File "/usr/lib/python2.6/site-packages/planemo-0.24.0.dev0-py2.6.egg/planemo/commands/cmd_shed_create.py", line 30, in create
    ctx, realized_repository, **kwds
  File "/usr/lib/python2.6/site-packages/planemo-0.24.0.dev0-py2.6.egg/planemo/shed/__init__.py", line 243, in upload_repository
    if repo_id is None and kwds["force_repository_creation"]:
KeyError: 'force_repository_creation'
[galaxy@ppserver galaxy_blast]$ planemo shed_create -t testtoolshed --owner iuc --name package_blast_plus_2_3_0 packages/package_blast_plus_2_3_0/
Unexpected response from galaxy: 400: {"err_msg": "You already own a repository named <b>package_blast_plus_2_3_0<\/b>, please choose a different name.", "err_code": 400008}

jmchilton added a commit to jmchilton/planemo that referenced this issue Mar 29, 2016

jmchilton added a commit to jmchilton/planemo that referenced this issue Mar 29, 2016

Check .shed.yml owner against credentials during shed creation.
Fixes galaxyproject#246.

Rebased with advice from @nsoranzo - as always thanks eagle eyes.
@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc commented Mar 29, 2016

Note that once a repository exists on the Tool Shed, the owner can grant write access to another user - but this isn't possible prior to repository creation.

The new explicit error message it a big improvement, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment