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 #2263 search Hostgroup by label #438

Closed

Conversation

isratrade
Copy link
Member

@abenari, @ohadlevy

I made the search param by label. However, the UI column header is "name". Do you suggest to change the column to "label" or change the scoped_search on "name" to look at "label" column?

@ohadlevy
Copy link
Member

ohadlevy commented Mar 3, 2013

can you please add tests?

@isratrade
Copy link
Member Author

@ohadlevy re-committed with tests

@ohadlevy
Copy link
Member

@isratrade the tests fail, can you have a look please?

@isratrade
Copy link
Member Author

@ohadlevy the tests pass for Ruby 1.9.2 and 1.9.3, but fail for 1.8.7 on the STI Host method missing. @GregSutcliffe

Any suggestion how to proceed?

  1. Error:
    test_user_with_destroy_permissions_should_be_able_to_destroy(HostgroupTest):
    ActiveRecord::AssociationTypeMismatch: Host(#70149929678160) expected, got Host::Managed(#70149926047200)
    app/models/host.rb:11:in send' app/models/host.rb:11:inmethod_missing'
    test/unit/hostgroup_test.rb:59:in test_user_with_destroy_permissions_should_be_able_to_destroy' /test/test_helper.rb:31:inas_user'
    /test/test_helper.rb:37:in as_admin' test/unit/hostgroup_test.rb:58:intest_user_with_destroy_permissions_should_be_able_to_destroy'

  2. Error:
    test_user_with_destroy_permissions_should_not_be_able_to_edit(HostgroupTest):
    ActiveRecord::AssociationTypeMismatch: Host(#70149929678160) expected, got Host::Managed(#70149926047200)
    app/models/host.rb:11:in send' app/models/host.rb:11:inmethod_missing'
    test/unit/hostgroup_test.rb:84:in test_user_with_destroy_permissions_should_not_be_able_to_edit' /test/test_helper.rb:31:inas_user'
    /test/test_helper.rb:37:in as_admin' test/unit/hostgroup_test.rb:83:intest_user_with_destroy_permissions_should_not_be_able_to_edit'

@theforeman-bot
Copy link
Member

You're not in the automated testing whitelist. Please contact us at #theforeman-dev to have this pull request manually reviewed and tested.

@theforeman-bot
Copy link
Member

Test Results: FAILURE (http://ci.theforeman.org/job/test_develop_pull_request/56/)

if name_changed? || ancestry_changed?
Hostgroup.where("ancestry IS NOT NULL").each do |hostgroup|
if hostgroup.path_ids.include?(self.id)
lbl = hostgroup.ancestors.map{|a| a.name + "/"}.join + hostgroup.name
Copy link
Member

Choose a reason for hiding this comment

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

shouldnt we use hostgroup.get_label instead?

@ohadlevy
Copy link
Member

ohadlevy commented Apr 8, 2013

can you rebase as well? thanks

@ohadlevy
Copy link
Member

[test]

@isratrade
Copy link
Member Author

@ohadlevy rebased

@ohadlevy
Copy link
Member

@isratrade can you have a look at the test failures?

@isratrade
Copy link
Member Author

@ohadlevy , it passed on postgres and failed on mysql and sqlite for a destroy action ????

@isratrade
Copy link
Member Author

@ohadlevy, error msg is
Host(#70298320242100) expected, got Host::Managed(#70298316937260)

I'm guessing my recent commit will pass the tests on mysql and sqlite. If so, I will squash the 2 commits.

@isratrade
Copy link
Member Author

@domcleal I'm stumped at the failure on MySql and Sqlite. Can you confirm that this test databases are migrated.
Host(#70295104949920) expected, got Host::Managed(#70295097400200) (ActiveRecord::AssociationTypeMismatch)

@ohadlevy
Copy link
Member

@isratrade i think its a simple has_many :hosts which is wrong on the hostgroup... probably leftover from the hosts STI migration?

@isratrade
Copy link
Member Author

@ohadlevy , @domcleal, @skottler , any ideas why there is one failing test on Jenkins for Ruby 1.8.7 and sqlite3 TEST-TFTPOrchestrationTest.xml

@isratrade
Copy link
Member Author

@ohadlevy , @skottler , strange that it now fails on Ruby 1.8.7 and Postgres with a completely different error ???
Validation failed: Ip Does not match selected Subnet, Mac can't be blank, Mac is invalid

@isratrade
Copy link
Member Author

@skottler @domcleal, http://ci.theforeman.org/job/test_develop_pull_request/258/ shows red on Ruby 1.9.2 and sqlite3, but it doesn't give the details of any failed tests???

@GregSutcliffe
Copy link
Member

@isratrade Looks like a network failure for rubygems.org:

Fetching gem metadata from http://rubygems.org/...
Fetching source index from http://rubygems.org/
Network error while fetching

@skottler
Copy link

Yeah, it was probably just a transient AWS network issue. I'm fine with going ahead with the merge without a retest since the cause was fairly obvious and it only happened on one platform.

@isratrade
Copy link
Member Author

@domcleal, @skottler, I added :destroy to the callbacks and a test and squashed the commits, but I don't see that Jenkins is running the tests of the new commit.

before_save :set_label, :on => [:create, :update, :destroy]
after_save :set_other_labels, :on => [:update, :destroy]

@domcleal
Copy link
Contributor

@isratrade yeah, CI's down at the moment, investigating.

@isratrade
Copy link
Member Author

@ohadlevy, @domcleal I updated the migration to use hostgroup.get_label

@dLobatog
Copy link
Member

Could we add hostgroup search (by label) to the Reports model? It's rather useful and doing this without the label column is just a mess.

@isratrade
Copy link
Member Author

@elobato sure, I can add this next week in a separate pull request

@ohadlevy
Copy link
Member

merged - thanks!

@ohadlevy ohadlevy closed this Apr 21, 2013
h0jeZvgoxFepBQ2C pushed a commit to h0jeZvgoxFepBQ2C/foreman that referenced this pull request Jul 26, 2018
Clean up upstart export to use native upstart features
lzap pushed a commit to lzap/foreman that referenced this pull request Aug 5, 2020
Fixes #23793 - Port robottelo tests for settings
ekohl pushed a commit to ekohl/foreman that referenced this pull request Mar 24, 2021
timeout alone is deprecated in Ruby 2.3

Closes theforemanGH-438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants