You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/08/07 22:31:30 UTC

cassandra git commit: cqlsh: Avoid overwriting config with old config

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 4d1b8b418 -> 34193ee76


cqlsh: Avoid overwriting config with old config

Patch by David Kua; reviewed by Tyler Hobbs for CASSANDRA-9777


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/34193ee7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/34193ee7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/34193ee7

Branch: refs/heads/cassandra-2.1
Commit: 34193ee7666a7521922993ed41407c61832822d0
Parents: 4d1b8b4
Author: David Kua <da...@kua.io>
Authored: Fri Aug 7 15:30:59 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri Aug 7 15:30:59 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt | 2 ++
 bin/cqlsh   | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/34193ee7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 781b60e..c4409c1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.1.9
+ * (cqlsh) Avoid overwriting new config file with old config
+   when both exist (CASSANDRA-9777)
  * Release snapshot selfRef when doing snapshot repair (CASSANDRA-9998)
  * Cannot replace token does not exist - DN node removed as Fat Client (CASSANDRA-9871)
  * Fix handling of enable/disable autocompaction (CASSANDRA-9899)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/34193ee7/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 8f28a45..69b669d 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -196,7 +196,14 @@ if not os.path.exists(HISTORY_DIR):
 
 OLD_CONFIG_FILE = os.path.expanduser(os.path.join('~', '.cqlshrc'))
 if os.path.exists(OLD_CONFIG_FILE):
-    os.rename(OLD_CONFIG_FILE, CONFIG_FILE)
+    if os.path.exists(CONFIG_FILE):
+        print '\nWarning: cqlshrc config files were found at both the old location (%s) and \
+               the new location (%s), the old config file will not be migrated to the new \
+               location, and the new location will be used for now.  You should manually \
+               consolidate the config files at the new location and remove the old file.' \
+               % (OLD_CONFIG_FILE, CONFIG_FILE)
+    else:
+        os.rename(OLD_CONFIG_FILE, CONFIG_FILE)
 OLD_HISTORY = os.path.expanduser(os.path.join('~', '.cqlsh_history'))
 if os.path.exists(OLD_HISTORY):
     os.rename(OLD_HISTORY, HISTORY)