[pkg-eucalyptus-commits] [euca2ools] 08/41: Make console output encoding configurable

Charles Plessy plessy at alioth.debian.org
Sat Oct 12 03:24:11 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository euca2ools.

commit 5a23f2916544a94eb0f3c72be1f362fe87621e1d
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Tue Jul 9 16:01:25 2013 -0700

    Make console output encoding configurable
    
    By default, euca-get-console-output will attempt to decode console
    output as UTF-8.  This is changeable with the --encoding option.
    
    Fixes TOOLS-349
---
 euca2ools/commands/euca/getconsoleoutput.py |    6 ++++--
 man/euca-get-console-output.1               |   13 +++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/euca2ools/commands/euca/getconsoleoutput.py b/euca2ools/commands/euca/getconsoleoutput.py
index 84c3ac4..eb5398f 100644
--- a/euca2ools/commands/euca/getconsoleoutput.py
+++ b/euca2ools/commands/euca/getconsoleoutput.py
@@ -48,13 +48,15 @@ class GetConsoleOutput(EucalyptusRequest):
                 obtain console output from (required)'''),
             Arg('-r', '--raw-console-output', action='store_true',
                 route_to=None,
-                help='Display raw output without escaping control characters')]
+                help='display raw output without escaping control characters'),
+            Arg('--encoding', route_to=None, default='utf-8', help='''character
+                encoding of the console output (default: utf-8)''')]
 
     def print_result(self, result):
         print result.get('instanceId', '')
         print result.get('timestamp', '')
         output = base64.b64decode(result.get('output', ''))
-        output = output.decode()
+        output = output.decode(self.args.get('encoding', 'utf-8'), 'replace')
         if not self.args['raw_console_output']:
             # Escape control characters
             for char, escape in CHAR_ESCAPES.iteritems():
diff --git a/man/euca-get-console-output.1 b/man/euca-get-console-output.1
index bba735e..6d08ef6 100644
--- a/man/euca-get-console-output.1
+++ b/man/euca-get-console-output.1
@@ -1,9 +1,10 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.40.12.
-.TH EUCA-GET-CONSOLE-OUTPUT "1" "May 2013" "euca2ools 3.0.0" "User Commands"
+.TH EUCA-GET-CONSOLE-OUTPUT "1" "July 2013" "euca2ools 3.0.0" "User Commands"
 .SH NAME
-euca-get-console-output \- Display information about regions
+euca-get-console-output \- Retrieve console output for the specified instance
 .SH SYNOPSIS
-euca\-get\-console\-output [\-r] [\-\-show\-empty\-fields]
+euca\-get\-console\-output [\-r] [\-\-encoding ENCODING]
+[\-\-show\-empty\-fields]
 [\-\-region USER at REGION | \fB\-U\fR URL] [\-I KEY_ID]
 [\-S KEY] [\-\-debug] [\-\-debugger] [\-\-version]
 [\-h]
@@ -18,7 +19,11 @@ ID of the instance to obtain console output from
 .SS "optional arguments:"
 .TP
 \fB\-r\fR, \fB\-\-raw\-console\-output\fR
-Display raw output without escaping control characters
+display raw output without escaping control characters
+.TP
+\fB\-\-encoding\fR ENCODING
+character encoding of the console output (default:
+utf\-8)
 .TP
 \fB\-\-show\-empty\-fields\fR
 show empty values as "(nil)"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-eucalyptus/euca2ools.git



More information about the pkg-eucalyptus-commits mailing list