Christian Setzer wrote:
http://debugs.theforeman.org/foreman-debug-HE3AB.tar.xz
since 2 two days im having trouble with provisioning templates. after install the userdata plugin which i want to use to setup my vmware images with cloud-init the problems started.
yesterday i had a similar issue with the templates which resulted in http://paste.ubuntu.com/26124761/
then i restored from backup yesterday evening and wanted to create a host today after installing the userdata plugin again.
now the status is whatever script i try to preview for a host i get
"There was an error rendering the Katello Kickstart Default User Data template: undefined method `path' for nil:NilClass"
even if there is only a #foo in it.
i now figured out that this only affects created hosts. if i check the userdata script for example for my katello server then there is no error in the script.
[root@katello-test ~]# curl -D - -H "Content-Type: text/plain" https://katello-test.inside.local/userdata/user-data
HTTP/1.1 200 OK
Date: Thu, 07 Dec 2017 08:48:12 GMT
Server: Apache/2.4.6 (CentOS)
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: b67a7a00-ca1c-47d3-b5c7-e57278af6fc9
X-Runtime: 0.555219
X-Powered-By: Phusion Passenger 4.0.53
Set-Cookie: _session_id=cd4ae1860b910366084eb851caa5bd84; path=/; secure; HttpOnly
ETag: W/"e2fe45e4484e80b2ab49f17b39bb4dea"
Status: 200 OK
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8
#cloud-config
hostname: katello-test
fqdn: katello-test.inside.local
manage_etc_hosts: true
groups:
- admin
users:
- default
- name: admin
primary-group: admin
groups: users
shell: /bin/bash
sudo: ['ALL=(ALL) ALL']
lock-passwd: false
passwd:
write_files:
- path: /tmp/foreman-userdata.sh
permissions: '0755'
content: |
#!/bin/bash
- update all the base packages from the updates repository
yum -t -y -e 0 update
if [ -f /usr/bin/dnf ]; then
dnf -y install puppet
else
yum -t -y install puppet
fi
cat > /etc/puppet/puppet.conf << EOF
[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = \$vardir/ssl
[agent]
pluginsync = true
report = true
ignoreschedules = true
ca_server = katello-test.inside.local
certname = katello-test.inside.local
environment = production
server = katello-test.inside.local
EOF
puppet_unit=puppet
/usr/bin/systemctl list-unit-files | grep -q puppetagent && puppet_unit=puppetagent
/usr/bin/systemctl enable ${puppet_unit}
/sbin/chkconfig --level 345 puppet on
- export a custom fact called 'is_installer' to allow detection of the installer environment in Puppet modules
export FACTER_is_installer=true
- passing a non-existent tag like "no_such_tag" to the puppet agent only initializes the node
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag --server katello-test.inside.local --no-daemonize
phone_home:
url: http://katello-test.inside.local/unattended/built
post: []
tries: 10
runcmd:
- [ cloud-init-per, once, foreman-userdata, /tmp/foreman-userdata.sh ]
output: {all: '| tee -a /root/install.userdata.log'}