Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Fixed the registry client #259

Merged
merged 12 commits into from
Aug 11, 2015
Merged

Fixed the registry client #259

merged 12 commits into from
Aug 11, 2015

Conversation

mssola
Copy link
Collaborator

@mssola mssola commented Aug 11, 2015

In order to implement both the Manifest API (#200) and the Catalog API (#199), the register client (and its associated classes) needed some heavy refactoring. This PR brings this refactoring + the test suite for it.

mssola added 5 commits August 7, 2015 13:54
Up until now, the portus "user" was handled in a special way, by adding some
code that worked around the whole authentication mechanism. However, we
recently discovered that this was basically broken.

The solution to this situation is to effectively create the "portus" user, as
any other user in the system. Because of this, I've added a new secret, which
is the password of the "portus" user, and I have added a rake task to help with
the migration. Moreover, the seeds file already takes care of that. With this
commit, the `manifest` method from the RegisterClient works again, and the
authentication mechanism has been greatly simplified.

There are still some small issues that need to be addressed. This will be done
in later commits.
This method returns all the repositories (with their respective tags) that can
be found through the new Catalog API from Docker's Distribution v2.
… portus

The portus user has to be handled transparently behind the scenes. This means
that it must not be listed in the users list for admins, and it has to be
hidden when dealing with authentication.

Moreover, the admin will have a notice in the dashboard if the Portus user is
not there. This should never happen since the portus user is installed always
by seeding it. This would mean that there's something really wrong with the DB
(some manual update gone wrong).
@mssola mssola changed the title Client Fixed the registry client Aug 11, 2015
@mssola
Copy link
Collaborator Author

mssola commented Aug 11, 2015

Some observations:

  1. There's now a "portus" user. This user can be creating during initialization of the application (through the db/seeds.rb file) or with a new task that I have created (rake portus:create).
  2. Because of the previous points things had to be changed in the User model, because this new "portus" user is an admin, therefore conflicting with the sign up of the first admin.
  3. Moreover, the admin will get in the dashboard a notice whenever the portus user is missing. This should never happen (because it would mean that something is really wrong in the DB), but just in case, it never hurts to warn the admin.

bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake portus:create
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we run `db:seed instead? I foresee one day we will remove this special task.

# Returns an array containing the scopes available for this registry object.
# It returns a ["*"] if it's an invalid scope, because this will not be
# implemented as a method.
def scopes
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 provide more details about the two scopes, like when they are used? This is not so clear right now as it is for the namespace scope (where pull and push are pretty obvious). The goal is to avoid someone else to dig into the distribution code later on ;)

@flavio
Copy link
Member

flavio commented Aug 11, 2015

You forgot to remove the OTP gem library from the Gemfile.

@flavio
Copy link
Member

flavio commented Aug 11, 2015

The code looks good. Thanks also for all the documentation you added.

I think this obsoletes part of this #241 pull request.

@mssola
Copy link
Collaborator Author

mssola commented Aug 11, 2015

The documentation on the Registry::AuthScope has been moved to the new class Portus::AuthScope. In this same class I also added documentation on how scopes & policies interact with each other.

@flavio
Copy link
Member

flavio commented Aug 11, 2015

LGTM

mssola added a commit that referenced this pull request Aug 11, 2015
Fixed the registry client
@mssola mssola merged commit 1e0ca95 into SUSE:master Aug 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants