Skip to content

Commit 0e642bd

Browse files
committed
Remove puts and fix bug
1 parent e89eb6e commit 0e642bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/msf/core/modules/metadata/store.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ def load_metadata
4040
@module_metadata_cache = @store.transaction(true) { @store[:module_metadata]}
4141
validate_data(copied) if (!@module_metadata_cache.nil? && @module_metadata_cache.size > 0)
4242
@module_metadata_cache = {} if @module_metadata_cache.nil?
43-
puts "module size #{@module_metadata_cache.size}"
44-
rescue
43+
rescue Exception => e
4544
retries +=1
4645

4746
# Try to handle the scenario where the file is corrupted
4847
if (retries < 2 && ::File.exist?(@path_to_user_metadata))
4948
FileUtils.remove(@path_to_user_metadata, true)
5049
retry
5150
else
52-
@console.print_warning('Unable to load module metadata')
51+
@console.print_warning("Unable to load module metadata: #{e.message}")
5352
end
5453
end
5554

@@ -71,20 +70,20 @@ def validate_data(copied)
7170
def configure_user_store
7271
copied = false
7372
@path_to_user_metadata = ::File.join(Msf::Config.config_directory, UserMetaDataFile)
74-
@path_to_base_metadata = ::File.join(Msf::Config.install_root, "db", BaseMetaDataFile)
73+
path_to_base_metadata = ::File.join(Msf::Config.install_root, "db", BaseMetaDataFile)
7574

7675
if (!::File.exist?(path_to_base_metadata))
7776
wlog("Missing base module metadata file: #{path_to_base_metadata}")
7877
else
7978
if (!::File.exist?(@path_to_user_metadata))
80-
FileUtils.cp(@path_to_base_metadata, @path_to_user_metadata)
79+
FileUtils.cp(path_to_base_metadata, @path_to_user_metadata)
8180
copied = true
8281
dlog('Created user based module store')
8382

8483
# Update the user based module store if an updated base file is created/pushed
8584
elsif (::File.mtime(path_to_base_metadata).to_i > ::File.mtime(@path_to_user_metadata).to_i)
8685
FileUtils.remove(@path_to_user_metadata, true)
87-
FileUtils.cp(@path_to_base_metadata, @path_to_user_metadata)
86+
FileUtils.cp(path_to_base_metadata, @path_to_user_metadata)
8887
copied = true
8988
dlog('Updated user based module store')
9089
end

0 commit comments

Comments
 (0)