Project

General

Profile

Bug #32004

Use-ntp parameter does not work when provisioning RHEL 7 or CentOS 7

Added by Oleh Fedorenko 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1932369

Description of problem:
The 'Kickstart default' and 'ntp' templates accept the 'use-ntp' parameter to support the ability to disable NTP and use CHRONY.

However, the code in both templates is broken. Both templates have this line:
use_ntp = host_param_true?('use-ntp') || (is_fedora && os_major < 16) || (rhel_compatible && os_major <= 7)

However, setting use-ntp=false will never work "because of the default os check. os_major is <=7 which will always match for centos 7/rhel 7", which has been previously identified in the Foreman forum (ref. https://community.theforeman.org/t/use-ntp-parameter-does-not-work-when-provisioning-centos7/15763) and issue tracker (ref. https://projects.theforeman.org/issues/28077).
The suggested fix at the time was not accepted.

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

How reproducible:

Steps to Reproduce:
1. Set the host (group) or global boolean parameter use-ntp to false.
2. Open the 'Kickstart default' provisioning template and select Preview.
3. Review %package and %post section relating to ntp.

Actual results:
The ntp package is installed and configured. chrony is not installed.

Expected results:
chrony is used instead of ntp when use-ntp=false

Additional info:

The following working patch for the 'use_ntp = ...' line is:

if host_param_true?('use-ntp') || host_param_false?('use-ntp')
use_ntp = host_param('use-ntp')
else
use_ntp = (is_fedora && os_major < 16) || (rhel_compatible && os_major <= 7)
end

Associated revisions

Revision 55e31a60 (diff)
Added by Oleh Fedorenko 5 months ago

Fixes #32004 - Don't ignore use-ntp host param in prov templates

Setting use-ntp=false will never work due to short circuit evaluation
of boolean expressions in templates. This patch should make use-ntp
parameter be honored if set to false.

History

#1 Updated by Oleh Fedorenko 7 months ago

  • Assignee set to Oleh Fedorenko
  • Status changed from New to Assigned
  • Category changed from TFTP to Templates

#2 Updated by The Foreman Bot 7 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8365 added

#3 Updated by The Foreman Bot 5 months ago

  • Fixed in Releases 2.5.0 added

#4 Updated by Oleh Fedorenko 5 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF