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 #15818 - Show which capsule a host is registered through #6211

Merged

Conversation

johnpmitsch
Copy link
Contributor

This displays the system that a host is registered through in a
'registered_through' field that is searchable and displayed in the
content host details page. If the host is registered to the main
katello server, the field will display that.

@johnpmitsch
Copy link
Contributor Author

Testing should be done on both a dev env and a production instance as HTTP headers vary in production mode.

@johnpmitsch
Copy link
Contributor Author

All seems to be working correctly in production from my testing

@@ -198,6 +198,9 @@ def consumer_create
sync_task(::Actions::Katello::Host::Register, host, System.new, rhsm_params, content_view_environment)
host.reload

parent_host = get_parent_host(request.headers)
host.subscription_facet.update_attribute(:registered_through, parent_host)

Copy link
Member

Choose a reason for hiding this comment

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

this likely needs to be done via consumer_activate too, and I'd suggest doing it on facts (and possibly upload_package_profile too), so that if the client changes what capsule its using it'll automatically update

@johnpmitsch
Copy link
Contributor Author

@jlsherrill updated with your suggestions

@johnpmitsch
Copy link
Contributor Author

[test]

1 similar comment
@jlsherrill
Copy link
Member

[test]

@jlsherrill
Copy link
Member

jlsherrill commented Aug 4, 2016

  • tested dev
  • tested production

hostnames = headers["HTTP_X_FORWARDED_SERVER"]
host = hostnames.split(",")[0] if hostnames
host || Facter.value(:fqdn) || SETTINGS[:fqdn]
end
Copy link
Member

Choose a reason for hiding this comment

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

Mind writing a test for this function? I think you can likely call it directly on the @controller variable from a controller test file

@jlsherrill
Copy link
Member

Mind making this searchable?

@johnpmitsch
Copy link
Contributor Author

@jlsherrill is this not working?

@jlsherrill
Copy link
Member

@johnpmitsch still in the process of testing it. Seems good so far. Why do you ask?

@@ -25,6 +25,7 @@ module SubscriptionFacetHostExtensions
scoped_search :on => :autoheal, :in => :subscription_facet, :complete_value => true
scoped_search :on => :service_level, :in => :subscription_facet, :complete_value => true
scoped_search :on => :last_checkin, :in => :subscription_facet, :complete_value => true
scoped_search :on => :registered_through, :in => :subscription_facet, :complete_value => true
Copy link
Member

Choose a reason for hiding this comment

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

ohhh this!
ignore me :)

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
Copy link
Member

ACK pending testing that function

This displays the system that a host is registered through in a
'registered_through' field that is searchable and displayed in the
content host details page. If the host is registered to the main
katello server, the field will display that.
@johnpmitsch
Copy link
Contributor Author

@jlsherrill updated with a test for get_parent_host

@johnpmitsch
Copy link
Contributor Author

@jlsherrill and moved get_parent_host out of private methods block

@jlsherrill
Copy link
Member

ACK 👍

@johnpmitsch johnpmitsch merged commit 69df0ec into Katello:master Aug 5, 2016
@johnpmitsch johnpmitsch deleted the capsule_registered_by_15818 branch August 5, 2016 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants