Correctly report exit status from Python modules.

This commit is contained in:
Teo Mrnjavac 2014-07-28 17:03:22 +02:00
parent 87ee2b8b8c
commit 4fc2efb7fa
5 changed files with 14 additions and 9 deletions

View file

@ -41,5 +41,4 @@ def run():
+ str( libcalamares.globalStorage.value( "item3" ) ) + "\n"
libcalamares.job.setprogress( 0.1 )
return accumulator
return ( "", accumulator )

View file

@ -77,4 +77,4 @@ def run():
installGrub( rootMountPoint, bootLoader )
finally:
umountPartitions( rootMountPoint, extraMounts )
return "All done"
return None

View file

@ -61,4 +61,4 @@ def run():
mountPartitions( rootMountPoint, libcalamares.globalStorage.value( "partitions" ) )
libcalamares.globalStorage.insert( "rootMountPoint", rootMountPoint )
return "All done, mounted at {}".format( rootMountPoint )
return None

View file

@ -35,9 +35,9 @@ def listMounts( rootMountPoint ):
def run():
rootMountPoint = libcalamares.globalStorage.value( "rootMountPoint" )
if not rootMountPoint:
return "GlobalStorage does not contain a \"rootMountPoint\" key, doing nothing"
return ( "No mount point for root partition in GlobalStorage", "GlobalStorage does not contain a \"rootMountPoint\" key, doing nothing" )
if not os.path.exists( rootMountPoint ):
return "GlobalStorage[\"rootMountPoint\"] is \"{}\", which does not exist, doing nothing".format( rootMountPoint )
return ( "Bad mount point for root partition in GlobalStorage", "GlobalStorage[\"rootMountPoint\"] is \"{}\", which does not exist, doing nothing".format( rootMountPoint ) )
lst = listMounts( rootMountPoint )
# Sort the list by mount point in decreasing order. This way we can be sure
@ -48,4 +48,4 @@ def run():
subprocess.check_call( [ "umount", mountPoint ] )
os.rmdir( rootMountPoint )
return "All done"
return None

View file

@ -106,7 +106,12 @@ def run():
# destination: ""
rootMountPoint = globalStorage.value( "rootMountPoint" )
if not rootMountPoint:
return ( "No mount point for root partition in GlobalStorage",
"GlobalStorage does not contain a \"rootMountPoint\" key, doing nothing" )
if not os.path.exists( rootMountPoint ):
return ( "Bad mount point for root partition in GlobalStorage",
"GlobalStorage[\"rootMountPoint\"] is \"{}\", which does not exist, doing nothing".format( rootMountPoint ) )
unpack = list()
for entry in job.configuration[ "unpack" ]:
@ -114,7 +119,8 @@ def run():
destination = os.path.abspath( os.path.join( rootMountPoint, entry[ "destination" ] ) )
if not os.path.isfile( source ) or not os.path.isdir( destination ):
return "Error: bad source or destination"
return ( "Bad source or destination",
"source=\"{}\"\ndestination=\"{}\"".format( source, destination ) )
unpack.append( UnpackEntry( source, destination ) )