Bug 2032051

Summary: Editing Azure Host from satellite failed with 'undefined method `ends_with?'
Product: Red Hat Satellite Reporter: matt jia <mjia>
Component: Compute Resources - AzureAssignee: satellite6-bugs <satellite6-bugs>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.9.7CC: oezr
Target Milestone: UnspecifiedKeywords: Triaged
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: 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 matt jia 2021-12-13 22:57:03 UTC
Description of problem:

Here is the error traceback:

2021-12-08T10:46:03 [I|app|62b6d580]   Rendered hosts/edit.html.erb within layouts/application (Duration: 20352.3ms | Allocations: 1507368)
2021-12-08T10:46:03 [W|app|62b6d580] undefined method `ends_with?' for nil:NilClass
2021-12-08T10:46:03 [I|app|62b6d580] Backtrace for 'undefined method `ends_with?' for nil:NilClass' error (ActionView::Template::Error): undefined method `ends_with?' for nil:NilClass
 62b6d580 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.1.3/app/models/foreman_azure_rm/azure_rm_compute.rb:214:in `script_command'
 62b6d580 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb:41:in `public_send'
 62b6d580 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb:41:in `value'


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

6.9


How reproducible:

Easy


Steps to Reproduce:
1. deploy a new vm to Azure in Satellite
2. Hosts-->All Hosts-->Edit Host

Actual results:

undefined method `ends_with?' for nil:NilClass


Expected results:

Can edit the host

Additional info:

Comment 1 matt jia 2021-12-13 22:59:25 UTC
This seems to have been fixed in the upstream:

https://github.com/theforeman/foreman_azure_rm/blob/master/app/models/foreman_azure_rm/azure_rm_compute.rb#L219

Request to backport it to 6.9 and 6.10.

Comment 2 Ondřej Ezr 2022-02-01 12:15:18 UTC
Created redmine issue https://projects.theforeman.org/issues/34361 from this bug