← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/loggers-fix into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/loggers-fix into lp:cloud-init.

Commit message:
Check for running inside RHEL and adjust the logging options.

It seems like at least RHEL does not have the "--stderr" option
but instead only supports the short version "-s" so add a check
that will switch from the long version to the short version when
RHEL is detected.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1083715 in cloud-init: "Better key handling + logger messages"
  https://bugs.launchpad.net/cloud-init/+bug/1083715

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/loggers-fix/+merge/136754
-- 
https://code.launchpad.net/~harlowja/cloud-init/loggers-fix/+merge/136754
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/loggers-fix into lp:cloud-init.
=== modified file 'tools/write-ssh-key-fingerprints'
--- tools/write-ssh-key-fingerprints	2012-09-24 18:48:44 +0000
+++ tools/write-ssh-key-fingerprints	2012-11-28 18:47:22 +0000
@@ -1,5 +1,18 @@
 #!/bin/sh
+
+logger_opts="-p user.info -t ec2"
+
+if [ -f "/etc/redhat-release" ]
+then
+    # Seems like rhel only supports the short version
+    logger_opts="$logger_opts -s"
+else
+    logger_opts="$logger_opts --stderr"
+fi
+
+# Redirect stderr to stdout
 exec 2>&1
+
 fp_blist=",${1},"
 key_blist=",${2},"
 {
@@ -16,9 +29,9 @@
 echo "-----END SSH HOST KEY FINGERPRINTS-----"
 echo "#############################################################"
 
-} | logger -p user.info --stderr -t "ec2"
+} | logger $logger_opts
 
-echo -----BEGIN SSH HOST KEY KEYS-----
+echo "-----BEGIN SSH HOST KEY KEYS-----"
 for f in /etc/ssh/ssh_host_*key.pub; do
     [ -f "$f" ] || continue
     read ktype line < "$f"
@@ -26,4 +39,4 @@
     [ "${key_blist#*,$ktype,}" = "${key_blist}" ] || continue
     cat $f
 done
-echo -----END SSH HOST KEY KEYS-----
+echo "-----END SSH HOST KEY KEYS-----"


Follow ups