diff --git a/src/modules/testmodule.py b/src/modules/testmodule.py index 008f47719..5de9bdcac 100755 --- a/src/modules/testmodule.py +++ b/src/modules/testmodule.py @@ -29,7 +29,7 @@ class Job: self.workingPath = workingPath self.configuration = doc[ "configuration" ] -# Usage: ./testmodule.py +# Usage: ./testmodule.py [global_storage yaml file] def main( args ): moduledirpath = os.path.abspath( sys.argv[ 2 ] ) print( "Importing libcalamares from: " + libcalamares.__file__ ) @@ -47,6 +47,12 @@ def main( args ): libcalamares.__dict__[ "job" ] = Job( moduledirpath, doc ) libcalamares.__dict__[ "global_storage" ] = libcalamares.GlobalStorage() + # if a file for simulating global_storage contents is provided, load it + if len( sys.argv ) > 3: + doc = yaml.load( open( os.path.abspath( sys.argv[ 3 ] ), 'r' ) ) + for key, value in doc.items(): + libcalamares.global_storage.insert( key, value ) + scriptpath = os.path.abspath( moduledirpath ) sys.path.append( scriptpath ) import main