Skip to content

Commit

Permalink
Fix is to consistently backup at <hostname>/data/
Browse files Browse the repository at this point in the history
1)cassandra backup location needs to be consistent even in case of the custom
  data_file_directories configured in cassandra.yaml
2)replace_key routine was replacing all the matches of the skip_key
3)fix added to replace only the exact match

Change-Id: If0e90ac0ce248b06b7748a568ede3fcc13ac264e
Closes-Bug: #1566022
Closes-Bug: #1567067
  • Loading branch information
aswanikumar90 committed Apr 7, 2016
1 parent 8b5b94c commit 486ace9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fabfile/tasks/backup_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def backup_cassandra(db_datas, store_db='local', cassandra_backup='full'):
snapshot_dirs = sudo("find %s/ -name 'snapshots' " % db_path)
snapshot_dirs = snapshot_dirs.split('\r\n')
#get relative path to cassandra from db_path
path_to_cassandra = re.search('.*/cassandra/',db_path).group(0)
path_to_cassandra, data_dir = os.path.split(db_path)
while data_dir == '':
path_to_cassandra, data_dir = os.path.split(path_to_cassandra)
path_to_cassandra += '/'
for snapshot_dir in snapshot_dirs:
snapshot_list.append(snapshot_dir.replace(path_to_cassandra,''))
#get current snap_shot name from any snapshots folder created by nodetool
Expand Down Expand Up @@ -1037,6 +1040,6 @@ def ssh_key_gen():

def replace_key(text, skip_key):
for key in skip_key:
text = text.replace(key, "")
text=re.sub('\\b'+key+'\\b','',text)
return text
# end replace_kespace_for_custom_cassandra_snapshot

0 comments on commit 486ace9

Please sign in to comment.