Project

General

Profile

Actions

Bug #23803

open

template render doesnt match parameters sent to host

Added by Jeff Sparrow almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I am working on some of my first ubuntu deployments and I noticed a strange issue Ive never seen with templates before.
I am working with Community Preseed Default template and on the very last line, that informs foreman its built, the line looks like this:

d-i preseed/late_command string wget -Y off <%= @static ? "'#{foreman_url('finish')}&static=true'" : foreman_url('finish') %> -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh

However, when I render the template I see:

d-i preseed/late_command string wget -Y off http://puppet.lab.beer.town/unattended/finish -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh

This is what the debug looks like of it:

2018-06-04 09:27:24 43633e01 [app] [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"/Z48VujDs+zBwE3zqpc5VHn+9yncolKOkoiw6nayocdvLRHAAIq6B1iugyEmUCMgfvYv/z4kmQReshuBpC0gbA==", "provisioning_template"=>{"name"=>"Community Preseed default", "template"=>"<%#\r\nkind: provision\r\nname: Preseed default\r\noses:\r\n- Debian\r\n- Ubuntu\r\n%>\r\n<%\r\n # safemode renderer does not support unary negation\r\n pm_set = @host.puppetmaster.empty? ? false : true\r\n proxy_string = @host.params['http-proxy'] ? \" http://\#{@host.params['http-proxy']}:\#{@host.params['http-proxy-port']}\" : ''\r\n puppet_enabled = true\r\n salt_enabled = @host.params['salt_master'] ? true : false\r\n%>\r\n# Locale\r\nd-i debian-installer/locale string <%= @host.params['lang'] || 'en_US' %>\r\n# country and keyboard settings are automatic. Keep them ...\r\n# ... for wheezy and newer:\r\nd-i keyboard-configuration/xkb-keymap seen true\r\n# ... for squeeze and older:\r\nd-i console-keymaps-at/keymap seen true\r\n\r\n<% subnet = @host.subnet -%>\r\n<% if subnet.respond_to?(:dhcp_boot_mode?) -%>\r\n <% dhcp = subnet.dhcp_boot_mode? && !@static -%>\r\n<% else -%>\r\n <% dhcp = !@static -%>\r\n<% end -%>\r\n<% unless dhcp -%>\r\n# Static network configuration.\r\nd-i preseed/early_command string /bin/killall.sh; /bin/netcfg\r\nd-i netcfg/disable_autoconfig boolean true\r\nd-i netcfg/dhcp_failed note\r\nd-i netcfg/dhcp_options select Configure network manually\r\nd-i netcfg/disable_dhcp boolean true\r\nd-i netcfg/get_ipaddress string <%= @host.ip %>\r\nd-i netcfg/get_netmask string <%= subnet.mask %>\r\nd-i netcfg/get_nameservers string <%= [subnet.dns_primary,subnet.dns_secondary].reject{|n| n.blank?}.join(' ') %>\r\nd-i netcfg/get_gateway string <%= subnet.gateway %>\r\nd-i netcfg/confirm_static boolean true\r\n<% end -%>\r\n\r\n# Network configuration\r\nd-i netcfg/choose_interface select auto\r\nd-i netcfg/get_hostname string <%= @host %>\r\nd-i netcfg/get_domain string <%= @host.domain %>\r\nd-i netcfg/wireless_wep string\r\n\r\nd-i hw-detect/load_firmware boolean true\r\n\r\n# Mirror settings\r\nd-i mirror/country string manual\r\nd-i mirror/http/hostname string <%= @preseed_server %>\r\nd-i mirror/http/directory string <%= @preseed_path %>\r\nd-i mirror/http/proxy string<%= proxy_string %>\r\nd-i mirror/codename string <%= @host.operatingsystem.release_name %>\r\nd-i mirror/suite string <%= @host.operatingsystem.release_name %>\r\nd-i mirror/udeb/suite string <%= @host.operatingsystem.release_name %>\r\n\r\n# Time settings\r\nd-i clock-setup/utc boolean true\r\nd-i time/zone string <%= @host.params['time-zone'] || 'UTC' %>\r\n\r\n# NTP\r\nd-i clock-setup/ntp boolean true\r\nd-i clock-setup/ntp-server string <%= @host.params['ntp-server'] || '0.debian.pool.ntp.org' %>\r\n\r\n# Set alignment for automatic partitioning\r\n# Choices: cylinder, minimal, optimal\r\n#d-i partman/alignment select cylinder\r\n\r\n<%= @host.diskLayout %>\r\n\r\n# Install different kernel\r\n#d-i base-installer/kernel/image string linux-server\r\n\r\n# User settings\r\nd-i passwd/root-password-crypted password <%= root_pass %>\r\nuser-setup-udeb passwd/root-login boolean true\r\nd-i passwd passwd/make-user boolean false\r\nuser-setup-udeb passwd/make-user boolean false\r\n\r\n<% repos = 0 %>\r\n<% if puppet_enabled -%>\r\n<% if host_param_true?('enable-puppetlabs-repo') -%>\r\n# Puppetlabs products\r\nd-i apt-setup/local<%= repos %>/repository string \\\r\n http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> main\r\nd-i apt-setup/local<%= repos %>/comment string Puppetlabs products\r\nd-i apt-setup/local<%= repos %>/source boolean true\r\nd-i apt-setup/local<%= repos %>/key string http://apt.puppetlabs.com/pubkey.gpg\r\n<% repos += 1 -%>\r\n# Puppetlabs dependencies\r\nd-i apt-setup/local<%= repos %>/repository string \\\r\n http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> dependencies\r\nd-i apt-setup/local<%= repos %>/comment string Puppetlabs dependencies\r\nd-i apt-setup/local<%= repos %>/source boolean true\r\nd-i apt-setup/local<%= repos %>/key string http://apt.puppetlabs.com/pubkey.gpg\r\n<% repos += 1 -%>\r\n<% end -%>\r\n<% if host_param_true?('enable-puppetlabs-pc1-repo') -%>\r\n# Puppetlabs PC1 <%= @host.operatingsystem.release_name %> Repository\r\nd-i apt-setup/local<%= repos %>/repository string http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> PC1\r\nd-i apt-setup/local<%= repos %>/comment string Puppetlabs PC1 <%= @host.operatingsystem.release_name %> Repository\r\nd-i apt-setup/local<%= repos %>/source boolean true\r\nd-i apt-setup/local<%= repos %>/key string http://apt.puppetlabs.com/pubkey.gpg\r\n<% repos += 1 -%>\r\n<% end -%>\r\n<% end -%>\r\n\r\n<% if salt_enabled -%>\r\n<% salt_package = 'salt-minion' -%>\r\n<% if host_param_true?('enable-saltstack-repo') -%>\r\n<% if @host.operatingsystem.name 'Debian' -%>\r\nd-i apt-setup/local<%= repos %>/repository string http://debian.saltstack.com/debian <%= @host.operatingsystem.release_name %>-saltstack main\r\nd-i apt-setup/local<%= repos %>/comment string SaltStack Repository\r\nd-i apt-setup/local<%= repos %>/key string http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key\r\n<% repos += 1 -%>\r\n<% end -%>\r\n<% if @host.operatingsystem.name 'Ubuntu' ->\r\nd-i apt-setup/local<= repos >/repository string http://ppa.launchpad.net/saltstack/salt/ubuntu <= @host.operatingsystem.release_name > main\r\nd-i apt-setup/local<= repos >/comment string SaltStack Repository\r\nd-i apt-setup/local<= repos >/key string http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4759FA960E27C0A6\r\n< repos += 1 ->\r\n< end ->\r\n< end ->\r\n< else ->\r\n< salt_package = '' ->\r\n< end ->\r\n\r\n# Install minimal task set (see tasksel --task-packages minimal)\r\ntasksel tasksel/first multiselect minimal, ssh-server, openssh-server\r\n\r\n< if puppet_enabled >\r\n< puppet_package = host_param_true?('enable-puppetlabs-pc1-repo') ? 'puppet-agent' : 'puppet' ->\r\n< else ->\r\n< puppet_package = '' ->\r\n< end ->\r\n\r\n# Install some base packages\r\nd-i debian-installer/allow_unauthenticated boolean true\r\nd-i pkgsel/include string <= puppet_package > <= salt_package > lsb-release\r\nd-i pkgsel/update-policy select unattended-upgrades\r\n\r\npopularity-contest popularity-contest/participate boolean false\r\n\r\n# Boot loader settings\r\n#grub-pc grub-pc/hidden_timeout boolean false\r\n#grub-pc grub-pc/timeout string 10\r\nd-i grub-installer/only_debian boolean true\r\nd-i grub-installer/with_other_os boolean true\r\n< if @host.params['install-disk'] ->\r\nd-i grub-installer/bootdev string <= @host.params['install-disk'] >\r\n< elsif (@host.operatingsystem.name 'Debian' and @host.operatingsystem.major.to_i >= 8) or (@host.operatingsystem.name 'Ubuntu' and @host.operatingsystem.major.to_i >= 16) ->\r\nd-i grub-installer/bootdev string default\r\n< end ->\r\nd-i finish-install/reboot_in_progress note\r\n\r\nd-i preseed/late_command string wget -Y off <= @static ? \"'\#{foreman_url('finish')}&static=true'\" : foreman_url('finish') > -O /target/tmp/finish.sh &x%x in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh\r\n", "audit_comment"=>"", "snippet"=>"0", "template_kind_id"=>"4", "operatingsystem_ids"=>["", "41", "90"]}, "preview_host_id"=>"", "mode"=>"ruby", "keybinding"=>"Default", "commit"=>"Submit", "id"=>"134-Community Preseed default"}

This is what the host is getting:

Execution of preseeded command "wget -Y off 'http://puppet.lab.beer.town/unattended/finish&static=true' -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh" failed with exit code 8.

So my question is why does the finish&static=true show up on the host side, and not the render side?

No data to display

Actions

Also available in: Atom PDF