Bug 1905814

Summary: [RFE] Ability to clone a discovery rule from webui
Product: Red Hat Satellite Reporter: Amaani S Karimi <akarimi>
Component: Discovery PluginAssignee: Rahul Bajaj <rabajaj>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: ehelms, lzap, mmccune, pcreech, rabajaj, thadzhie, zhunting
Target Milestone: 6.10.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_discovery-17.0.5-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:09:33 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 Amaani S Karimi 2020-12-09 06:55:35 UTC
1. Proposed title of this feature request

>> Ability to clone discovery rules from WebUI


2. What is the nature and description of the request?

>> Just like templates, etc have the ability to clone and create copy, similar functionality if requested for discovery rules.


3. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

>> any

4. Is there already an existing RFE upstream or in Red Hat Bugzilla?

>> No

5. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

>> N/A

6. Would the customer be able to assist in testing this functionality if implemented?

>> Yes

Comment 2 Bryan Kearney 2021-04-13 10:14:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32176 has been resolved.

Comment 3 Roman Plevka 2021-07-02 06:34:10 UTC
Failed QA:
sat6.10.0-7.0

The clone dialog does not select the same taxonomies (organizations, locations) as the original Discovery rule has assigned. No taxonomies are selected instead.

Expecting all the attributes and associations to be the same (excepting name).

Comment 5 Roman Plevka 2021-10-06 13:06:32 UTC
FAILED QA
on sat6.10.0-21.0

Now, the clone doesn't work at all - instead, it updates the original discovery rule.

looking at production log, it looks like the request is being generated towards wrong endpoint:

10.40.195.187 - - [06/Oct/2021:09:05:28 -0400] "POST /discovery_rules/1 HTTP/1.1" 302 124 "https://dhcp-2-226.vms.sat.rdu2.redhat.com/discovery_rules/1-dr1-c3-u/clone" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"
10.40.195.187 - - [06/Oct/2021:09:05:29 -0400] "GET /discovery_rules HTTP/1.1" 200 5952 "https://dhcp-2-226.vms.sat.rdu2.redhat.com/discovery_rules/1-dr1-c3-u/clone" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"

==> /var/log/foreman/production.log <==
2021-10-06T09:05:28 [I|app|28178fd5] Started PATCH "/discovery_rules/1" for 10.40.195.187 at 2021-10-06 09:05:28 -0400
2021-10-06T09:05:28 [I|app|28178fd5] Processing by DiscoveryRulesController#update as HTML
2021-10-06T09:05:28 [I|app|28178fd5]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"T2ACXEYvCytcgFDwbj74KDdHnURfb/QQC+5fICXIwehKyoc4Ku2Ej9JjC0VPYv/Q8u7LF3VQo86WATkicT7jNQ==", "discovery_rule"=>{"name"=>"dr1-c3-c", "search"=>"cpu_count = 1", "hostgroup_id"=>"1", "hostname"=>"", "max_count"=>"1", "priority"=>"700", "enabled"=>"1", "location_ids"=>["", "4"], "organization_ids"=>["", "3"]}, "commit"=>"Submit", "id"=>"1"}
2021-10-06T09:05:28 [I|aud|28178fd5] DiscoveryRule (1) update event on name dr1-c3-u, dr1-c3-c
2021-10-06T09:05:28 [I|aud|28178fd5] DiscoveryRule (1) update event on priority 600, 700




comparing this to the actual update action, it's absolutely identical:




10.40.195.187 - - [06/Oct/2021:09:04:39 -0400] "POST /discovery_rules/1 HTTP/1.1" 302 124 "https://dhcp-2-226.vms.sat.rdu2.redhat.com/discovery_rules/1-dr1-c3/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"
10.40.195.187 - - [06/Oct/2021:09:04:40 -0400] "GET /discovery_rules HTTP/1.1" 200 5954 "https://dhcp-2-226.vms.sat.rdu2.redhat.com/discovery_rules/1-dr1-c3/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"
10.40.195.187 - - [06/Oct/2021:09:04:40 -0400] "GET /webpack/foreman_rh_cloud/foreman_rh_cloud-95858015132025db23c0.css HTTP/1.1" 200 22448 "https://dhcp-2-226.vms.sat.rdu2.redhat.com/discovery_rules" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"

==> /var/log/foreman/production.log <==
2021-10-06T09:04:39 [I|app|f1d1dd71] Started PATCH "/discovery_rules/1" for 10.40.195.187 at 2021-10-06 09:04:39 -0400
2021-10-06T09:04:39 [I|app|f1d1dd71] Processing by DiscoveryRulesController#update as HTML
2021-10-06T09:04:39 [I|app|f1d1dd71]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"BazJwX1v9YB8732Zd3H4faDNVZ2t0p+6XVYVl02drugABkylEa16JPIMJixWLf+FZWQDzoftyGTAuXOVGWuMNQ==", "discovery_rule"=>{"name"=>"dr1-c3-u", "search"=>"cpu_count = 1", "hostgroup_id"=>"1", "hostname"=>"", "max_count"=>"1", "priority"=>"600", "enabled"=>"1", "location_ids"=>["", "4"], "organization_ids"=>["", "3"]}, "commit"=>"Submit", "id"=>"1"}
2021-10-06T09:04:39 [I|aud|f1d1dd71] DiscoveryRule (1) update event on name dr1-c3, dr1-c3-u

Comment 10 Roman Plevka 2021-10-25 09:36:28 UTC
VERIFIED
on sat6.10-24.0

The discovery rule is now correctly cloned, with incremented priority score

Comment 13 errata-xmlrpc 2021-11-16 14:09:33 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.10 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-2021:4702