From 13b7362494c4c0ff3c5ce80b8e7ee7fe64d65785 Mon Sep 17 00:00:00 2001 From: Stefania Alborghetti Date: Thu, 20 Oct 2016 10:06:50 +0800 Subject: [PATCH] Avoid potential AttributeError in cqlsh due to no table metadata Patch by Stefania Alborghetti; reviewed by Robert Stupp for CASSANDRA-12815 --- CHANGES.txt | 1 + bin/cqlsh.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d1f2677de5..ef728c768d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.10 + * Avoid potential AttributeError in cqlsh due to no table metadata (CASSANDRA-12815) * Fix RandomReplicationAwareTokenAllocatorTest.testExistingCluster (CASSANDRA-12812) * Upgrade commons-codec to 1.9 (CASSANDRA-12790) * Make the fanout size for LeveledCompactionStrategy to be configurable (CASSANDRA-11550) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index e741752571..072ef0844a 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -1334,7 +1334,8 @@ class Shell(cmd.Cmd): cql_types = [] if result.column_types: - ks_meta = self.conn.metadata.keyspaces[table_meta.keyspace_name] + ks_name = table_meta.keyspace_name if table_meta else self.current_keyspace + ks_meta = self.conn.metadata.keyspaces.get(ks_name, None) cql_types = [CqlType(cql_typename(t), ks_meta) for t in result.column_types] formatted_values = [map(self.myformat_value, row.values(), cql_types) for row in result.current_rows]