refs #1779 remove lots of internal debug stuff
parent
3d35f0029b
commit
280d160a7a
|
@ -1387,7 +1387,6 @@ def ogGrubSecurity (disk, par, user='root', passwd=''):
|
|||
for _cuatro in ['menu.lst', 'grub.cfg', 'grub.cfg.backup.og']:
|
||||
path = '/'.join ([secondstage, _uno, _dos, _tres, _cuatro])
|
||||
grubcfg += glob.glob (path)
|
||||
print (f'nati grubcfg ({grubcfg})')
|
||||
|
||||
# comprobamos que exista el archivo de configuración.
|
||||
if not grubcfg:
|
||||
|
|
|
@ -213,10 +213,8 @@ def ogCopyFile (src, dst):
|
|||
if not TARGET:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dst_dev_err} not found')
|
||||
return
|
||||
print (f'nati: ogCopyFile: SOURCE ({SOURCE}) TARGET ({TARGET})')
|
||||
|
||||
# Copiar fichero (para evitar problemas de comunicaciones las copias se hacen con rsync en vez de cp).
|
||||
print (f'nati: ogCopyFile: rsync --progress --inplace -avh ({SOURCE}) ({TARGET})')
|
||||
result = subprocess.run(["rsync", "--progress", "--inplace", "-avh", SOURCE, TARGET], capture_output=True, text=True)
|
||||
return result.returncode
|
||||
|
||||
|
@ -506,12 +504,10 @@ def ogMakeDir (container=None, disk=None, par=None, file=None):
|
|||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
print (f'nati: ogMakeDir: parent ({parent})')
|
||||
if not parent:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found')
|
||||
return None
|
||||
|
||||
dst = os.path.basename (file)
|
||||
print (f'nati: ogMakeDir: dst ({dst})')
|
||||
os.makedirs (os.path.join (parent, dst), exist_ok=True)
|
||||
return True
|
||||
|
|
|
@ -248,7 +248,6 @@ def ogCreateImage (disk, par, container, imgfile, tool='partclone', level='gzip'
|
|||
|
||||
# Crear Imagen.
|
||||
#trap
|
||||
print (f'nati program ({program})')
|
||||
p = subprocess.run (program, shell=True, check=True)
|
||||
errcode = p.returncode
|
||||
if 0 == errcode:
|
||||
|
@ -512,10 +511,8 @@ def ogRestoreImage (repo, imgpath, disk, par):
|
|||
|
||||
rc = None
|
||||
try:
|
||||
#print (f'nati: ogRestoreImage: running ({program})')
|
||||
p = subprocess.run (program, shell=True, capture_output=True, text=True)
|
||||
rc = p.returncode
|
||||
#print (f'nati: ogRestoreImage: rc ({rc}) stdout ({p.stdout}) stderr ({p.stderr})')
|
||||
if not rc:
|
||||
SystemLib.ogRaiseError ([], ogGlobalsOG_ERR_IMAGE, f'{imgfile}, {disk}, {par}')
|
||||
except:
|
||||
|
|
|
@ -177,7 +177,6 @@ def ogGetMacAddress():
|
|||
mac_addresses.append(parts[i + 1].upper())
|
||||
|
||||
if mac_addresses:
|
||||
print (f'nati: ogGetMacAddress: {mac_addresses[0]}')
|
||||
return mac_addresses[0]
|
||||
else:
|
||||
print("No active mac address found")
|
||||
|
|
|
@ -82,7 +82,6 @@ def ogUcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
address += f' -O {session[i]}:{portbase}'
|
||||
else:
|
||||
address = f'{session[1]}:{portbase}'
|
||||
#print (f'nati mode ({mode}) address ({address})')
|
||||
|
||||
if 'SENDPARTITION' == op:
|
||||
syn = ImageLib.ogCreateImageSyntax (device, ' ', tool, level)
|
||||
|
@ -90,7 +89,6 @@ def ogUcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
## otherwise, param2 in ImageLib.ogCreateImageSyntax() is not '| mbuffer' but empty
|
||||
## and then parts[2] is out of range
|
||||
parts = syn.split ('|')
|
||||
#print (f'nati syn ({syn}) parts ({parts})')
|
||||
prog1 = f'{parts[0]}|{parts[2]}'.strip()
|
||||
prog1 = prog1.replace ('>', '').strip()
|
||||
return f'{prog1} | mbuffer {address}'
|
||||
|
@ -131,7 +129,6 @@ def ogUcastSendPartition (disk, par, sess, tool, level):
|
|||
|
||||
cmd = ogUcastSyntax ('SENDPARTITION', sess, device=PART, tool=tool, level=level)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -163,7 +160,6 @@ def ogUcastReceiverPartition (disk, par, sess, tool, level):
|
|||
|
||||
cmd = ogUcastSyntax ('RECEIVERPARTITION', sess, device=PART, tool=tool, level=level)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -208,7 +204,6 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
## we were given container=
|
||||
source = FileLib.ogGetPath (src=container, file=file)
|
||||
dev_err = f'{container} {file}'
|
||||
print (f'nati ogGetPath (src=({container}), file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -217,12 +212,10 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
## we were given disk= par=
|
||||
source = FileLib.ogGetPath (src=f'{disk} {par}', file=file)
|
||||
dev_err = f'{disk} {par} {file}'
|
||||
print (f'nati ogGetPath (src=({disk} {par}), file=({file})) = source ({source})')
|
||||
elif disk is None and par is None:
|
||||
## we were given nothing
|
||||
source = FileLib.ogGetPath (file=file)
|
||||
dev_err = file
|
||||
print (f'nati ogGetPath (file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -231,14 +224,12 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
return
|
||||
|
||||
path2 = FileLib.ogGetPath (file=source)
|
||||
print (f'nati path2 ({path2})')
|
||||
if not path2:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found')
|
||||
return
|
||||
|
||||
cmd = ogUcastSyntax ('SENDFILE', sess, file=source)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -309,7 +300,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
|
||||
if 'SEND' in op: mode = 'server'
|
||||
else: mode = 'client'
|
||||
print (f'nati mode ({mode})')
|
||||
|
||||
try:
|
||||
isudpcast = subprocess.run (['udp-receiver', '--help'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||
|
@ -318,7 +308,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
return
|
||||
|
||||
session = sess.split (':')
|
||||
print (f'nati sess ({sess}) session ({session})')
|
||||
|
||||
PERROR = 0
|
||||
if 'server' == mode:
|
||||
|
@ -332,7 +321,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
|
||||
mbuffer = " --pipe 'mbuffer -q -m 20M' "
|
||||
portbase = int (session[0])
|
||||
print (f'nati portbase ({portbase})')
|
||||
if portbase not in range (9000, 9100, 2):
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'McastSession portbase {portbase}')
|
||||
PERROR = 3
|
||||
|
@ -372,7 +360,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
|
||||
if 'client' == mode:
|
||||
other = session[1:]
|
||||
print (f'nati session ({session}) other ({other})')
|
||||
serveraddress = other[0] if len (other) > 0 else ''
|
||||
starttimeout = other[1] if len (other) > 1 else ''
|
||||
receivertimeout = other[2] if len (other) > 2 else ''
|
||||
|
@ -383,23 +370,16 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
else:
|
||||
repoip = NetLib.ogGetRepoIp()
|
||||
clientip = _clientip()
|
||||
#print (f'nati repoip ({repoip}) clientip ({clientip})')
|
||||
if 1 != len (clientip):
|
||||
raise Exception ('more than one local IP address found')
|
||||
c = clientip[0]
|
||||
#print (f'nati c ({c})')
|
||||
clientip = c['local']
|
||||
mascara = c['prefixlen']
|
||||
#print (f'nati clientip ({clientip}) mascara ({mascara})')
|
||||
|
||||
ripbt = _binary_ip (repoip)
|
||||
ipbt = _binary_ip (clientip)
|
||||
reposubred = ripbt[0:mascara]
|
||||
clientsubred = ipbt[0:mascara]
|
||||
#print (f'nati ripbt ({ripbt})')
|
||||
#print (f'nati ipbt ({ipbt})')
|
||||
#print (f'nati reposubred ({reposubred})')
|
||||
#print (f'nati clientsubred ({clientsubred})')
|
||||
if reposubred == clientsubred: serveraddress = ' '
|
||||
else: serveraddress = f' --mcast-rdv-address {repoip}'
|
||||
|
||||
|
@ -427,7 +407,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
## otherwise, param2 in ImageLib.ogCreateImageSyntax() is not '| mbuffer' but empty
|
||||
## and then parts[2] is out of range
|
||||
parts = syn.split ('|')
|
||||
#print (f'nati syn ({syn}) parts ({parts})')
|
||||
prog1 = f'{parts[0]}|{parts[2]}'.strip()
|
||||
prog1 = prog1.replace ('>', '').strip()
|
||||
return f'{prog1} | {syntaxserver}'
|
||||
|
@ -483,7 +462,6 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
## we were given container=
|
||||
source = FileLib.ogGetPath (src=container, file=file)
|
||||
dev_err = f'{container} {file}'
|
||||
print (f'nati ogGetPath (src=({container}), file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -492,12 +470,10 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
## we were given disk= par=
|
||||
source = FileLib.ogGetPath (src=f'{disk} {par}', file=file)
|
||||
dev_err = f'{disk} {par} {file}'
|
||||
print (f'nati ogGetPath (src=({disk} {par}), file=({file})) = source ({source})')
|
||||
elif disk is None and par is None:
|
||||
## we were given nothing
|
||||
source = FileLib.ogGetPath (file=file)
|
||||
dev_err = file
|
||||
print (f'nati ogGetPath (file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -506,14 +482,12 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
return
|
||||
|
||||
path2 = FileLib.ogGetPath (file=source)
|
||||
print (f'nati path2 ({path2})')
|
||||
if not path2:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found')
|
||||
return
|
||||
|
||||
cmd = ogMcastSyntax ('SENDFILE', sess, file=source)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -552,7 +526,6 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No
|
|||
## we were given container=
|
||||
targetdir = FileLib.ogGetParentPath (src=container, file=file)
|
||||
dev_err = f'{container} {file}'
|
||||
print (f'nati ogGetParentPath (src=({container}), file=({file})) = targetdir ({targetdir})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -561,12 +534,10 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No
|
|||
## we were given disk= par=
|
||||
targetdir = FileLib.ogGetParentPath (src=f'{disk} {par}', file=file)
|
||||
dev_err = f'{disk} {par} {file}'
|
||||
print (f'nati ogGetParentPath (src=({disk} {par}), file=({file})) = targetdir ({targetdir})')
|
||||
elif disk is None and par is None:
|
||||
## we were given nothing
|
||||
targetdir = FileLib.ogGetParentPath (file=file)
|
||||
dev_err = file
|
||||
print (f'nati ogGetParentPath (file=({file})) = targetdir ({targetdir})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -575,12 +546,9 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No
|
|||
return
|
||||
|
||||
targetfile = os.path.basename (file)
|
||||
print (f'nati targetfile ({targetfile})')
|
||||
|
||||
print (f'nati calling ogMcastSyntax with sess ({sess})')
|
||||
cmd = ogMcastSyntax ('RECEIVERFILE', sess, file=os.path.join (targetdir, targetfile))
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -613,7 +581,6 @@ def ogMcastSendPartition (disk, par, sess, tool, compressor):
|
|||
FileSystemLib.ogUnmount (disk, par)
|
||||
cmd = ogMcastSyntax ('SENDPARTITION', sess, device=PART, tool=tool, level=compressor)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -639,7 +606,6 @@ def ogMcastReceiverPartition (disk, par, sess, tool, compressor):
|
|||
FileSystemLib.ogUnmount (disk, par)
|
||||
cmd = ogMcastSyntax ('RECEIVERPARTITION', sess, device=PART, tool=tool, level=compressor)
|
||||
if not cmd: return None
|
||||
print (f'nati cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -693,7 +659,6 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
|
|||
return None
|
||||
source = FileLib.ogGetPath (src=container, file=torrentfile)
|
||||
dev_err = f'{container} {torrentfile}'
|
||||
print (f'nati ogGetPath (src=({container}), file=({torrentfile})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -702,7 +667,6 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
|
|||
## we were given disk= par=
|
||||
source = FileLib.ogGetPath (src=f'{disk} {par}', file=torrentfile)
|
||||
dev_err = f'{disk} {par} {torrentfile}'
|
||||
print (f'nati ogGetPath (src=({disk} {par}), file=({torrentfile})) = source ({source})')
|
||||
elif disk is None and par is None:
|
||||
## we were given nothing
|
||||
if torrentfile.startswith ('/opt/opengnsys/images'):
|
||||
|
@ -710,7 +674,6 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
|
|||
return None
|
||||
source = FileLib.ogGetPath (file=torrentfile)
|
||||
dev_err = torrentfile
|
||||
print (f'nati ogGetPath (file=({torrentfile})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -825,7 +788,6 @@ def ogCreateTorrent (disk=None, par=None, container=None, file=None, ip_bttrack=
|
|||
return
|
||||
f = f'{file}.{ext}'
|
||||
source = FileLib.ogGetPath (src=container, file=f)
|
||||
print (f'nati ogGetPath (src=({container}), file=({f})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -834,12 +796,10 @@ def ogCreateTorrent (disk=None, par=None, container=None, file=None, ip_bttrack=
|
|||
## we were given disk= par=
|
||||
f = f'{file}.img'
|
||||
source = FileLib.ogGetPath (src=f'{disk} {par}', file=f)
|
||||
print (f'nati ogGetPath (src=({disk} {par}), file=({f})) = source ({source})')
|
||||
elif disk is None and par is None:
|
||||
## we were given nothing
|
||||
f = f'{file}.img'
|
||||
source = FileLib.ogGetPath (file=f)
|
||||
print (f'nati ogGetPath (file=({f})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -890,14 +850,12 @@ def ogUpdateCacheIsNecesary (repo, file, proto):
|
|||
return None
|
||||
|
||||
filesource = FileLib.ogGetPath (src=repo, file=file)
|
||||
#print (f'nati filesource ({filesource})')
|
||||
if not filesource:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f' {repo} {file}')
|
||||
return None
|
||||
|
||||
# paso 1. si no existe la imagen, confirmar que es necesario actualizar la cache.
|
||||
filetarget = FileLib.ogGetPath (src='CACHE', file=file)
|
||||
#print (f'nati filetarget ({filetarget})')
|
||||
if not filetarget:
|
||||
# borramos el fichero bf del torrent, en el caso de que se hubiese quedado de algun proceso fallido
|
||||
if FileLib.ogGetPath (src='CACHE', file=f'/{file}.torrent.bf'): ogDeleteFile (container='CACHE', file=f'{file}.torrent.bf')
|
||||
|
|
|
@ -19,10 +19,8 @@ import FileLib
|
|||
# Función ficticia para lanzar chntpw con timeout de 5 s., evitando cuelgues del programa.
|
||||
chntpw_exe = shutil.which ('drbl-chntpw') or shutil.which ('chntpw')
|
||||
def chntpw (hivefile, input_file):
|
||||
#print (f'nati: hivefile ({hivefile}) input_file ({input_file}) type ({type(input_file)})')
|
||||
with open (input_file, 'r') as fd:
|
||||
input_contents = fd.read()
|
||||
#print (f'nati: input_contents ({input_contents})')
|
||||
return subprocess.run ([chntpw_exe, '-e', hivefile], timeout=5, input=input_contents, capture_output=True, text=True).stdout
|
||||
|
||||
## en el codigo bash aparecen "${3%\\*}" y "${3##*\\}" varias veces
|
||||
|
|
|
@ -108,29 +108,18 @@ def ogExecAndLog (logtypes, fun, *args, **kwargs):
|
|||
if 'command' in logtypes:
|
||||
os.unlink (ogGlobals.OGLOGCOMMAND)
|
||||
open (ogGlobals.OGLOGCOMMAND, 'w').close()
|
||||
#print ('nati: ogExecAndLog: about to redirect stdout and stderr')
|
||||
#time.sleep (1) ## nati
|
||||
with redirect_stdout (StringIO()) as r_stdout, redirect_stderr (StringIO()) as r_stderr:
|
||||
rc = fun (*args, **kwargs)
|
||||
sout = r_stdout.getvalue()
|
||||
serr = r_stderr.getvalue()
|
||||
#print (f'nati: ogExecAndLog: end of redirections, rc ({rc}) sout ({sout}) serr ({serr})')
|
||||
#time.sleep (1) ## nati
|
||||
else:
|
||||
#print ('nati: ogExecAndLog: about to redirect stdout only')
|
||||
#time.sleep (1) ## nati
|
||||
with redirect_stdout (StringIO()) as r_stdout:
|
||||
rc = fun (*args, **kwargs)
|
||||
sout = r_stdout.getvalue()
|
||||
#print (f'nati: ogExecAndLog: end of redirections, rc ({rc}) sout ({sout})')
|
||||
#time.sleep (1) ## nati
|
||||
|
||||
rc_str = str (rc)
|
||||
if sout or serr or ('True' != rc_str and 'False' != rc_str and 'None' != rc_str):
|
||||
#print ('nati: ogExecAndLog: sout or serr are true')
|
||||
#time.sleep (1) ## nati
|
||||
for f in logfiles:
|
||||
#print (f'nati: ogExecAndLog: logging to logfile ({f})')
|
||||
with open (f, 'a') as fd:
|
||||
if sout: fd.write (f'{sout}\n')
|
||||
if serr: fd.write (f'{serr}\n')
|
||||
|
@ -141,7 +130,6 @@ def ogExecAndLog (logtypes, fun, *args, **kwargs):
|
|||
#if serr: fd.write (f"ogExecAndLog: {fun.__name__} stderr:\n{serr}\n")
|
||||
#else: fd.write (f"ogExecAndLog: {fun.__name__} stderr: (none)\n")
|
||||
|
||||
#print (f'nati: ogExecAndLog: returning rc ({rc})')
|
||||
return rc
|
||||
|
||||
#/**
|
||||
|
@ -265,7 +253,6 @@ def ogRaiseError (logtypes, code, msg):
|
|||
if code == ogGlobals.OG_ERR_FORMAT or \
|
||||
(str_call_stack in ogGlobals.NODEBUGFUNCTIONS) or \
|
||||
not (len(call_stack)>0 and (call_stack[0] in ogGlobals.NODEBUGFUNCTIONS)):
|
||||
#print ('nati: ogRaiseError: actually calling ogEcho')
|
||||
ogEcho (logtypes, "error", f"{str_call_stack.replace(' ', '<-')}: {MSG}")
|
||||
|
||||
return code
|
||||
|
|
|
@ -47,7 +47,6 @@ def main (NDISK, NPART, SIZE, MOUNT):
|
|||
if SIZE != CACHESIZE:
|
||||
print("[10] Crear partición de caché local.")
|
||||
CacheLib.ogUnmountCache()
|
||||
print (f'nati: calling ogCreateCache ({NDISK}, {NPART}, {SIZE})')
|
||||
if not CacheLib.ogCreateCache (NDISK, NPART, SIZE):
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_CACHE, 'failed to create cache')
|
||||
return False
|
||||
|
@ -106,23 +105,19 @@ if __name__ == "__main__":
|
|||
NPART = int (args[1])
|
||||
SIZE = int (args[2])
|
||||
else:
|
||||
print (f'nati: params no es ni 1 ni 2 ni 3 sino ({PARAMS})')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT)
|
||||
sys.exit (1)
|
||||
except ValueError:
|
||||
print (f'nati: ValueError')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT)
|
||||
sys.exit (1)
|
||||
|
||||
# Si disco o partición no son mayores o iguales que 1, error.
|
||||
if NDISK < 1 or NPART < 1:
|
||||
print (f'nati: ndisk<1 or npart<1, ({NDISK}) ({NPART})')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT)
|
||||
sys.exit (1)
|
||||
|
||||
# Si tamaño no es numérico o tamaño<-1, error.
|
||||
if SIZE < -1:
|
||||
print (f'nati: SIZE<-1 ({SIZE})')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT)
|
||||
sys.exit (1)
|
||||
|
||||
|
|
|
@ -144,7 +144,6 @@ if sizerequired >= cachesizefree:
|
|||
sys.exit (1)
|
||||
|
||||
# Comprobamos que imagen cache igual a la del repo. Si sincronizada no podemos comprobar.
|
||||
## nati: esto ya lo hicimos mas arriba...
|
||||
rc = ProtocolLib.ogUpdateCacheIsNecesary (repositorio, path, protocolo)
|
||||
# si rc=True: actualizamos; si rc=False: no actualizamos (exit 0); si rc=None: exit error
|
||||
if rc == True: pass ## es necesario actualizar
|
||||
|
|
Loading…
Reference in New Issue