Project

General

Profile

Bug #5450

Kickstart Templates Don't Render FreeIPA Snippet correctly

Added by Stephen Benjamin about 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Category:
Templates
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

In order to have backward compatibility with earlier versions of Foreman, the template checks if `@host.respond_to? :otp`, but this doesn't work in safe mode, even after adding it to the Jail.

Associated revisions

Revision 77d9d699 (diff)
Added by Stephen Benjamin about 5 years ago

fixes #5450 - add realm to params for 1.4-compatible use in templates

Revision 03118084 (diff)
Added by Stephen Benjamin about 5 years ago

fixes #5450 - add realm to params for 1.4-compatible use in templates

(cherry picked from commit 77d9d699b32e735e4b70195e978de108a992d3f5)

History

#2 Updated by Stephen Benjamin about 5 years ago

@host.methods doesn't actually return all the available methods in the safe mode jail, which is why respond_to? doesn't work as expected. Anyway, we're stuck with identifying a Realm-capable foreman version using only the features 1.4. This simply will cause the template not to render on < 1.5:

<% if @host.otp && @host.realm && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>

The only way I see is to add something to 1.5 that lets us know we can do realms, but that still works on 1.4...so, as far as I can see, that means abusing an existing hash.

What about adding this to Host::Managed#info?

param["realm"] = realm.name if realm

Then:

<% if @host.params["realm"] && @host.otp && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>

#3 Updated by Stephen Benjamin about 5 years ago

  • Priority changed from Normal to High

Ah sorry, should be this, but same idea:

<% if @host.info["parameters"]["realm"] && @host.otp && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>

But anyway, as it stands in the RHEL KS template, the freeipa_snippet will never be reached because of the failing respond_to?

#5 Updated by Dominic Cleal about 5 years ago

  • Assignee set to Stephen Benjamin
  • Target version set to 1.8.3
  • Legacy Backlogs Release (now unused) set to 4

#6 Updated by Stephen Benjamin about 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF