Module: ForemanRhCloud::RegistrationManagerExtensions
- Includes:
- CertAuth
- Defined in:
- app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb
Instance Method Summary
collapse
Methods included from CertAuth
#cert_auth_available?, #execute_cloud_request, #foreman_certificate
#candlepin_id_cert, #cp_owner_id, #upstream_owner
#execute_cloud_request
Instance Method Details
#hbi_host_destroy(host) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb', line 21
def hbi_host_destroy(host)
uuid = host.insights_facet.uuid
logger.debug "Unregistering host #{uuid} from HBI"
execute_cloud_request(
organization: host.organization,
method: :delete,
url: ForemanInventoryUpload.host_by_id_url(uuid),
headers: {
content_type: :json,
}
)
rescue RestClient::NotFound
Rails.logger.warn(_("Attempted to destroy HBI host %s, but host does not exist in HBI") % uuid)
rescue StandardError => e
Rails.logger.error(format(_("Failed to destroy HBI host %s: %s"), uuid, e.message))
end
|
#logger ⇒ Object
5
6
7
|
# File 'app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb', line 5
def logger
Rails.logger
end
|
#unregister_host(host, options = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb', line 9
def unregister_host(host, options = {})
organization_destroy = options.fetch(:organization_destroy, false)
host.reload
hbi_host_destroy(host) if ForemanRhCloud.with_iop_smart_proxy? && !organization_destroy && host.insights_facet&.uuid&.presence
host.insights&.destroy!
super(host, options)
end
|