Improve run_remote_puppet logging output

For one, replace puppet agent --test with a slightly less verbose
version that does not return strange error codes. Then update the
script to log things a little more readably.

Change-Id: Ib95edc59020d443ee83a04bdf19430f5c56196ec
This commit is contained in:
Monty Taylor 2014-04-17 14:29:16 -07:00
parent 72448a0327
commit 7fc500dcaf
3 changed files with 15 additions and 4 deletions

View File

@ -70,7 +70,7 @@ class openstack_project::base(
} }
} }
ssh_authorized_key { '/root/.ssh/authorized_keys': ssh_authorized_key { 'puppet-remote-2014-04-17':
ensure => present, ensure => present,
user => 'root', user => 'root',
type => 'ssh-rsa', type => 'ssh-rsa',
@ -81,6 +81,10 @@ class openstack_project::base(
], ],
require => File['/root/.ssh'], require => File['/root/.ssh'],
} }
ssh_authorized_key { '/root/.ssh/authorized_keys':
ensure => absent,
user => 'root',
}
# Use upstream puppet and pin to version 2.7.* # Use upstream puppet and pin to version 2.7.*
if ($::osfamily == 'Debian') { if ($::osfamily == 'Debian') {

View File

@ -18,5 +18,5 @@ class openstack_project::params {
fail("Unsupported osfamily: ${::osfamily} The 'openstack_project' module only supports osfamily Debian or RedHat (slaves only).") fail("Unsupported osfamily: ${::osfamily} The 'openstack_project' module only supports osfamily Debian or RedHat (slaves only).")
} }
} }
$allowed_ssh_command = 'timeout -s 9 30m puppet agent --test' $allowed_ssh_command = 'timeout -s 9 30m puppet agent --onetime --ignorecache --no-daemonize --no-usecacheonfailure --no-splay'
} }

View File

@ -16,8 +16,15 @@
# This function will properly fail if puppet is disabled on the target host # This function will properly fail if puppet is disabled on the target host
function run_ssh { function run_ssh {
echo ssh -o StrictHostKeyChecking=no root@$1 <%= scope.lookupvar('openstack_project::params::allowed_ssh_command') %> echo ssh root@$1 <%= scope.lookupvar('openstack_project::params::allowed_ssh_command') %>
ssh -o StrictHostKeyChecking=no root@$1 <%= scope.lookupvar('openstack_project::params::allowed_ssh_command') %> ssh -o StrictHostKeyChecking=no root@$1 <%= scope.lookupvar('openstack_project::params::allowed_ssh_command') %> >/dev/null
ret=$?
if [ $ret == 124 ] ; then
echo "puppet on $1 timed out"
elif [ $ret != 0 ] ; then
echo "puppet on $1 failed with return code: $ret"
fi
return $ret
} }
export -f run_ssh export -f run_ssh