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

fixes #7890 Move Distributions from Elasticsearch to the Database #5362

Merged
merged 1 commit into from
Aug 27, 2015

Conversation

johnpmitsch
Copy link
Contributor

Adds distribution values from pulp as attributes to Repository. They are added to the UI and users are now able to search on these values using scoped search

@johnpmitsch
Copy link
Contributor Author

before testing: rake db:migrate && rake katello:upgrades:2.4:import_distributions

@@ -1,38 +0,0 @@
module Katello
class Api::V2::DistributionsController < Api::V2::ApiController
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing this, we need to also remove the routes related to it, further, we need to ask ourselves if this is breaking our API contract and if we need to rev our versioning in light of.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be a better idea to leave it in so the API functions as it did before? and that would mean leaving in the Distribution model and Glue::ElasticSearch::Distribution as well, right?

Copy link
Member

Choose a reason for hiding this comment

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

Since we're completely getting rid of an object, I'm fairly okay with this

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I follow exactly, you are saying because we are removing an object from conceptual existence, you are OK treating this API removal as not a breaking change?

Copy link
Member

Choose a reason for hiding this comment

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

Pretty much. I'm sure others would disagree, but really this api doesn't even make sense. the index call requires a repository_id and returns a list, even though there will ever be one.

We could maintain this api (minus the searching) with these attributes: :version, :arch, :family, :variant simply by mapping the repo object i guess. That would be fairly simple. Maintaining the full api (minus search syntax compatibility, which i guess we've determined is okay to change) would basically dictate how the model is done (and not done the way we discussed).

Copy link
Member

Choose a reason for hiding this comment

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

I suppose we could throw a deprecation warning into 2.3?

Copy link
Member

Choose a reason for hiding this comment

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

That sounds like a plan!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just so I understand, @jlsherrill when you say mapping the repo object, do you mean adding the distribution attributes to the repository api (which is done here) or making a child object "distribution" of the repo object when showing a repository in the api?

Copy link
Member

Choose a reason for hiding this comment

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

I was suggesting we could maintain the existing controller, but instead of rendering distribution objects, we render repo objects with the distribution attributes. But eric is now suggesting we just deprecate the distribution api in the 2.3 release (which is not out yet), and get rid of it in this PR

@johnpmitsch
Copy link
Contributor Author

[test]

@@ -15,6 +15,11 @@ attributes :gpg_key_id
attributes :content_id, :content_view_version_id, :library_instance_id
attributes :product_type
attributes :promoted? => :promoted
attributes :distribution_version
attributes :distribution_arch
attributes :distribution_bootable? => :distribution_bootable
Copy link
Member

Choose a reason for hiding this comment

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

This is what started my question around this function, as it seems like you should just rely on the database attribute instead of mapping a function to this attribute?

@johnpmitsch johnpmitsch force-pushed the distributions branch 9 times, most recently from 0ffbf8b to b7c6286 Compare August 18, 2015 20:24
@johnpmitsch
Copy link
Contributor Author

[test]

@johnpmitsch johnpmitsch force-pushed the distributions branch 3 times, most recently from 651dba4 to 9ce87dc Compare August 19, 2015 20:38
@ehelms
Copy link
Member

ehelms commented Aug 24, 2015

@johnpmitsch looks like you need a rebase here

@johnpmitsch
Copy link
Contributor Author

@ehelms Thanks, just rebased

conflicts.select { |conflict| conflict[:distributions].length > 1 }
repos = self.repositories_to_publish.where("distribution_arch IS NOT NULL OR distribution_version IS NOT NULL")
repos.group_by { |repo| [repo.distribution_arch, repo.distribution_version] }
.select { |_, value| value.length > 1 }.values.flatten
Copy link
Member

Choose a reason for hiding this comment

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

This should only include bootable distros right?

Copy link
Member

Choose a reason for hiding this comment

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

(it doesn't look like it does)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya it was including all distros, I just changed it, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

maybe i'm misreading this, but i don't see where that was changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops

conflicts.select { |conflict| conflict[:distributions].length > 1 }
repos = self.repositories_to_publish.where("distribution_arch IS NOT NULL OR distribution_version IS NOT NULL")
repos = repos.select { |repo| repo.distribution_bootable? }
repos.group_by { |repo| [repo.distribution_arch, repo.distribution_version] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jlsherrill ok that should do it

@jlsherrill
Copy link
Member

ACK from me, ehelms?

@ehelms
Copy link
Member

ehelms commented Aug 27, 2015

👍

@jlsherrill
Copy link
Member

Merging, thanks @johnpmitsch

jlsherrill added a commit that referenced this pull request Aug 27, 2015
fixes #7890 Move Distributions from Elasticsearch to the Database
@jlsherrill jlsherrill merged commit 6af70c2 into Katello:master Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants