Hello all,

I wanted to share the plan for refactoring the Katello Repositories model
and get some feedback.

We have been wanting to break up repositories for some time. The
repositories table has a field "content_type", which is used to handle yum,
file, docker, ostree, and puppet repos. In addition to this, there is a
"Content View Puppet Environment" model, which inherits repository methods.
[1]

Some reasons to refactor repositories are:
- The repository model is large and monolithic
- Multiple exceptions have to be made for different content_types i.e [2]
- Its easy to introduce bugs in this area
- the complexity is blocking or making it harder to design new features
around repositories
- Its the first step to implementing content type plugins - original design
here [3]

The plan is to use Single Table Inheritance on the repositories table, and
move the content_type column to the  type column. Each content type will be
its own class and can have its own methods.

The API will likely stay the same or have minimal changes, The rabl files
would  just need updating. Any additional API changes can happen after the
refactoring (with proper deprecation warnings)

This would be broken into small changes, which will look something like
this:
- add STI to repositories model, but keep old logic
- setup classes for each content type
- remove content_type field and update logic that uses that field to know
use type field
- move content based on functionality (in individual commits)
- remove content view puppet environment and use "puppet" type repository
in its place

Let me know if you have any questions, looking forward to hearing
everyone's opinions.

[1]
https://github.com/Katello/katello/blob/master/app/models/katello/content_view_puppet_environment.rb#L6
[2]
https://github.com/Katello/katello/blob/937ca0da561347f94a22aae87aa52ab345eb1238/app/models/katello/glue/pulp/repo.rb#L154-L175
[3] http://projects.theforeman.org/projects/katello/wiki/ContentPlugins

Thanks,
John Mitsch
Red Hat Engineering
(860)-967-7285
irc: jomitsch

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to