Bug 1712345

Summary: Safemode::NoMethodError: undefined method '#map' for String::Jail (String)
Product: Red Hat Satellite Reporter: Lukáš Hellebrandt <lhellebr>
Component: SCAP PluginAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: akapse, ehelms, ktordeur, mhulan, oprazak
Target Milestone: 6.6.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_openscap-1.0.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:49:07 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
foreman-tail none

Description Lukáš Hellebrandt 2019-05-21 11:30:09 UTC
Description of problem:
When trying to run SCAP scan, scan fails and there is the following in the log (traceback attached): "Safemode::NoMethodError: undefined method '#map' for String::Jail (String)"

Version-Release number of selected component (if applicable):
Reproduced on Sat 6.6 snap 3

How reproducible:
Deterministic

Steps to Reproduce:
1. Setup SCAP policy
2. Hosts -> All Hosts -> <host> -> Schedule Remote Job -> Run OpenSCAP scan

Actual results:
Failure, traceback

Expected results:
Successful scan, no traceback

Additional info:
It is quite possible that there is something wrong in my configuration. However, a NoMethodError is a wrong result anyway.

Comment 3 Lukáš Hellebrandt 2019-05-21 11:33:13 UTC
Created attachment 1571587 [details]
foreman-tail

Comment 4 Lukáš Hellebrandt 2019-05-21 12:24:59 UTC
Just tested on 6.5 with the same setup and this is NOT a regression.

Comment 5 Lukáš Hellebrandt 2019-05-21 12:26:20 UTC
This blocks testing bug 1542844.

Comment 8 Ondřej Pražák 2019-06-04 07:15:17 UTC
I was able to reproduce, however my host was not configured properly. Additional steps I needed to take after creating a policy:

a. Assign policy to host: Hosts -> All hosts, 'Select action' dropdown -> Assign Compliance Policy, choose a policy in modal and confirm
b. Check the host edit page and make sure host has openscap capsule and puppet classes for foreman_scap_client assigned. If the puppet classes were previously not assigned, puppet must be run for configuration to propagate.
c. run openscap scan, no more safemode errors 

Does this remove the error? I agree we should not show the NoMethodError.

Comment 9 Lukáš Hellebrandt 2019-06-05 14:46:04 UTC
I tried and it didn't help. However, in both cases (with and without the "fix"), I am now getting a different error:

"Warning! error during rendering: undefined method '#map' for String::Jail (String)"

Comment 10 Ondřej Pražák 2019-06-12 13:17:09 UTC
Connecting redmine issue https://projects.theforeman.org/issues/27030 from this bug

Comment 12 Akshay Kapse 2019-07-03 13:18:36 UTC
Just tested on 6.4 with the same setup and got the same error.

Comment 14 Bryan Kearney 2019-07-23 12:04:22 UTC
Upstream bug assigned to oprazak

Comment 15 Bryan Kearney 2019-07-23 12:04:24 UTC
Upstream bug assigned to oprazak

Comment 16 Lukáš Hellebrandt 2019-08-28 11:56:03 UTC
FailedQE with Sat 6.6 snap 17.

1) Register a host, assign puppet class, assign policy
2) Run scan -> success
3) Unassign all policies -> success (I'd expect error: "Create and assign a policy to this host before proceeding")
4) Unassign all puppet classes -> fail
5) Assign a policy -> fail (I'd expect some error but not "Create and assign a policy to this host before proceeding")

Anyway, the "undefined method" error is not present anymore, this BZ just needs a bit polishing.

Comment 17 Ondřej Pražák 2019-09-02 11:07:42 UTC
Connecting redmine issue https://projects.theforeman.org/issues/27756 from this bug

Comment 18 Lukáš Hellebrandt 2019-09-19 10:07:22 UTC
Verified with Sat 6.6 snap 20.

When running a scan on a host without a policy, the error message is: "Create and assign a policy to this host before proceeding"
When running a scan on a host without the puppet classes or without both assigned, the error message is: "Cannot detect values for policies input, please make sure your host is properly configured for openscap".

Comment 19 Bryan Kearney 2019-10-22 19:49:07 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-2019:3172