diff options
-rw-r--r-- | sos/plugins/__init__.py | 12 | ||||
-rw-r--r-- | sos/plugins/jars.py | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 46f9cb83..5286e4b5 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -671,7 +671,11 @@ class Plugin(object): def add_string_as_file(self, content, filename): """Add a string to the archive as a file named `filename`""" self.copy_strings.append((content, filename)) - content = "..." + (content.splitlines()[0]).decode('utf8', 'ignore') + if isinstance(content, six.string_types): + content = "..." + content.splitlines()[0] + else: + content = ("..." + + (content.splitlines()[0]).decode('utf8', 'ignore')) self._log_debug("added string '%s' as '%s'" % (content, filename)) def get_cmd_output_now(self, exe, suggest_filename=None, @@ -824,7 +828,11 @@ class Plugin(object): def _collect_strings(self): for string, file_name in self.copy_strings: content = "..." - content += (string.splitlines()[0]).decode('utf8', 'ignore') + if isinstance(string, six.string_types): + content = "..." + content.splitlines()[0] + else: + content = ("..." + + (content.splitlines()[0]).decode('utf8', 'ignore')) self._log_info("collecting string '%s' as '%s'" % (content, file_name)) try: diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py index fd879139..6c15eff3 100644 --- a/sos/plugins/jars.py +++ b/sos/plugins/jars.py @@ -113,7 +113,9 @@ class Jars(Plugin, RedHatPlugin): if not line.startswith(b"#"): try: (key, value) = line.split(b"=") - props[key.strip()] = value.strip() + key = key.decode('utf8').strip() + value = value.decode('utf8').strip() + props[key] = value except ValueError: return None except IOError: |