Bug 1754424

Summary: Updating policy to Ansible without ansible role should not break page
Product: Red Hat Satellite Reporter: Sanket Jagtap <sjagtap>
Component: SCAP PluginAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: mhulan, oprazak, pcreech
Target Milestone: 6.7.0Keywords: Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:25:37 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:
Attachments:
Description Flags
Validation page break none

Description Sanket Jagtap 2019-09-23 08:28:06 UTC
Description of problem:


Version-Release number of selected component (if applicable):
Satellite 6.6

How reproducible:
Always

Steps to Reproduce:
1. Scap Ansible role is not imported into satellite
2. Try to update existing puppet policy


Actual results:
ActiveRecord::AssociationTypeMismatch
AnsibleRole(#66352280) expected, got nil which is an instance of NilClass(#9657900)
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/association.rb:238:in `raise_on_type_mismatch!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/has_many_through_association.rb:17:in `block in concat'

Expected results:
Unable to save
Required Ansible role theforeman.foreman_scap_client was not found, please ensure it is imported first


Additional info:

Comment 2 Marek Hulan 2019-09-23 08:30:51 UTC
How did you update the policy? UI or API? I think it should be forbidden to change the policy deployment mode. Or was that a regular update of the policy (e.g. name)?

Comment 3 Sanket Jagtap 2019-09-24 10:04:25 UTC
The ansible role is not imported to satellite

I have a puppet Policy already in satellite. 

IF we want to create a new ansible policy, I get a validation error , to import the Ansible role. This is correct and Valid

But, If I want update the existing puppet role with ansible, I should get the same validation error, but instead on submit it breaks the page. 

Update is done through UI

This issue is to track the validation error on update with there is no ansible role.
PFA,

Comment 4 Sanket Jagtap 2019-09-24 10:04:48 UTC
Created attachment 1618560 [details]
Validation page break

Comment 5 Marek Hulan 2019-09-25 11:37:02 UTC
Created redmine issue https://projects.theforeman.org/issues/27936 from this bug

Comment 6 Bryan Kearney 2019-10-01 10:06:39 UTC
Upstream bug assigned to oprazak

Comment 7 Bryan Kearney 2019-10-01 10:06:41 UTC
Upstream bug assigned to oprazak

Comment 8 Bryan Kearney 2019-10-24 14:06:43 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27936 has been resolved.

Comment 9 Sanket Jagtap 2019-12-31 11:42:42 UTC
Build: Satellite 6.7 snap7 

Page doesn't break now and display a Validation error for user

Unable to save
Required Ansible role theforeman.foreman_scap_client was not found, please ensure it is imported first.

Comment 12 errata-xmlrpc 2020-04-14 13:25:37 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, 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-2020:1454