mirror of https://git.48k.eu/ogclient
src: fix whitespace in ogOperations.py
make whitespace conherent with the rest of the file contents.master
parent
5056b8f0d5
commit
c1529c5eec
|
@ -438,17 +438,17 @@ class OgLiveOperations:
|
||||||
padev = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_DEVICE)
|
padev = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_DEVICE)
|
||||||
fstype = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_FSTYPE)
|
fstype = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_FSTYPE)
|
||||||
if not fstype:
|
if not fstype:
|
||||||
logging.error('No filesystem detected. Aborting image creation.')
|
logging.error('No filesystem detected. Aborting image creation.')
|
||||||
raise ValueError('Target partition has no filesystem present')
|
raise ValueError('Target partition has no filesystem present')
|
||||||
|
|
||||||
cambiar_acceso(user=self._smb_user, pwd=self._smb_pass)
|
cambiar_acceso(user=self._smb_user, pwd=self._smb_pass)
|
||||||
|
|
||||||
if os.access(f'/opt/opengnsys/images', os.R_OK | os.W_OK) == False:
|
if os.access(f'/opt/opengnsys/images', os.R_OK | os.W_OK) == False:
|
||||||
logging.error('Cannot access /opt/opengnsys/images in read and write mode, check permissions')
|
logging.error('Cannot access /opt/opengnsys/images in read and write mode, check permissions')
|
||||||
raise ValueError('Cannot access image folder')
|
raise ValueError('Cannot access image folder')
|
||||||
|
|
||||||
if os.access(f'{image_path}', os.R_OK) == True:
|
if os.access(f'{image_path}', os.R_OK) == True:
|
||||||
logging.info(f'image file {image_path} already exists, updating.')
|
logging.info(f'image file {image_path} already exists, updating.')
|
||||||
|
|
||||||
ogCopyEfiBootLoader(disk, partition)
|
ogCopyEfiBootLoader(disk, partition)
|
||||||
ogReduceFs(disk, partition)
|
ogReduceFs(disk, partition)
|
||||||
|
@ -459,7 +459,7 @@ class OgLiveOperations:
|
||||||
logfile = open('/tmp/command.log', 'wb', 0)
|
logfile = open('/tmp/command.log', 'wb', 0)
|
||||||
|
|
||||||
if os.path.exists(image_path) and backup:
|
if os.path.exists(image_path) and backup:
|
||||||
shutil.move(image_path, f'{image_path}.ant')
|
shutil.move(image_path, f'{image_path}.ant')
|
||||||
|
|
||||||
p1 = Popen(cmd1, stdout=PIPE, stderr=logfile)
|
p1 = Popen(cmd1, stdout=PIPE, stderr=logfile)
|
||||||
p2 = Popen(cmd2, stdin=p1.stdout)
|
p2 = Popen(cmd2, stdin=p1.stdout)
|
||||||
|
@ -468,13 +468,13 @@ class OgLiveOperations:
|
||||||
logging.info(f'Running image creation process, please do not shut down or reboot the client')
|
logging.info(f'Running image creation process, please do not shut down or reboot the client')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
retdata = p2.communicate()
|
retdata = p2.communicate()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logging.exception('Unexpected error when running partclone and lzop commands')
|
logging.exception('Unexpected error when running partclone and lzop commands')
|
||||||
finally:
|
finally:
|
||||||
logfile.close()
|
logfile.close()
|
||||||
p2.terminate()
|
p2.terminate()
|
||||||
p1.poll()
|
p1.poll()
|
||||||
|
|
||||||
logging.info(f'partclone process exited with code {p1.returncode}')
|
logging.info(f'partclone process exited with code {p1.returncode}')
|
||||||
logging.info(f'lzop process exited with code {p2.returncode}')
|
logging.info(f'lzop process exited with code {p2.returncode}')
|
||||||
|
@ -482,8 +482,8 @@ class OgLiveOperations:
|
||||||
ogExtendFs(disk, partition)
|
ogExtendFs(disk, partition)
|
||||||
|
|
||||||
if os.access(f'{image_path}', os.R_OK) == False:
|
if os.access(f'{image_path}', os.R_OK) == False:
|
||||||
logging.error(f'Cannot access partclone image file {image_path}')
|
logging.error(f'Cannot access partclone image file {image_path}')
|
||||||
raise ValueError('Cannot access image file')
|
raise ValueError('Cannot access image file')
|
||||||
|
|
||||||
image_info = ogGetImageInfo(image_path)
|
image_info = ogGetImageInfo(image_path)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue