change permissons to use octal for rest of file

This commit is contained in:
Shan Sikdar
2020-04-05 10:50:58 -04:00
parent 70c643f8de
commit f56a12a1ab
+5 -5
View File
@@ -190,7 +190,7 @@ def findiso( flavor ):
raise Exception( 'findiso: could not download iso from ' + url ) raise Exception( 'findiso: could not download iso from ' + url )
# Write-protect iso, signaling it is complete # Write-protect iso, signaling it is complete
log( '* Write-protecting iso', iso) log( '* Write-protecting iso', iso)
os.chmod( iso, 0444 ) os.chmod( iso, 0o444 )
log( '* Using iso', iso ) log( '* Using iso', iso )
return iso return iso
@@ -222,7 +222,7 @@ def extractKernel( image, flavor, imageDir=VMImageDir ):
"Extract kernel and initrd from base image" "Extract kernel and initrd from base image"
kernel = path.join( imageDir, flavor + '-vmlinuz' ) kernel = path.join( imageDir, flavor + '-vmlinuz' )
initrd = path.join( imageDir, flavor + '-initrd' ) initrd = path.join( imageDir, flavor + '-initrd' )
if path.exists( kernel ) and ( stat( image )[ ST_MODE ] & 0777 ) == 0444: if path.exists( kernel ) and ( stat( image )[ ST_MODE ] & 0o777 ) == 0o444:
# If kernel is there, then initrd should also be there # If kernel is there, then initrd should also be there
return kernel, initrd return kernel, initrd
log( '* Extracting kernel to', kernel ) log( '* Extracting kernel to', kernel )
@@ -252,8 +252,8 @@ def findBaseImage( flavor, size='8G' ):
image = path.join( VMImageDir, flavor + '-base.qcow2' ) image = path.join( VMImageDir, flavor + '-base.qcow2' )
if path.exists( image ): if path.exists( image ):
# Detect race condition with multiple builds # Detect race condition with multiple builds
perms = stat( image )[ ST_MODE ] & 0777 perms = stat( image )[ ST_MODE ] & 0o777
if perms != 0444: if perms != 0o444:
raise Exception( 'Error - base image %s is writable.' % image + raise Exception( 'Error - base image %s is writable.' % image +
' Are multiple builds running? if not,' ' Are multiple builds running? if not,'
' remove %s and try again.' % image ) ' remove %s and try again.' % image )
@@ -266,7 +266,7 @@ def findBaseImage( flavor, size='8G' ):
installUbuntu( iso, image ) installUbuntu( iso, image )
# Write-protect image, also signaling it is complete # Write-protect image, also signaling it is complete
log( '* Write-protecting image', image) log( '* Write-protecting image', image)
os.chmod( image, 0444 ) os.chmod( image, 0o444 )
kernel, initrd = extractKernel( image, flavor ) kernel, initrd = extractKernel( image, flavor )
log( '* Using base image', image, 'and kernel', kernel ) log( '* Using base image', image, 'and kernel', kernel )
return image, kernel, initrd return image, kernel, initrd