From: David Galloway Date: Fri, 9 Mar 2018 21:51:25 +0000 (-0500) Subject: cobbler: Have rc.local output go to console X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de871c037f4ae227bed00933eee24f849a4551b0;p=ceph-cm-ansible.git cobbler: Have rc.local output go to console Usually if something goes wrong during the rc.local run, the machine won't be reachable to debug over the network. Additionally, since we reimage every machine before each job now, it's impossible to debug why rc.local failed given a particular job. This outputs rc.local to the tty specified in kernel_options so we can see the output in `$hostname_reimage` run logs. Signed-off-by: David Galloway --- diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index 71496622..438283d0 100644 --- a/roles/cobbler/templates/snippets/cephlab_rc_local +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -8,11 +8,16 @@ #else #set script = '/etc/rc.local' #end if +# Search for 'ttyS' in kernel_options and set $console accordingly +# so rc.local output gets sent to the proper tty +#import re +#set kernel_options = $getVar('kernel_options','ttyS1') +#set console = re.match('.*(ttyS\d+).*', $kernel_options).groups()[0] cat > $script <<\EOF #!/bin/bash -# First, redirect stderr and stdout to a logfile -exec 2> /tmp/rc.local.log +# Redirect rc.local output to our console so it's in teuthology console logs +exec 2> /dev/$console exec 1>&2 set -ex @@ -101,6 +106,7 @@ if [ -n "$myips" ]; then fi done fi +#end raw {% endif %} @@ -110,7 +116,6 @@ if command -v apt-get &>/dev/null; then dpkg-reconfigure openssh-server fi fi -#end raw # Only run once. if [ -e $lockfile ]; then @@ -125,7 +130,9 @@ do sleep 3 done # Output message to console indicating Ansible is being run +set +x echo -e "==================================\nInstructing Cobbler to run Ansible\n Waiting for completion\n==================================" > /dev/console +set -x # Run the post-install trigger a second time wget --timeout=1800 -t1 -O /dev/null "http://$http_server:$http_port/cblr/svc/op/trig/mode/post/system/$system_name" || true touch $lockfile