Project

General

Profile

Actions

Feature #17228

closed

Allow selecting a template used as global default for each kind

Added by Marek Hulán about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Templates
Target version:
Fixed in Releases:
Found in Releases:

Description

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

Description of problem:
The 'PXELinux global default' is silently overwritten by the ugprade process.

[crash] root@li-lc-1578:~# hammer -c/opt/hoici/etc/sat6/hammer-hoici.yaml template dump --name='PXELinux global default'
empty

running a seed tasks e.g. from installer

[crash] root@li-lc-1578:~# satellite-installer --scenario=satellite --verbose --upgrade
[ INFO 2016-10-05 13:28:32 verbose] Executing hooks in group pre_migrations
[ INFO 2016-10-05 13:28:32 verbose] All hooks in group pre_migrations finished
[ INFO 2016-10-05 13:28:32 verbose] Executing hooks in group boot
[ INFO 2016-10-05 13:28:32 verbose] All hooks in group boot finished
.....
Upgrade Step: db_seed...
[ INFO 2016-10-05 13:34:27 verbose] Upgrade Step: db_seed...
Seeding /usr/share/foreman/db/seeds.d/03-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/03-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/03-roles.rb
Seeding /usr/share/foreman/db/seeds.d/04-admin.rb
Seeding /usr/share/foreman/db/seeds.d/05-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/06-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/07-provisioning_templates.rb       <-------------
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/101-locations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/102-organizations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/103-provisioning_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/104-proxy.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/106-mail_notifications.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/107-enable_dynflow.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/108-ensure_sync_notification.rb
Seeding /usr/share/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/15-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/16-mail_notifications.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-1.0.13/db/seeds.d/200-update-insights-roles.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_bootdisk-6.1.0.3/db/seeds.d/50-bootdisk_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/db/seeds.d/50_discovery_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/db/seeds.d/60-dynflow_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-0.3.0.12/db/seeds.d/60-ssh_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/db/seeds.d/60_discovery_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-0.3.0.12/db/seeds.d/70-job_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/db/seeds.d/75-job_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-0.3.0.12/db/seeds.d/90-bookmarks.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.28/db/seeds.d/990 - provisioning_templates.rb
....
[crash] root@li-lc-1578:~# hammer -c/opt/hoici/etc/sat6/hammer-hoici.yaml template dump --name='PXELinux global default'
<%#
kind: PXELinux
name: PXELinux global default
%>

<%# This template has special name (do not change it) and it is used for booting unknown hosts. %>

DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
     MENU LABEL (local)
     MENU DEFAULT
     LOCALBOOT 0

LABEL discovery
     MENU LABEL (discovery)
     KERNEL boot/fdi-image-rhel_7-vmlinuz
     APPEND initrd=boot/fdi-image-rhel_7-img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://SATELLITE_CAPSULE_URL:9090 proxy.type=proxy
     IPAPPEND 2

<% for profile in @profiles -%>
LABEL <%= "#{profile[:template]} - #{profile[:hostgroup]}" %>
     KERNEL <%= profile[:hostgroup].operatingsystem.kernel(profile[:hostgroup].architecture) %>
<% case profile[:hostgroup].operatingsystem.pxe_type -%>
<% when 'kickstart' -%>
     APPEND initrd=<%= profile[:hostgroup].operatingsystem.initrd(profile[:hostgroup].architecture) %> ks=<%= default_template_url(profile[:template], profile[:hostgroup]) %> ksdevice=bootif network kssendmac
<% when 'preseed' -%>
     APPEND initrd=<%= profile[:hostgroup].operatingsystem.initrd(profile[:hostgroup].architecture) %> interface=auto url=<%= default_template_url(profile[:template], profile[:hostgroup]) %> ramdisk_size=10800 root=/dev/rd/0 rw auto hostname=unassigned-hostname locale=<%= profile[:hostgroup].params['lang'] || 'en_US' %> console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA
<% end -%>

<% end -%>

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

Reproducible with Foreman 1.13 and nightly

How reproducible:

Always

Steps to Reproduce:
1. Edit the 'PXELinux global default'
2. Dump the 'PXELinux global default' on the console
hammer template dump --name='PXELinux global default'
3. Run rake db:seed
4. Dump the 'PXELinux global default' on the console
hammer template dump --name='PXELinux global default'

Actual results:
Content is changed to the default

Expected results:
- Upgrade process shall have logging and history appending when it overwrites content
- User can choose what template will be used as PXELinux global default (the same for other kinds) so its modified version can be kept separately and still being used.

Additional info:

There is a code that checks audit records for template but it only verifies if name was changed. The name of global templates are hardcoded so users can't just clone the default template and add custom modifications because such clone would not be deployable. Therefore we should allow user to change the hardcoded names.
We should probably also add audit log if content has changed so user can revert.


Related issues 2 (1 open1 closed)

Related to Foreman - Feature #7484: Per-subnet PXELinux global default filesNew09/17/2014Actions
Related to Foreman - Bug #19677: Unable to edit localboot templatesClosedOndřej Pražák05/26/2017Actions
Actions #1

Updated by Marek Hulán about 8 years ago

  • Subject changed from Allow selecting a template used as global default for each kind to Allow selecting a template used as global default for each kind
  • Category changed from TFTP to Settings
  • Target version set to 115
Actions #2

Updated by Dominic Cleal about 8 years ago

  • Related to Feature #7484: Per-subnet PXELinux global default files added
Actions #3

Updated by Dominic Cleal about 8 years ago

The text of this ticket is reporting a bug about how templates are being changed on seed, which is likely introduced by #15416, but the title doesn't match. They should probably be filed separately, as the seed issue appears valid (settings/changing the template is related to #7484).

Actions #4

Updated by Marek Hulán about 8 years ago

That was intentional. The text of the ticket gives background why we need to make the name of template configurable, hence the ticket subject. I think changing of the template was intentional, so this ticket does not aim to change that behavior. The #7484 asks for global template per subnet which I think is advanced and even conflicts with global template functionality.

Actions #5

Updated by Marek Hulán about 8 years ago

  • Target version changed from 115 to 1.4.4
Actions #6

Updated by Marek Hulán almost 8 years ago

  • Target version changed from 1.4.4 to 1.10.1
Actions #7

Updated by Marek Hulán almost 8 years ago

  • Target version changed from 1.10.1 to 1.10.2
Actions #8

Updated by Marek Hulán almost 8 years ago

  • Target version changed from 1.10.2 to 1.11.2
Actions #9

Updated by Ondřej Pražák almost 8 years ago

  • Assignee set to Ondřej Pražák
Actions #10

Updated by Marek Hulán almost 8 years ago

  • Target version changed from 1.11.2 to 1.11.4
Actions #11

Updated by The Foreman Bot almost 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4283 added
Actions #12

Updated by Marek Hulán almost 8 years ago

  • Target version changed from 1.11.4 to 1.12.1
Actions #13

Updated by Anonymous almost 8 years ago

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

Updated by Dominic Cleal almost 8 years ago

  • Tracker changed from Bug to Feature
  • Category changed from Settings to Templates
  • Translation missing: en.field_release set to 209
Actions #15

Updated by The Foreman Bot over 7 years ago

  • Pull request https://github.com/theforeman/foreman/pull/4331 added
Actions #16

Updated by Dominic Cleal over 7 years ago

  • Related to Bug #19677: Unable to edit localboot templates added
Actions

Also available in: Atom PDF