Bug 1195212

Summary: Unable to edit host_grp, host, puppet-classes upon creating an oscap policy
Product: Red Hat Satellite Reporter: Kedar Bidarkar <kbidarka>
Component: WebUIAssignee: Shlomi Zadok <szadok>
WebUI sub component: Foreman QA Contact: Kedar Bidarkar <kbidarka>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: omaciel, szadok
Version: 6.1.0   
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7764
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:26:58 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:
Bug Depends On:    
Bug Blocks: 1047797    

Description Kedar Bidarkar 2015-02-23 11:51:59 UTC
Description of problem:

Unable to edit host_grp, host, puppet-classes upon creating an oscap policy

Processing by HostgroupsController#edit as HTML
  Parameters: {"id"=>"5-rhel66_grp"}
  Rendered puppetclasses/_selectedClasses.html.erb (4.5ms)
  Rendered puppetclasses/_classes_in_groups.html.erb (0.0ms)
  Rendered puppetclasses/_classes.html.erb (7.2ms)
  Rendered puppetclasses/_class_selection.html.erb (43.5ms)
  Rendered common/_domain.html.erb (218.5ms)
  Rendered common/_domain_subnet.html.erb (225.7ms)
  Rendered common/os_selection/_architecture.html.erb (4.5ms)
  Rendered common/os_selection/_operatingsystem.html.erb (26.0ms)
  Rendered common/os_selection/_initial.html.erb (34.0ms)
  Rendered puppetclasses/_class_parameters.html.erb (15.7ms)
  Rendered puppetclasses/_classes_parameters.html.erb (27.3ms)
  Rendered hostgroups/_form.html.erb (384.4ms)
  Rendered hostgroups/edit.html.erb within layouts/application (384.8ms)
Operation FAILED: only generation of JSON objects or arrays allowed
  Rendered common/500.html.erb within layouts/application (8.8ms)
  Rendered layouts/base.html.erb (1.5ms)
Completed 500 Internal Server Error in 454ms (Views: 15.1ms | ActiveRecord: 16.6ms)


Processing by PuppetclassesController#edit as HTML
  Parameters: {"id"=>"5-foreman_scap_client"}
  Rendered common/_edit_habtm.html.erb (7.1ms)
  Rendered lookup_keys/_value.html.erb (215.0ms)
  Rendered lookup_keys/_fields.html.erb (254.4ms)
  Rendered lookup_keys/_value.html.erb (9.1ms)
  Rendered lookup_keys/_fields.html.erb (66.0ms)
Client connected.
Connected to server.
  Rendered lookup_keys/_value.html.erb (6.2ms)
  Rendered lookup_keys/_fields.html.erb (251.6ms)
  Rendered lookup_keys/_fields.html.erb (21.3ms)
  Rendered puppetclasses/_form.html.erb (649.1ms)
  Rendered puppetclasses/edit.html.erb within layouts/application (649.6ms)
Operation FAILED: only generation of JSON objects or arrays allowed
  Rendered common/500.html.erb within layouts/application (6.6ms)
  Rendered layouts/base.html.erb (1.3ms)
Completed 500 Internal Server Error in 684ms (Views: 10.4ms | ActiveRecord: 9.1ms)


Version-Release number of selected component (if applicable):
sat6.1 beta snap3

How reproducible:
upon creating an oscap policy

Steps to Reproduce:
1. create puppet_Repo, sync, puppet_cv , publish promote
2. make sure puppet-classes is visible
3. create a hostgroup, till this stage we would be able to edit the entities created in step 2) and 3).
4. Now create an oscap policy, after the policy is created the existing hostgroups and puppet-classes can no longer be edited.

Actual results:
unable to edit host-groups, foreman_scap_client or hosts 

We get the below message:
Operation FAILED: only generation of JSON objects or arrays allowed.

It appears that all entities for which foreman_scap_client puppet-class is associated cannot be edited.

Expected results:
editing of hostgroup and puppet-classes should be possible even after oscap policy creation.

Additional info:

Comment 1 Shlomi Zadok 2015-02-23 14:30:34 UTC
May be related to https://github.com/sstephenson/execjs/pull/130
and we may need to downgrade our execjs gem or to refactor the policies_enc method.

Comment 2 Shlomi Zadok 2015-02-23 15:01:30 UTC
I can verify it's the policies_enc json causing the problem

Comment 4 Shlomi Zadok 2015-02-24 08:22:04 UTC
Seems there is an open issue on upstream for lookup_keys with the same issue:
http://projects.theforeman.org/issues/7764

Comment 5 Shlomi Zadok 2015-02-24 11:55:27 UTC
The solution is to update json gem. 
I will be creating a json package for foreman, we should pull json gem from upstream package.

Comment 6 Shlomi Zadok 2015-02-24 13:04:54 UTC
(In reply to Shlomi Zadok from comment #5)
> The solution is to update json gem. 
> I will be creating a json package for foreman, we should pull json gem from
> upstream package.

https://github.com/theforeman/foreman/pull/2195
No json package atm

Comment 7 Shlomi Zadok 2015-02-26 12:36:25 UTC
Jason,
Can you cherry-pick https://github.com/theforeman/foreman/commit/8dcb01a429e88a12edd605672e6f4340de7ca977 for the next release of Sat6.1? This solves the issue.
Thanks.

Comment 8 Bryan Kearney 2015-03-01 22:34:17 UTC
Connecting redmine issue http://projects.theforeman.org/issues/7764 from this bug

Comment 11 Kedar Bidarkar 2015-03-09 09:22:34 UTC
It's now VERIFIED with sat6.1 Beta snap5

Upon creating an OSCAP policy we no longer have editing issues with the above said entities.

Comment 12 Steve Loranz 2015-03-11 22:14:06 UTC
Upstream bug assigned to szadok

Comment 13 Bryan Kearney 2015-08-11 13:21:18 UTC
This bug is slated to be released with Satellite 6.1.

Comment 14 errata-xmlrpc 2015-08-12 05:26:58 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-2015:1592