-
Notifications
You must be signed in to change notification settings - Fork 290
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 #7891 - Convert Pools/Subscriptions from Elastic Search to the … #5446
Conversation
01550ad
to
285462f
Compare
[test] |
@@ -15,6 +14,7 @@ | |||
</div> | |||
</div> | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded
Much of the UI seems messed up (specifically the subscriptions tab under content hosts). I would fix the technical errors (indentation mostly, a couple missing semicolons - spelled out in the grunt tests); either you or I can then fix the broken javascript tests from there. |
@cfouant hey, ya, so new development, both activation keys and content host had to be converted to use nutupane with subscriptions for scoped search to work on those pages, so I am in the middle of that. Also, I am rebasing now, sorry I didn't see that until now. I'll check in with you when you are online this morning and we can discuss further. |
f3d9575
to
88bad85
Compare
end | ||
|
||
def self.pulp_backend_search_classes | ||
[Katello::PuppetModule] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you actually want to remove these two methods now that you PuppetModules have been converted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that. Just return an empty array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cfouant I don't see a need for either method so I removed it completely and wherever it is called in rake tasks
853b02b
to
1d0bec7
Compare
I am getting a 500 ISE when I try under Red Hat Subscriptions box to search by name: I've replicated this with other given search fields (eg cores) |
@cfouant Thanks for catching that, kind of the whole point of this PR :) Just pushed up the fix, it had to do with Subscriptions controller really returning Pools, which confused scoped search. I was able to add a resource_class method to subscriptions controller and now both Subscription and Pool fields are searchable! |
cade5f0
to
87c8429
Compare
end | ||
|
||
def test_search_by_account | ||
assert_equal Pool.search_for("account = #{@pool_one.account_number}").first, @pool_one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather see this broken down like:
pools = Pool.search_for("account = #{@pool_one.account_number}")
assert_equal pools, @pool.one
58b672e
to
efd2ee3
Compare
@jlsherrill updated |
I am hitting this while running the upgrade rake task:
|
@ehelms I'm having trouble reproducing, but following the traceback leads me to believe the "type" column should be dropped in Katello::Product table as we no longer have a need for single table inheritance? |
@ehelms i get the same error, was just about ot paste that. The issue is that you likely need to import a manifest prior to the upgrade to hit the error |
The fix would be to just delete Products where type => ::Katello::MarketingProduct i believe |
@jlsherrill do that when importing subscriptions? |
@johnpmitsch at the very start of the upgrade script I'd say. |
@jlsherrill so if there are existing Products with "MarketingProduct" in the type column, those should be deleted before the updgrade task, because that model no long exists, am I on the right track here? |
I would say at the start of the upgrade task, not before it, in the migration. @ehelms may have an opinion about this. |
9193a78
to
a48f18e
Compare
@jlsherrill @ehelms updated the rake task to destroy all where type is MarketingProduct |
I still get an error below with this update. The issue now is that it's trying to access a class that no longer exists which means you probably have to try re-defining Katello::MarketingProduct in the rake task or do this in the migration (while also defining that class in the migration like we do in other places).
|
@ehelms is there a good example I can use where we do that in other places? |
You may just do a delete_all instead of a destroy all. That shouldn't require the class being loaded i don't think. |
I also did a grep of 'Marketing' in the @jlsherrill Should we drop the inheritance that is still present on the Product model |
@ehelms by drop the inheritance, i assume you mean the 'type' field? I'd say yeah, that'd be smart to do. |
and if we do that, the marking product deletion would need to go in the migration that dropped that field. |
Yes, that is what I meant (to drop the type column all together). |
52a55f4
to
cd5a22f
Compare
@ehelms @jlsherrill updated to remove "type" column and include the class in the migration file. I tested by checking out master branch, reseting, import a manifest, switch to subscriptions branch, migrate, run upgrade script and all seemed to run no problem. |
t.integer "engineering_product_id" | ||
end | ||
|
||
add_column :katello_products, :type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws an error on rollback:
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (2 for 3)/home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:1017:in `add_column'
/home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:466:in `block in method_missing'
/home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in `block in say_with_time'
/home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in `say_with_time'
/home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:458:in `method_missing'
/home/vagrant/katello/db/migrate/20150908222711_drop_marketing_engineering_products.rb:18:in `down'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ehelms updated add_column to include the missing argument
cd5a22f
to
f4962f7
Compare
Tested and ACK for me, final say is on @jlsherrill |
drop_table :katello_marketing_engineering_products | ||
|
||
remove_column :katello_products, :type | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have missed it, but i don't see you removing the old marketing products prior to dropping the 'type' column?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlsherrill updated
…to the database
f4962f7
to
6400e13
Compare
ACK thanks @johnpmitsch ! crossing fingers that we didn't miss any issues :) |
Fixes #7891 - Convert Pools/Subscriptions from Elastic Search to the …
…database
Opening this up for initial review. This covers adding subscriptions to the database and converting to scoped search on subscriptions/pools.
here is what is left to-do
Issues that need to be resolved