Bug 2004335

Summary: [RFE] API and Hammer functionality for Red Hat Access Insights in satellite 6
Product: Red Hat Satellite Reporter: Ganesh Payelkar <gpayelka>
Component: RH Cloud - InsightsAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: addubey
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8.0CC: addubey, aruzicka, pcreech
Target Milestone: 6.11.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 5.0.28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-05 14:30:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ganesh Payelkar 2021-09-15 03:57:42 UTC
Description of problem:

Need API and Hammer functionality for Red Hat Access Insights to enable to disable the services in satellite 6.


Version-Release number of selected component (if applicable):
satellite 6.8

How reproducible:
Only through WebUI

Steps to Reproduce:
1. UI: satellite --> Insights -> Manage --> Enable/Disable service


Disable:

2021-09-09T21:41:24 [I|app|ddf57327] Started PUT "/redhat_access/telemetry_configuration" for 10.74.16.21 at 2021-09-09 21:41:24 -0400
2021-09-09T21:41:24 [I|app|ddf57327] Processing by RedhatAccess::TelemetryConfigurationsController#update as */*
2021-09-09T21:41:24 [I|app|ddf57327]   Parameters: {"portal_user"=>nil, "enable_telemetry"=>false, "organization_id"=>1, "email"=>nil, "telemetry_configuration"=>{"portal_user"=>nil, "enable_telemetry"=>false, "organization_id"=>1, "email"=>nil}}
2021-09-09T21:41:24 [I|app|ddf57327] Completed 200 OK in 46ms (Views: 0.6ms | ActiveRecord: 35.5ms | Allocations: 3744)
2021-09-09T21:41:24 [I|app|e037fadb] Started GET "/redhat_access/r/insights/view/api/v3/me" for 10.74.16.21 at 2021-09-09 21:41:24 -0400
2021-09-09T21:41:24 [I|app|e037fadb] Processing by RedhatAccess::Api::TelemetryApiController#connection_status as */*
2021-09-09T21:41:24 [I|app|e037fadb]   Parameters: {"v"=>"v3"}

==> /var/log/httpd/foreman-ssl_access_ssl.log <==
10.74.16.21 - - [09/Sep/2021:21:41:24 -0400] "GET /redhat_access/r/insights/view/api/v3/me HTTP/1.1" 200 88 "https://satellite.example.com/redhat_access/insights/manage/" "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0"



Enable: 

==> /var/log/foreman/production.log <==
2021-09-09T21:42:13 [I|app|3c79b4f0] Started PUT "/redhat_access/telemetry_configuration" for 10.74.16.21 at 2021-09-09 21:42:13 -0400
2021-09-09T21:42:13 [I|app|3c79b4f0] Processing by RedhatAccess::TelemetryConfigurationsController#update as */*
2021-09-09T21:42:13 [I|app|3c79b4f0]   Parameters: {"portal_user"=>nil, "enable_telemetry"=>true, "organization_id"=>1, "email"=>nil, "telemetry_configuration"=>{"portal_user"=>nil, "enable_telemetry"=>true, "organization_id"=>1, "email"=>nil}}
2021-09-09T21:42:13 [I|app|3c79b4f0] Completed 200 OK in 14ms (Views: 0.2ms | ActiveRecord: 3.0ms | Allocations: 3708)
2021-09-09T21:42:13 [I|app|421145ce] Started GET "/redhat_access/r/insights/view/api/v3/me" for 10.74.16.21 at 2021-09-09 21:42:13 -0400
2021-09-09T21:42:13 [I|app|421145ce] Processing by RedhatAccess::Api::TelemetryApiController#connection_status as */*
2021-09-09T21:42:13 [I|app|421145ce]   Parameters: {"v"=>"v3"}
2021-09-09T21:42:13 [I|app|421145ce] Completed 200 OK in 560ms (Views: 0.6ms | ActiveRecord: 2.5ms | Allocations: 7745)

 

Actual results:

Tried : 

# curl -i -H "Content-Type: application/json" -X PUT -d "{\"enable_telemetry\":\"false\", \"organization_id\":\"1\"}" -u admin:password https://$(hostname -f)/redhat_access/telemetry_configuration

 [I|app|2f22e2cf] Completed 500 Internal Server Error in 18ms (Views: 15.8ms | ActiveRecord: 1.6ms | Allocations: 18004

Expected results:

We should have the functionality through API/Hammer, so we can enable or disable, whenever there is a requirement.  

Additional info:

There is no plugin or module available 
https://apidocs.theforeman.org/foreman/2.5/apidoc/v2.html

https://access.redhat.com/r/insights/docs/#api-System
https://console.redhat.com/ansible/automation-hub/repo/published/redhat/satellite

Comment 1 Shimon Shtein 2022-03-07 11:19:40 UTC
Since the redhat_access plugin is deprecated in 6.10 and on, the new way to enable or disable telemetry would be by using `host_registration_insights` parameter set on either host, organization or globally.

The parameter could be set by UI, API and CLI just as any other host parameter in Satellite.

Comment 2 addubey 2022-03-17 06:24:03 UTC
Verified.


Tested on: Satellite-7.0.0. Snap 13.0


Steps followed: 

1. Go to satellite WebUI-> click on Edit -> Parameters -> host_registration_insights.
1. To enable or disable telemetry would be by using the `host_registration_insights` parameter set on either host, organization, or globally.


Observation: Functionality can be changed with the host_registration_insights parameter.

Comment 5 errata-xmlrpc 2022-07-05 14:30:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498