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

Plugin installation endpoints #1958

Merged

Conversation

josenavas
Copy link
Contributor

@josenavas josenavas commented Sep 26, 2016

This adds the needed endpoints so plugins can register themselves using the REST api.

@antgonza there are 2 missing things in here:

  • In the class CommandListHandler, perform the call to create, passing parameters using the correct format
  • Add a new function in the class qiita_db.software.Command called add_default_parameter_sets that adds new parameter sets to the command. Then you can call this function in the previous handler once the command is created. Actually not needed, there is the DefaultParameters.create call

Copy link
Member

@antgonza antgonza left a comment

Choose a reason for hiding this comment

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

Looks good, just one comment and you need to fix the flake8 errors.

plugin = qdb.software.Software.from_name_and_version(name, version)
except qdb.exceptions.QiitaDBUnknownIDError:
raise HTTPError(404)
except Exception as e:
Copy link
Member

Choose a reason for hiding this comment

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

It seems like all 500 errors are missing tests. Could you double check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm unsure on how to force those errors to happen. I put those as a security guard in case that something unexpected happens (that's why they catch any exception). Other endpoints are similar to this.
Any idea on how to force the error?

Copy link
Member

Choose a reason for hiding this comment

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

If it's not possible to generate them, why test them?

Now, this is working on from_name_and_version, which only raises QiitaDBUnknownIDError, so the second except is working on:

            sql = """SELECT software_id
                     FROM qiita.software
                     WHERE name = %s AND version = %s"""
            qdb.sql_connection.TRN.add(sql, [name, version])
            res = qdb.sql_connection.TRN.execute_fetchindex()

which will only fail if the DB fails or the structure changes, right? If that's correct I think we can remove them, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the DB fails, what will be then returned to the client?

Copy link
Member

Choose a reason for hiding this comment

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

If the DB fails, the Qiita server will fail, right? So no return at all ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessarily - our fault tolerant system allows the webserver to still be alive even when the DB is dead.

Copy link
Member

Choose a reason for hiding this comment

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

K

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling de87d41 on josenavas:plugin-installation-endpoints into * on biocore:plugin-installation*.

@antgonza antgonza merged commit a5d1556 into qiita-spots:plugin-installation Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants