Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1524131 - Importing invalid job templates shows undefined method `valid?' for nil:NilClass
Summary: Importing invalid job templates shows undefined method `valid?' for nil:NilClass
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Remote Execution
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-10 10:01 UTC by Nikhil Kathole
Modified: 2019-08-12 14:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-02-28 19:34:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot of UI (20.04 KB, image/png)
2017-12-10 10:01 UTC, Nikhil Kathole
no flags Details
log in production.log file (14.87 KB, text/plain)
2017-12-10 10:02 UTC, Nikhil Kathole
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21925 0 None None None 2017-12-11 11:41:23 UTC

Description Nikhil Kathole 2017-12-10 10:01:38 UTC
Created attachment 1365548 [details]
screenshot of UI

Description of problem: Attempting to import invalid job templates shows undefined method `valid?' for nil:NilClass and request completed 500 Internal Server Error.

Version-Release number of selected component (if applicable): Satellite 6.3 snap 27


How reproducible: always


Steps to Reproduce:
1. Navigate to host -> job templates
2. Try to import invalid job template file

Actual results:
UI showed Oops, we're sorry but something went wrong undefined method `valid?' for nil:NilClass and production.log showed

2017-12-10 04:52:04 afac570b [app] [I] Started POST "/job_templates/import" for IP at 2017-12-10 04:52:04 -0500
2017-12-10 04:52:04 afac570b [app] [I] Processing by JobTemplatesController#import as HTML
2017-12-10 04:52:04 afac570b [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"9jAVhNK3OGCUTWZ4Alru+kjX0FN5uFX/mA3PbwSsjm+6evu99DCEFJxd6
On3qHdBt/+ahUzoHT17ljC9AJnjBQ==", "imported_template"=>{"template"=>#<ActionDispatch::Http::UploadedFile:0x00000008328360 @tempfile=#<Tempfile:/tmp
/RackMultipart20171210-31078-4rxj7p.txt>, @original_filename="invalid_file.txt", @content_type="text/plain", @headers="Content-Disposition:
 form-data; name=\"imported_template[template]\"; filename=\"invalid_file.txt\"\r\nContent-Type: text/plain\r\n">, "overwrite"=>"0"}, "comm
it"=>"Submit"}
2017-12-10 04:52:05 afac570b [app] [I] Current user: admin (administrator)
2017-12-10 04:52:05 afac570b [app] [W] Action failed
 | NoMethodError: undefined method `valid?' for nil:NilClass
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.7/app/controllers/job_templates_controller.rb:38:in `import'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'


Expected results: Error should get handled.


Additional info:

Comment 1 Nikhil Kathole 2017-12-10 10:02:20 UTC
Created attachment 1365550 [details]
log in production.log file

Comment 3 Nikhil Kathole 2017-12-11 10:11:45 UTC
Hi,

Invalid job template can be test.erb without any data or having only data

<%#
name: example
%>
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') %>
<%= render_template('Package Action - SSH Default', :action => 'update-minimal', :package => advisories) %>

Comment 4 Adam Ruzicka 2017-12-11 11:41:21 UTC
Created redmine issue http://projects.theforeman.org/issues/21925 from this bug

Comment 5 Brad Buckingham 2017-12-12 18:43:12 UTC
Is this a regression from 6.2?

Comment 6 Nikhil Kathole 2017-12-13 11:18:14 UTC
No this is not a regression. Same issue with 6.2.12 as well.

Comment 8 Bryan Kearney 2019-02-07 12:09:19 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Red Hat Technical Support or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 9 Bryan Kearney 2019-02-28 19:34:58 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.


Note You need to log in before you can comment on or make changes to this bug.