@@ -125,7 +125,7 @@ def load_module(parent_path, type, module_reference_name, options={})
125
125
return false
126
126
end
127
127
128
- loaded = namespace_module_transaction ( type + "/" + module_reference_name , :reload => reload ) { |namespace_module |
128
+ try_eval_module = lambda { |namespace_module |
129
129
# set the parent_path so that the module can be reloaded with #load_module
130
130
namespace_module . parent_path = parent_path
131
131
@@ -173,29 +173,22 @@ def load_module(parent_path, type, module_reference_name, options={})
173
173
return false
174
174
end
175
175
176
- ilog ( "Loaded #{ type } module #{ module_reference_name } under #{ parent_path } " , 'core' , LEV_2 )
176
+ if reload
177
+ ilog ( "Reloading #{ type } module #{ module_reference_name } . Ambiguous module warnings are safe to ignore" , 'core' , LEV_2 )
178
+ else
179
+ ilog ( "Loaded #{ type } module #{ module_reference_name } under #{ parent_path } " , 'core' , LEV_2 )
180
+ end
177
181
178
182
module_manager . module_load_error_by_path . delete ( module_path )
179
183
180
184
true
181
185
}
182
186
187
+ loaded = namespace_module_transaction ( type + "/" + module_reference_name , :reload => reload , &try_eval_module )
183
188
unless loaded
184
189
return false
185
190
end
186
191
187
- if reload
188
- # Delete the original copy of the module so that module_manager.on_load_module called from inside load_module does
189
- # not trigger an ambiguous name warning, which would cause the reloaded module to not be stored in the
190
- # ModuleManager.
191
- module_manager . delete ( module_reference_name )
192
-
193
- # Delete the original copy of the module in the type-specific module set stores the reloaded module and doesn't
194
- # trigger an ambiguous name warning
195
- module_set = module_manager . module_set ( type )
196
- module_set . delete ( module_reference_name )
197
- end
198
-
199
192
# Do some processing on the loaded module to get it into the right associations
200
193
module_manager . on_module_load (
201
194
metasploit_class ,
0 commit comments