refs #1337 add ucast/mcast functions
parent
d54925252f
commit
87357f4f8e
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
@ -25,4 +26,4 @@ if __name__ == "__main__":
|
|||
script_path = sys.argv[1]
|
||||
output_path = sys.argv[2]
|
||||
|
||||
main(script_path, output_path)
|
||||
main(script_path, output_path)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
@ -14,4 +15,4 @@ def main():
|
|||
boot_os(disk, part)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import time
|
||||
import shutil
|
||||
|
@ -49,4 +50,4 @@ if __name__ == "__main__":
|
|||
if len(sys.argv) != 4:
|
||||
print("Usage: python InventarioSoftware.py <arg1> <arg2> <dest_file>")
|
||||
sys.exit(1)
|
||||
main(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
main(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
|
||||
def reboot_system():
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
@ -76,4 +77,4 @@ def main():
|
|||
os.environ.pop("DEBUG", None)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import socket
|
||||
|
||||
#!/usr/bin/env python3
|
||||
import socket
|
||||
|
||||
def get_ip_address():
|
||||
hostname = socket.gethostname()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -5,4 +6,4 @@ if __name__ == "__main__":
|
|||
print("Usage: python procesaCache.py <arg>")
|
||||
sys.exit(1)
|
||||
|
||||
init_cache(sys.argv[1])
|
||||
init_cache(sys.argv[1])
|
||||
|
|
|
@ -701,22 +701,25 @@ def ogMountFs (disk, par):
|
|||
#@date
|
||||
#*/ ##
|
||||
def ogMountCdrom():
|
||||
DEV = "/dev/cdrom" # Por defecto
|
||||
MNTDIR = subprocess.run(["mount", "-l", "-t", "iso9660", DEV], capture_output=True, text=True)
|
||||
MNTDIR = MNTDIR.stdout.strip().split(" ")[2]
|
||||
if not MNTDIR:
|
||||
MNTDIR = DEV.replace("/dev", "/mnt")
|
||||
os.makedirs(MNTDIR, exist_ok=True)
|
||||
DEV = '/dev/cdrom' # Por defecto
|
||||
outlines = subprocess.run (['mount'], capture_output=True, text=True).stdout.split ('\n')
|
||||
mntdir = ''
|
||||
for l in outlines:
|
||||
items = l.split (' ')
|
||||
if DEV == items[0]:
|
||||
mntdir = items[2]
|
||||
break
|
||||
|
||||
if not mntdir:
|
||||
mntdir = DEV.replace ('/dev', '/mnt')
|
||||
os.makedirs (mntdir, exist_ok=True)
|
||||
try:
|
||||
subprocess.run(["mount", "-t", "iso9660", DEV, MNTDIR], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
subprocess.run (['mount', '-t', 'iso9660', DEV, mntdir], check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
SystemLib.ogRaiseError (
|
||||
[],
|
||||
ogGlobals.OG_ERR_PARTITION,
|
||||
"cdrom"
|
||||
)
|
||||
return
|
||||
return MNTDIR
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, 'cdrom')
|
||||
return None
|
||||
|
||||
return mntdir
|
||||
|
||||
|
||||
#/**
|
||||
|
|
|
@ -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'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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -162,7 +159,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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -203,7 +199,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'ogGetPath (src=({container}), file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -212,12 +207,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'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'ogGetPath (file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -226,14 +219,12 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
return
|
||||
|
||||
path2 = FileLib.ogGetPath (file=source)
|
||||
print (f'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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -364,7 +355,6 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
|
||||
if 'client' == mode:
|
||||
other = session[1:]
|
||||
#print (f'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 ''
|
||||
|
@ -375,23 +365,16 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None):
|
|||
else:
|
||||
repoip = NetLib.ogGetRepoIp()
|
||||
clientip = _clientip()
|
||||
#print (f'repoip ({repoip}) clientip ({clientip})')
|
||||
if 1 != len (clientip):
|
||||
raise Exception ('more than one local IP address found')
|
||||
c = clientip[0]
|
||||
#print (f'c ({c})')
|
||||
clientip = c['local']
|
||||
mascara = c['prefixlen']
|
||||
#print (f'clientip ({clientip}) mascara ({mascara})')
|
||||
|
||||
ripbt = _binary_ip (repoip)
|
||||
ipbt = _binary_ip (clientip)
|
||||
reposubred = ripbt[0:mascara]
|
||||
clientsubred = ipbt[0:mascara]
|
||||
#print (f'ripbt ({ripbt})')
|
||||
#print (f'ipbt ({ipbt})')
|
||||
#print (f'reposubred ({reposubred})')
|
||||
#print (f'clientsubred ({clientsubred})')
|
||||
if reposubred == clientsubred: serveraddress = ' '
|
||||
else: serveraddress = f' --mcast-rdv-address {repoip}'
|
||||
|
||||
|
@ -419,7 +402,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'syn ({syn}) parts ({parts})')
|
||||
prog1 = f'{parts[0]}|{parts[2]}'.strip()
|
||||
prog1 = prog1.replace ('>', '').strip()
|
||||
return f'{prog1} | {syntaxserver}'
|
||||
|
@ -471,7 +453,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'ogGetPath (src=({container}), file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -480,12 +461,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'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'ogGetPath (file=({file})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -494,14 +473,12 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None):
|
|||
return
|
||||
|
||||
path2 = FileLib.ogGetPath (file=source)
|
||||
print (f'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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -538,7 +515,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'ogGetParentPath (src=({container}), file=({file})) = targetdir ({targetdir})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -547,12 +523,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'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'ogGetParentPath (file=({file})) = targetdir ({targetdir})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -561,11 +535,9 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No
|
|||
return
|
||||
|
||||
targetfile = os.path.basename (file)
|
||||
print (f'targetfile ({targetfile})')
|
||||
|
||||
cmd = ogMcastSyntax ('RECEIVERFILE', sess, file=os.path.join (targetdir, targetfile))
|
||||
if not cmd: return None
|
||||
print (f'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -597,7 +569,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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -622,7 +593,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'cmd ({cmd})')
|
||||
try:
|
||||
subprocess.run (cmd, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
|
@ -673,7 +643,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'ogGetPath (src=({container}), file=({torrentfile})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -682,7 +651,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'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'):
|
||||
|
@ -690,7 +658,6 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
|
|||
return None
|
||||
source = FileLib.ogGetPath (file=torrentfile)
|
||||
dev_err = torrentfile
|
||||
print (f'ogGetPath (file=({torrentfile})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
@ -805,7 +772,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'ogGetPath (src=({container}), file=({f})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('argument "container" can be specified along neither "disk" nor "par"')
|
||||
|
||||
|
@ -814,12 +780,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'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'ogGetPath (file=({f})) = source ({source})')
|
||||
else:
|
||||
raise TypeError ('if one of "disk" and "par" are specified, then both must be')
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogCreateTorrent
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogCreateTorrent', 'ogCreateTorrent [str_REPOSITORY] [int_ndisk int_npart] Relative_path_file IpBttrack', ['ogCreateTorrent 1 1 /aula1/winxp 10.1.15.23', 'ogCreateTorrent REPO /aula1/winxp 10.1.15.45'])
|
||||
sys.exit (0)
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
if 4 == len (sys.argv):
|
||||
parser.add_argument ('container')
|
||||
elif 5 == len (sys.argv):
|
||||
parser.add_argument ('disk')
|
||||
parser.add_argument ('par')
|
||||
|
||||
parser.add_argument ('file')
|
||||
parser.add_argument ('ip_bttrack')
|
||||
args = parser.parse_args()
|
||||
|
||||
if 4 == len (sys.argv):
|
||||
ret = ogCreateTorrent (container=args.container, file=args.file, ip_bttrack=args.ip_bttrack)
|
||||
elif 5 == len (sys.argv):
|
||||
ret = ogCreateTorrent (disk=args.disk, par=args.par, file=args.file, ip_bttrack=args.ip_bttrack)
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogMcastReceiverFile
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogMcastReceiverFile', 'ogMcastReceiverFile [ str_portMcast] [ [Relative_path_file] | [str_REPOSITORY path_file] | [int_ndisk int_npart path_file ] ]', ['ogMcastReceiverFile 9000 /PS1_PH1.img', 'ogMcastReceiverFile 9000 CACHE /aula1/PS2_PH4.img', 'ogMcastReceiverFile 9000 1 1 /isos/linux.iso'])
|
||||
sys.exit (0)
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
if 3 == len (sys.argv):
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
elif 4 == len (sys.argv):
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
parser.add_argument ('container', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
elif 5 == len (sys.argv):
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
parser.add_argument ('disk', nargs='?', default=None)
|
||||
parser.add_argument ('par', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if 3 == len (sys.argv):
|
||||
ret = ogMcastReceiverFile (file=args.file, sess=args.sess)
|
||||
elif 4 == len (sys.argv):
|
||||
ret = ogMcastReceiverFile (container=args.container, file=args.file, sess=args.sess)
|
||||
elif 5 == len (sys.argv):
|
||||
ret = ogMcastReceiverFile (disk=args.disk, par=args.par, file=args.file, sess=args.sess)
|
||||
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogMcastReceiverPartition
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
parser.add_argument ('disk')
|
||||
parser.add_argument ('par')
|
||||
parser.add_argument ('sess')
|
||||
parser.add_argument ('tool')
|
||||
parser.add_argument ('compressor')
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogMcastReceiverPartition', 'ogMcastReceiverPartition int_ndisk int_npart SessionMulticastCLIENT tools compresor', ['ogMcastReceiverPartition 1 1 9000 partclone lzop'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = ogMcastReceiverPartition (args.disk, args.par, args.sess, args.tool, args.compressor)
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogMcastSendFile
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
parser.add_argument ('disk', nargs='?', default=None)
|
||||
parser.add_argument ('par', nargs='?', default=None)
|
||||
parser.add_argument ('container', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogMcastSendFile', 'ogMcastSendFile [str_REPOSITORY] [int_ndisk int_npart] /Relative_path_file sesionMcast', ['ogMcastSendFile 1 1 /aula1/winxp.img sesionMcast', 'ogMcastSendFile REPO /aula1/ubuntu.iso sesionMcast', 'ogMcastSendFile CACHE /aula1/winxp.img sesionMcast', 'ogMcastSendFile /opt/opengnsys/images/aula1/hd500.vmx sesionMcast'])
|
||||
sys.exit (0)
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
if 3 == len (sys.argv):
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
elif 4 == len (sys.argv):
|
||||
parser.add_argument ('container', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
elif 5 == len (sys.argv):
|
||||
parser.add_argument ('disk', nargs='?', default=None)
|
||||
parser.add_argument ('par', nargs='?', default=None)
|
||||
parser.add_argument ('file', nargs='?', default=None)
|
||||
parser.add_argument ('sess', nargs='?', default=None)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if 3 == len (sys.argv):
|
||||
ret = ogMcastSendFile (file=args.file, sess=args.sess)
|
||||
elif 4 == len (sys.argv):
|
||||
ret = ogMcastSendFile (container=args.container, file=args.file, sess=args.sess)
|
||||
elif 5 == len (sys.argv):
|
||||
ret = ogMcastSendFile (disk=args.disk, par=args.par, file=args.file, sess=args.sess)
|
||||
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogMcastSendPartition
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
parser.add_argument ('disk')
|
||||
parser.add_argument ('par')
|
||||
parser.add_argument ('sess')
|
||||
parser.add_argument ('tool')
|
||||
parser.add_argument ('compressor')
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogMcastSendPartition', 'ogMcastSendPartition int_ndisk int_npart SessionMulticastSERVER tools compresor', ['ogMcastSendPartition 1 1 9000:full-duplex:239.194.37.31:50M:20:2 partclone lzop'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = ogMcastSendPartition (args.disk, args.par, args.sess, args.tool, args.compressor)
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from FileSystemLib import ogMountCdrom
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogMountCdrom', 'ogMountCdrom', ['ogMountCdrom'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = ogMountCdrom ()
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogUcastReceiverPartition
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
parser.add_argument ('disk')
|
||||
parser.add_argument ('par')
|
||||
parser.add_argument ('sess')
|
||||
parser.add_argument ('tool')
|
||||
parser.add_argument ('level')
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogUcastReceiverPartition', 'ogUcastReceiverPartition int_ndisk int_npart SessionMulticastCLIENT tools compresor', ['ogUcastReceiverPartition 1 1 8000:ipMASTER partclone lzop'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = ogUcastReceiverPartition (args.disk, args.par, args.sess, args.tool, args.level)
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from ProtocolLib import ogUcastSendPartition
|
||||
|
||||
parser = argparse.ArgumentParser (add_help=False)
|
||||
parser.add_argument ('disk')
|
||||
parser.add_argument ('par')
|
||||
parser.add_argument ('sess')
|
||||
parser.add_argument ('tool')
|
||||
parser.add_argument ('level')
|
||||
|
||||
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||
ogHelp ('ogUcastSendPartition', 'ogUcastSendPartition int_ndisk int_npart SessionUNICAST-SERVER tools compresor', ['ogUcastSendPartition 1 1 8000:172.17.36.11:172.17.36.12 partclone lzop'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = ogUcastSendPartition (args.disk, args.par, args.sess, args.tool, args.level)
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
Loading…
Reference in New Issue