VirtualBox

Ignore:
Timestamp:
Jan 15, 2024 8:52:48 AM (12 months ago)
Author:
vboxsync
Message:

Frontends/VBoxShell: First attempt to revive and unbreak this -- a lot of stuff was broken, also pylint was freaking out at certain places. More Python 3.x fixes. Made syntax help (a lot!) more consistent, although it's not perfect yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r98103 r102872  
    11#!/usr/bin/env python
    22# -*- coding: utf-8 -*-
     3# pylint: disable=too-many-lines
    34# $Id$
    45
     
    5253import traceback
    5354import shlex
     55import tempfile
    5456import time
    5557import re
    5658import platform
    5759from optparse import OptionParser
    58 from pprint import pprint
    5960
    6061
     
    251252    return colored(str(mbyte)+'M', 'red')
    252253
    253 def createVm(ctx, name, kind):
     254def platformArchFromString(ctx, arch):
     255    if     arch == 'x86' \
     256        or arch == 'x86_64' \
     257        or arch == 'x64':
     258        return ctx['global'].constants.PlatformArchitecture_x86
     259    elif    arch == 'arm' \
     260         or arch == 'aarch32' \
     261         or arch == 'aarch64':
     262        return ctx['global'].constants.PlatformArchitecture_ARM
     263    return ctx['global'].constants.PlatformArchitecture_None
     264
     265def createVm(ctx, name, arch, kind):
    254266    vbox = ctx['vb']
    255     mach = vbox.createMachine("", name, [], kind, "")
     267    enmArch = platformArchFromString(ctx, arch)
     268    if enmArch == ctx['global'].constants.PlatformArchitecture_None:
     269        print("wrong / invalid platform architecture specified!")
     270        return
     271    sFlags = ''
     272    sCipher = '' ## @todo No encryption support here yet!
     273    sPasswordID = ''
     274    sPassword = ''
     275    mach = vbox.createMachine("", name, enmArch, [], kind, sFlags, sCipher, sPasswordID, sPassword)
    256276    mach.saveSettings()
    257277    print("created machine with UUID", mach.id)
     
    275295
    276296def startVm(ctx, mach, vmtype):
    277     vbox = ctx['vb']
    278297    perf = ctx['perf']
    279298    session = ctx['global'].getSessionObject()
     
    341360        print(metric['name'], metric['values_as_string'])
    342361
    343 def guestExec(ctx, machine, console, cmds):
    344     exec(cmds)
     362def guestExec(_ctx, _machine, _console, cmds):
     363    exec(cmds) # pylint: disable=exec-used
    345364
    346365def printMouseEvent(_ctx, mev):
     
    412431            except:
    413432                traceback.print_exc()
    414             pass
    415433
    416434    if active:
     
    438456    except:
    439457        traceback.print_exc()
    440         pass
     458
    441459    if listener and registered:
    442460        eventSource.unregisterListener(listener)
     
    477495    # we create an aggregated event source to listen for multiple event sources (keyboard and mouse in our case)
    478496    agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource])
    479     demo = open(filename, 'w')
     497    demo = open(filename, 'w', encoding='utf-8')
    480498    header = "VM=" + console.machine.name + "\n"
    481499    demo.write(header)
     
    495513    except:
    496514        traceback.print_exc()
    497         pass
     515
    498516    demo.close()
    499517    if listener and registered:
     
    502520
    503521def playbackDemo(ctx, console, filename, dur):
    504     demo = open(filename, 'r')
     522    demo = open(filename, 'r', encoding='utf-8')
    505523
    506524    if dur == -1:
     
    554572    except:
    555573        traceback.print_exc()
    556         pass
     574
    557575    demo.close()
    558576
    559 
    560 def takeScreenshotOld(_ctx, console, args):
    561     from PIL import Image
     577def takeScreenshot(ctx, console, args):
    562578    display = console.display
    563579    if len(args) > 0:
    564580        f = args[0]
    565581    else:
    566         f = "/tmp/screenshot.png"
     582        f = os.path.join(tempfile.gettempdir(), "screenshot.png")
    567583    if len(args) > 3:
    568584        screen = int(args[3])
    569585    else:
    570586        screen = 0
    571     (fbw, fbh, _fbbpp, fbx, fby, _) = display.getScreenResolution(screen)
    572     if len(args) > 1:
    573         w = int(args[1])
    574     else:
    575         w = fbw
    576     if len(args) > 2:
    577         h = int(args[2])
    578     else:
    579         h = fbh
    580 
    581     print("Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f))
    582     data = display.takeScreenShotToArray(screen, w, h, ctx['const'].BitmapFormat_RGBA)
    583     size = (w, h)
    584     mode = "RGBA"
    585     im = Image.frombuffer(mode, size, str(data), "raw", mode, 0, 1)
    586     im.save(f, "PNG")
    587 
    588 def takeScreenshot(_ctx, console, args):
    589     display = console.display
    590     if len(args) > 0:
    591         f = args[0]
    592     else:
    593         f = "/tmp/screenshot.png"
    594     if len(args) > 3:
    595         screen = int(args[3])
    596     else:
    597         screen = 0
    598     (fbw, fbh, _fbbpp, fbx, fby, _) = display.getScreenResolution(screen)
     587    (fbw, fbh, _fbbpp, _fbx, _fby, _) = display.getScreenResolution(screen)
    599588    if len(args) > 1:
    600589        w = int(args[1])
     
    638627def guestStats(ctx, console, args):
    639628    guest = console.guest
     629    if not guest:
     630        print("Guest is not in a running state")
     631        return
    640632    # we need to set up guest statistics
    641633    if len(args) > 0 :
     
    691683def ginfo(ctx, console, _args):
    692684    guest = console.guest
     685    if not guest:
     686        print("Guest is not in a running state")
     687        return
    693688    if guest.additionsRunLevel != ctx['const'].AdditionsRunLevelType_None:
    694689        print("Additions active, version %s" % (guest.additionsVersion))
     
    715710    session = None
    716711    try:
    717         vbox = ctx['vb']
    718712        session = ctx['global'].openMachineSession(mach, fPermitSharing=True)
    719713    except Exception as e:
     
    830824        return matches
    831825    def apply(self, cmd):
    832         exec(cmd, {'obj':self.obj, 'node':self, 'ctx':self.getCtx()}, {})
     826        exec(cmd, {'obj':self.obj, 'node':self, 'ctx':self.getCtx()}, {}) # pylint: disable=exec-used
    833827    def getCtx(self):
    834828        if hasattr(self, 'ctx'):
     
    874868    def __init__(self, parent, mach):
    875869        XPathNodeHolder.__init__(self, parent, mach, 'nics', XPathNodeVM, 'nics')
    876         self.maxNic = self.getCtx()['vb'].systemProperties.getMaxNetworkAdapters(self.obj.chipsetType)
     870        self.maxNic = mach.platform.properties.getMaxNetworkAdapters(mach.platform.chipsetType)
    877871    def enum(self):
    878872        children = []
     
    915909def argsToMach(ctx, args):
    916910    if len(args) < 2:
    917         print("usage: %s [vmname|uuid]" % (args[0]))
     911        print("usage: %s <vmname|uuid>" % (args[0]))
    918912        return None
    919913    uuid = args[1]
    920914    mach = machById(ctx, uuid)
    921     if mach == None:
     915    if not mach:
    922916        print("Machine '%s' is unknown, use list command to find available machines" % (uuid))
    923917    return mach
     
    973967def infoCmd(ctx, args):
    974968    if len(args) < 2:
    975         print("usage: info [vmname|uuid]")
    976         return 0
    977     mach = argsToMach(ctx, args)
    978     if mach == None:
     969        print("usage: info <vmname|uuid>")
     970        return 0
     971    mach = argsToMach(ctx, args)
     972    if not mach:
    979973        return 0
    980974    try:
     
    987981    print("  ID [n/a]: %s" % (mach.id))
    988982    print("  OS Type [via OSTypeId]: %s" % (vmos.description if vmos is not None else mach.OSTypeId))
    989     print("  Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareType), mach.firmwareType))
     983    print("  Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareSettings.firmwareType), mach.firmwareSettings.firmwareType))
    990984    print()
    991985    print("  CPUs [CPUCount]: %d" % (mach.CPUCount))
     
    993987    print("  VRAM [VRAMSize]: %dM" % (mach.graphicsAdapter.VRAMSize))
    994988    print("  Monitors [monitorCount]: %d" % (mach.graphicsAdapter.monitorCount))
    995     print("  Chipset [chipsetType]: %s (%s)" % (asEnumElem(ctx, "ChipsetType", mach.chipsetType), mach.chipsetType))
     989    print("  Chipset [chipsetType]: %s (%s)" % (asEnumElem(ctx, "ChipsetType", mach.platform.chipsetType), mach.platform.chipsetType))
    996990    print()
    997991    print("  Clipboard mode [clipboardMode]: %s (%s)" % (asEnumElem(ctx, "ClipboardMode", mach.clipboardMode), mach.clipboardMode))
     
    1001995        print("  Teleport target on port %d (%s)" % (mach.teleporterPort, mach.teleporterPassword))
    1002996        print()
    1003     bios = mach.BIOSSettings
    1004     print("  ACPI [BIOSSettings.ACPIEnabled]: %s" % (asState(bios.ACPIEnabled)))
    1005     print("  APIC [BIOSSettings.IOAPICEnabled]: %s" % (asState(bios.IOAPICEnabled)))
    1006     hwVirtEnabled = mach.getHWVirtExProperty(ctx['global'].constants.HWVirtExPropertyType_Enabled)
    1007     print("  Hardware virtualization [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_Enabled, value)]: " + asState(hwVirtEnabled))
    1008     hwVirtVPID = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_VPID)
    1009     print("  VPID support [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_VPID, value)]: " + asState(hwVirtVPID))
    1010     hwVirtNestedPaging = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_NestedPaging)
    1011     print("  Nested paging [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_NestedPaging, value)]: " + asState(hwVirtNestedPaging))
     997    print("  ACPI [BIOSSettings.ACPIEnabled]: %s" % (asState(mach.firmwareSettings.ACPIEnabled)))
     998    print("  APIC [BIOSSettings.IOAPICEnabled]: %s" % (asState(mach.firmwareSettings.IOAPICEnabled)))
     999    if mach.platform.architecture == ctx['global'].constants.PlatformArchitecture_x86:
     1000        hwVirtEnabled = mach.platform.x86.getHWVirtExProperty(ctx['global'].constants.HWVirtExPropertyType_Enabled)
     1001        print("  Hardware virtualization [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_Enabled, value)]: " + asState(hwVirtEnabled))
     1002        hwVirtVPID = mach.platform.x86.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_VPID)
     1003        print("  VPID support [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_VPID, value)]: " + asState(hwVirtVPID))
     1004        hwVirtNestedPaging = mach.platform.x86.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_NestedPaging)
     1005        print("  Nested paging [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_NestedPaging, value)]: " + asState(hwVirtNestedPaging))
     1006        print("  HPET [HPETEnabled]: %s" % (asState(mach.platform.x86.HPETEnabled)))
    10121007
    10131008    print("  Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.graphicsAdapter.accelerate3DEnabled))
    10141009    print("  Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.graphicsAdapter.accelerate2DVideoEnabled))
    1015 
    1016     print("  Use universal time [RTCUseUTC]: %s" % (asState(mach.RTCUseUTC)))
    1017     print("  HPET [HPETEnabled]: %s" % (asState(mach.HPETEnabled)))
    1018     if mach.audioAdapter.enabled:
    1019         print("  Audio [via audioAdapter]: chip %s; host driver %s" % (asEnumElem(ctx, "AudioControllerType", mach.audioAdapter.audioController), asEnumElem(ctx, "AudioDriverType",  mach.audioAdapter.audioDriver)))
     1010    print("  Use universal time [RTCUseUTC]: %s" % (asState(mach.platform.RTCUseUTC)))
     1011    audioAdp = mach.audioSettings.adapter
     1012    if audioAdp.enabled:
     1013        print("  Audio [via audioAdapter]: chip %s; host driver %s" % (asEnumElem(ctx, "AudioControllerType", audioAdp.audioController), asEnumElem(ctx, "AudioDriverType",  audioAdp.audioDriver)))
    10201014    print("  CPU hotplugging [CPUHotPlugEnabled]: %s" % (asState(mach.CPUHotPlugEnabled)))
    10211015
     
    10941088def startCmd(ctx, args):
    10951089    if len(args) < 2:
    1096         print("usage: start name <frontend>")
    1097         return 0
    1098     mach = argsToMach(ctx, args)
    1099     if mach == None:
     1090        print("usage: start <vmname|uuid> <frontend>")
     1091        return 0
     1092    mach = argsToMach(ctx, args)
     1093    if not mach:
    11001094        return 0
    11011095    if len(args) > 2:
     
    11071101
    11081102def createVmCmd(ctx, args):
    1109     if len(args) != 3:
    1110         print("usage: createvm name ostype")
     1103    if len(args) != 4:
     1104        print("usage: createvm <name> <arch> <ostype>")
    11111105        return 0
    11121106    name = args[1]
    1113     oskind = args[2]
     1107    arch = args[2]
     1108    oskind = args[3]
    11141109    try:
    11151110        ctx['vb'].getGuestOSType(oskind)
     
    11171112        print('Unknown OS type:', oskind)
    11181113        return 0
    1119     createVm(ctx, name, oskind)
     1114    createVm(ctx, name, arch, oskind)
    11201115    return 0
    11211116
    11221117def ginfoCmd(ctx, args):
    11231118    if len(args) < 2:
    1124         print("usage: ginfo [vmname|uuid]")
    1125         return 0
    1126     mach = argsToMach(ctx, args)
    1127     if mach == None:
     1119        print("usage: ginfo <vmname|uuid>")
     1120        return 0
     1121    mach = argsToMach(ctx, args)
     1122    if not mach:
    11281123        return 0
    11291124    cmdExistingVm(ctx, mach, 'ginfo', '')
    11301125    return 0
    11311126
    1132 def execInGuest(ctx, console, args, env, user, passwd, tmo, inputPipe=None, outputPipe=None):
     1127def gstctlPrintOk(_ctx, string):
     1128    return print(colored(string, 'green'))
     1129
     1130def gstctlPrintErr(_ctx, string):
     1131    return print(colored(string, 'red'))
     1132
     1133def execInGuest(ctx, console, args, env, user, passwd, tmo, inputPipe=None, _outputPipe=None):
    11331134    if len(args) < 1:
    11341135        print("exec in guest needs at least program name")
    11351136        return
    11361137    guest = console.guest
    1137     guestSession = guest.createSession(user, passwd, "", "vboxshell guest exec")
    11381138    # shall contain program name as argv[0]
    11391139    gargs = args
    1140     print("executing %s with args %s as %s" % (args[0], gargs, user))
    1141     flags = 0
     1140    if g_fVerbose:
     1141        gstctlPrintOk(ctx, "starting guest session for user '%s' (password '%s')" % (user, passwd))
     1142    else:
     1143        gstctlPrintOk(ctx, ("starting guest session for user '%s' ..." % (user)))
     1144    try:
     1145        guestSession = guest.createSession(user, passwd, "", "vboxshell guest exec")
     1146        guestSession.waitForArray([ ctx['global'].constants.GuestSessionWaitForFlag_Start ], 30 * 1000)
     1147    except Exception as e:
     1148        gstctlPrintErr(ctx, "starting guest session failed:")
     1149        printErr(ctx, e)
     1150        return 1
     1151    if g_fVerbose:
     1152        gstctlPrintOk(ctx, "guest session %d started" % guestSession.id)
     1153    aProcCreateFlags = [ ctx['global'].constants.ProcessCreateFlag_WaitForStdOut, \
     1154                         ctx['global'].constants.ProcessCreateFlag_WaitForStdErr ]
    11421155    if inputPipe is not None:
    1143         flags = 1 # set WaitForProcessStartOnly
    1144     print(args[0])
    1145     process = guestSession.processCreate(args[0], gargs, env, [], tmo)
    1146     print("executed with pid %d" % (process.PID))
    1147     if pid != 0:
     1156        aProcCreateFlags.extend([ ctx['global'].constants.ProcessCreateFlag_WaitForStdIn ])
     1157    if g_fVerbose:
     1158        gstctlPrintOk(ctx, "starting process '%s' with args '%s' as user '%s' (password '%s')" % (args[0], gargs, user, passwd))
     1159    process = guestSession.processCreate(args[0], gargs, '', env, aProcCreateFlags, tmo)
     1160    try:
     1161        waitResult = process.waitForArray([ ctx['global'].constants.ProcessWaitForFlag_Start ], 30 * 1000)
     1162    except Exception as e:
     1163        gstctlPrintErr(ctx, "waiting for guest process start failed:")
     1164        printErr(ctx, e)
     1165        return 1
     1166    if waitResult != ctx['global'].constants.ProcessWaitResult_Start:
     1167        gstctlPrintErr(ctx, "process start failed: got wait result %d, expected %d" \
     1168                       % (waitResult, ctx['global'].constants.ProcessWaitResult_Start) )
     1169        return 1
     1170    procStatus = process.status
     1171    if procStatus != ctx['global'].constants.ProcessStatus_Started:
     1172        gstctlPrintErr(ctx, "process start failed: got process status %d, expected %d" \
     1173                       % (procStatus, ctx['global'].constants.ProcessStatus_Started) )
     1174        return 1
     1175    if g_fVerbose:
     1176        gstctlPrintOk(ctx, "process %d started" % (process.PID))
     1177    if process.PID != 0:
    11481178        try:
    1149             while True:
    1150                 if inputPipe is not None:
     1179            fCompleted  = False
     1180            fReadStdOut = False
     1181            fReadStdErr = False
     1182            while not fCompleted:
     1183                waitResult = process.waitForArray([ ctx['global'].constants.ProcessWaitForFlag_Terminate, \
     1184                                                    ctx['global'].constants.ProcessWaitForFlag_StdOut, \
     1185                                                    ctx['global'].constants.ProcessWaitForFlag_StdErr ], 1000)
     1186                if waitResult == ctx['global'].constants.ProcessWaitResult_WaitFlagNotSupported:
     1187                    fReadStdOut = True
     1188                    fReadStdErr = True
     1189                elif waitResult == ctx['global'].constants.ProcessWaitResult_Terminate:
     1190                    fCompleted = True
     1191                    break
     1192                elif waitResult == ctx['global'].constants.ProcessWaitResult_Timeout:
     1193                    gstctlPrintErr(ctx, "timeout while waiting for process")
     1194                    break
     1195                else:
     1196                    gstctlPrintErr(ctx, "got unhandled wait result %d" % (waitResult))
     1197                if inputPipe:
    11511198                    indata = inputPipe(ctx)
    11521199                    if indata is not None:
     
    11541201                        off = 0
    11551202                        while write > 0:
    1156                             w = guest.setProcessInput(pid, 0, 10*1000, indata[off:])
     1203                            w = process.write(0, 10*1000, indata[off:])
    11571204                            off = off + w
    11581205                            write = write - w
     
    11601207                        # EOF
    11611208                        try:
    1162                             guest.setProcessInput(pid, 1, 10*1000, " ")
     1209                            process.write(0, 10*1000, " ")
    11631210                        except:
    11641211                            pass
    1165                 data = guest.getProcessOutput(pid, 0, 10000, 4096)
    1166                 if data and len(data) > 0:
    1167                     sys.stdout.write(data)
    1168                     continue
    1169                 progress.waitForCompletion(100)
     1212                if fReadStdOut:
     1213                    data = process.read(1, 64 * 1024, 10*1000)
     1214                    if data and len(data):
     1215                        sys.stdout.write(bytes(data).decode('utf-8'))
     1216                    fReadStdOut = False
     1217                if fReadStdErr:
     1218                    data = process.read(2, 64 * 1024, 10*1000)
     1219                    if data and len(data):
     1220                        sys.stderr.write(bytes(data).decode('utf-8'))
     1221                    fReadStdErr = False
    11701222                ctx['global'].waitForEvents(0)
    1171                 data = guest.getProcessOutput(pid, 0, 0, 4096)
    1172                 if data and len(data) > 0:
    1173                     if outputPipe is not None:
    1174                         outputPipe(ctx, data)
    1175                     else:
    1176                         sys.stdout.write(data)
    1177                     continue
    1178                 if progress.completed:
    1179                     break
     1223
     1224            if fCompleted:
     1225                exitCode = process.exitCode
     1226                if exitCode == 0:
     1227                    gstctlPrintOk(ctx, "process exit code: %d" % (exitCode))
     1228                else:
     1229                    gstctlPrintErr(ctx, "process exit code: %d" % (exitCode))
    11801230
    11811231        except KeyboardInterrupt:
    11821232            print("Interrupted.")
    11831233            ctx['interrupt'] = True
    1184             if progress.cancelable:
    1185                 progress.cancel()
    1186         (_reason, code, _flags) = guest.getProcessStatus(pid)
    1187         print("Exit code: %d" % (code))
    1188         return 0
    1189     else:
    1190         reportError(ctx, progress)
     1234
     1235        except Exception as e:
     1236            printErr(ctx, e)
     1237
     1238    if guestSession:
     1239        try:
     1240            if g_fVerbose:
     1241                gstctlPrintOk(ctx, "closing guest session ...")
     1242            guestSession.close()
     1243        except:
     1244            printErr(ctx, e)
     1245
     1246    return 0
     1247
    11911248
    11921249def copyToGuest(ctx, console, args, user, passwd):
     
    11991256
    12001257def nh_raw_input(prompt=""):
    1201     stream = sys.stdout
    1202     prompt = str(prompt)
    12031258    if prompt:
    1204         stream.write(prompt)
     1259        sys.stdout.write(prompt)
     1260        sys.stdout.flush()
    12051261    line = sys.stdin.readline()
    12061262    if not line:
     
    12101266    return line
    12111267
    1212 
    12131268def getCred(_ctx):
    12141269    import getpass
    12151270    user = getpass.getuser()
    1216     user_inp = nh_raw_input("User (%s): " % (user))
     1271    if user:
     1272        user_inp = nh_raw_input("User (%s): " % (user))
     1273    else:
     1274        user_inp = nh_raw_input("User: ")
    12171275    if len(user_inp) > 0:
    12181276        user = user_inp
     
    12231281def gexecCmd(ctx, args):
    12241282    if len(args) < 2:
    1225         print("usage: gexec [vmname|uuid] command args")
    1226         return 0
    1227     mach = argsToMach(ctx, args)
    1228     if mach == None:
     1283        print("usage: gexec <vmname|uuid> command args")
     1284        return 0
     1285    mach = argsToMach(ctx, args)
     1286    if not mach:
    12291287        return 0
    12301288    gargs = args[2:]
     
    12371295def gcopyCmd(ctx, args):
    12381296    if len(args) < 2:
    1239         print("usage: gcopy [vmname|uuid] host_path guest_path")
    1240         return 0
    1241     mach = argsToMach(ctx, args)
    1242     if mach == None:
     1297        print("usage: gcopy <vmname|uuid> host_path guest_path")
     1298        return 0
     1299    mach = argsToMach(ctx, args)
     1300    if not mach:
    12431301        return 0
    12441302    gargs = args[2:]
     
    12561314def gpipeCmd(ctx, args):
    12571315    if len(args) < 4:
    1258         print("usage: gpipe [vmname|uuid] hostProgram guestProgram, such as gpipe linux  '/bin/uname -a' '/bin/sh -c \"/usr/bin/tee; /bin/uname -a\"'")
    1259         return 0
    1260     mach = argsToMach(ctx, args)
    1261     if mach == None:
     1316        print("usage: gpipe <vmname|uuid> hostProgram guestProgram, such as gpipe linux  '/bin/uname -a' '/bin/sh -c \"/usr/bin/tee; /bin/uname -a\"'")
     1317        return 0
     1318    mach = argsToMach(ctx, args)
     1319    if not mach:
    12621320        return 0
    12631321    hcmd = args[2]
     
    12801338def removeVmCmd(ctx, args):
    12811339    mach = argsToMach(ctx, args)
    1282     if mach == None:
     1340    if not mach:
    12831341        return 0
    12841342    removeVm(ctx, mach)
     
    12871345def pauseCmd(ctx, args):
    12881346    mach = argsToMach(ctx, args)
    1289     if mach == None:
     1347    if not mach:
    12901348        return 0
    12911349    cmdExistingVm(ctx, mach, 'pause', '')
     
    12941352def powerdownCmd(ctx, args):
    12951353    mach = argsToMach(ctx, args)
    1296     if mach == None:
     1354    if not mach:
    12971355        return 0
    12981356    cmdExistingVm(ctx, mach, 'powerdown', '')
     
    13011359def powerbuttonCmd(ctx, args):
    13021360    mach = argsToMach(ctx, args)
    1303     if mach == None:
     1361    if not mach:
    13041362        return 0
    13051363    cmdExistingVm(ctx, mach, 'powerbutton', '')
     
    13081366def resumeCmd(ctx, args):
    13091367    mach = argsToMach(ctx, args)
    1310     if mach == None:
     1368    if not mach:
    13111369        return 0
    13121370    cmdExistingVm(ctx, mach, 'resume', '')
     
    13151373def saveCmd(ctx, args):
    13161374    mach = argsToMach(ctx, args)
    1317     if mach == None:
     1375    if not mach:
    13181376        return 0
    13191377    cmdExistingVm(ctx, mach, 'save', '')
     
    13221380def statsCmd(ctx, args):
    13231381    mach = argsToMach(ctx, args)
    1324     if mach == None:
     1382    if not mach:
    13251383        return 0
    13261384    cmdExistingVm(ctx, mach, 'stats', '')
     
    13291387def guestCmd(ctx, args):
    13301388    if len(args) < 3:
    1331         print("usage: guest name commands")
    1332         return 0
    1333     mach = argsToMach(ctx, args)
    1334     if mach == None:
     1389        print("usage: guest <vmname|uuid> commands")
     1390        return 0
     1391    mach = argsToMach(ctx, args)
     1392    if not mach:
    13351393        return 0
    13361394    if mach.state != ctx['const'].MachineState_Running:
     
    13421400def screenshotCmd(ctx, args):
    13431401    if len(args) < 2:
    1344         print("usage: screenshot vm <file> <width> <height> <monitor>")
    1345         return 0
    1346     mach = argsToMach(ctx, args)
    1347     if mach == None:
     1402        print("usage: screenshot <vmname|uuid> <file> <width> <height> <monitor>")
     1403        return 0
     1404    mach = argsToMach(ctx, args)
     1405    if not mach:
    13481406        return 0
    13491407    cmdExistingVm(ctx, mach, 'screenshot', args[2:])
     
    13521410def teleportCmd(ctx, args):
    13531411    if len(args) < 3:
    1354         print("usage: teleport name host:port <password>")
    1355         return 0
    1356     mach = argsToMach(ctx, args)
    1357     if mach == None:
     1412        print("usage: teleport <vmname|uuid> host:port <password>")
     1413        return 0
     1414    mach = argsToMach(ctx, args)
     1415    if not mach:
    13581416        return 0
    13591417    cmdExistingVm(ctx, mach, 'teleport', args[2:])
     
    13711429def openportalCmd(ctx, args):
    13721430    if len(args) < 3:
    1373         print("usage: openportal name port <password>")
    1374         return 0
    1375     mach = argsToMach(ctx, args)
    1376     if mach == None:
     1431        print("usage: openportal <vmname|uuid> port <password>")
     1432        return 0
     1433    mach = argsToMach(ctx, args)
     1434    if not mach:
    13771435        return 0
    13781436    port = int(args[2])
     
    13881446def closeportalCmd(ctx, args):
    13891447    if len(args) < 2:
    1390         print("usage: closeportal name")
    1391         return 0
    1392     mach = argsToMach(ctx, args)
    1393     if mach == None:
     1448        print("usage: closeportal <vmname|uuid>")
     1449        return 0
     1450    mach = argsToMach(ctx, args)
     1451    if not mach:
    13941452        return 0
    13951453    if mach.teleporterEnabled:
     
    13991457def gueststatsCmd(ctx, args):
    14001458    if len(args) < 2:
    1401         print("usage: gueststats name <check interval>")
    1402         return 0
    1403     mach = argsToMach(ctx, args)
    1404     if mach == None:
     1459        print("usage: gueststats <vmname|uuid> <check interval>")
     1460        return 0
     1461    mach = argsToMach(ctx, args)
     1462    if not mach:
    14051463        return 0
    14061464    cmdExistingVm(ctx, mach, 'gueststats', args[2:])
     
    14191477def plugcpuCmd(ctx, args):
    14201478    if len(args) < 2:
    1421         print("usage: plugcpu name cpuid")
    1422         return 0
    1423     mach = argsToMach(ctx, args)
    1424     if mach == None:
     1479        print("usage: plugcpu <vmname|uuid> <cpuid>")
     1480        return 0
     1481    mach = argsToMach(ctx, args)
     1482    if not mach:
    14251483        return 0
    14261484    if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
     
    14331491def unplugcpuCmd(ctx, args):
    14341492    if len(args) < 2:
    1435         print("usage: unplugcpu name cpuid")
    1436         return 0
    1437     mach = argsToMach(ctx, args)
    1438     if mach == None:
     1493        print("usage: unplugcpu <vmname|uuid> <cpuid>")
     1494        return 0
     1495    mach = argsToMach(ctx, args)
     1496    if not mach:
    14391497        return 0
    14401498    if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
     
    14481506    expr = 'mach.'+args[0]+' = '+args[1]
    14491507    print("Executing", expr)
    1450     exec(expr)
     1508    exec(expr) # pylint: disable=exec-used
    14511509
    14521510def setvarCmd(ctx, args):
    14531511    if len(args) < 4:
    1454         print("usage: setvar [vmname|uuid] expr value")
    1455         return 0
    1456     mach = argsToMach(ctx, args)
    1457     if mach == None:
     1512        print("usage: setvar <vmname|uuid> <expr> <value>")
     1513        return 0
     1514    mach = argsToMach(ctx, args)
     1515    if not mach:
    14581516        return 0
    14591517    cmdClosedVm(ctx, mach, setvar, args[2:])
     
    14801538
    14811539    mach = argsToMach(ctx, args)
    1482     if mach == None:
     1540    if not mach:
    14831541        return 0
    14841542    cmdClosedVm(ctx, mach, setvmextra, [key, value])
     
    15161574    return 1
    15171575
    1518 def aliasCmd(ctx, args):
     1576def aliasCmd(_ctx, args):
    15191577    if len(args) == 3:
    15201578        aliases[args[1]] = args[2]
     
    15251583    return 0
    15261584
    1527 def verboseCmd(ctx, args):
     1585def verboseCmd(_ctx, args):
    15281586    global g_fVerbose
    15291587    if len(args) > 1:
     
    15331591    return 0
    15341592
    1535 def colorsCmd(ctx, args):
     1593def colorsCmd(_ctx, args):
    15361594    global g_fHasColors
    15371595    if len(args) > 1:
     
    15411599    return 0
    15421600
    1543 def hostCmd(ctx, args):
     1601def hostCmd(ctx, _args):
    15441602    vbox = ctx['vb']
    15451603    try:
     
    15951653def monitorGuestCmd(ctx, args):
    15961654    if len(args) < 2:
    1597         print("usage: monitorGuest name (duration)")
    1598         return 0
    1599     mach = argsToMach(ctx, args)
    1600     if mach == None:
     1655        print("usage: monitorGuest <vmname|uuid> (duration)")
     1656        return 0
     1657    mach = argsToMach(ctx, args)
     1658    if not mach:
    16011659        return 0
    16021660    dur = 5
     
    16121670        return 0
    16131671    mach = argsToMach(ctx, args)
    1614     if mach == None:
     1672    if not mach:
    16151673        return 0
    16161674    dur = 5
     
    16261684        return 0
    16271685    mach = argsToMach(ctx, args)
    1628     if mach == None:
     1686    if not mach:
    16291687        return 0
    16301688    dur = 5
     
    16401698        return 0
    16411699    mach = argsToMach(ctx, args)
    1642     if mach == None:
     1700    if not mach:
    16431701        return 0
    16441702    dur = 5
     
    16801738def portForwardCmd(ctx, args):
    16811739    if len(args) != 5:
    1682         print("usage: portForward <vm> <adapter> <hostPort> <guestPort>")
    1683         return 0
    1684     mach = argsToMach(ctx, args)
    1685     if mach == None:
     1740        print("usage: portForward <vmname|uuid> <adapter> <hostPort> <guestPort>")
     1741        return 0
     1742    mach = argsToMach(ctx, args)
     1743    if not mach:
    16861744        return 0
    16871745    adapterNum = int(args[2])
     
    17111769def showLogCmd(ctx, args):
    17121770    if len(args) < 2:
    1713         print("usage: showLog vm <num>")
    1714         return 0
    1715     mach = argsToMach(ctx, args)
    1716     if mach == None:
     1771        print("usage: showLog <vmname|uuid> <num>")
     1772        return 0
     1773    mach = argsToMach(ctx, args)
     1774    if not mach:
    17171775        return 0
    17181776
     
    17341792def findLogCmd(ctx, args):
    17351793    if len(args) < 3:
    1736         print("usage: findLog vm pattern <num>")
    1737         return 0
    1738     mach = argsToMach(ctx, args)
    1739     if mach == None:
     1794        print("usage: findLog <vmname|uuid> <pattern> <num>")
     1795        return 0
     1796    mach = argsToMach(ctx, args)
     1797    if not mach:
    17401798        return 0
    17411799
     
    17651823def findAssertCmd(ctx, args):
    17661824    if len(args) < 2:
    1767         print("usage: findAssert vm <num>")
    1768         return 0
    1769     mach = argsToMach(ctx, args)
    1770     if mach == None:
     1825        print("usage: findAssert <vmname|uuid> <num>")
     1826        return 0
     1827    mach = argsToMach(ctx, args)
     1828    if not mach:
    17711829        return 0
    17721830
     
    18051863    expr = ' '.join(args[1:])
    18061864    try:
    1807         exec(expr)
     1865        exec(expr) # pylint: disable=exec-used
    18081866    except Exception as e:
    18091867        printErr(ctx, e)
     
    18121870    return 0
    18131871
    1814 def reloadExtCmd(ctx, args):
     1872def reloadExtCmd(ctx, _args):
    18151873    # maybe will want more args smartness
    18161874    checkUserExtensions(ctx, commands, getHomeFolder(ctx))
     
    18231881        return 0
    18241882    try:
    1825         lf = open(args[1], 'r')
     1883        lf = open(args[1], 'r', encoding='utf-8')
    18261884    except IOError as e:
    18271885        print("cannot open:", args[1], ":", e)
     
    18461904    return 0
    18471905
    1848 def sleepCmd(ctx, args):
     1906def sleepCmd(_ctx, args):
    18491907    if len(args) != 2:
    18501908        print("usage: sleep <secs>")
     
    18591917
    18601918
    1861 def shellCmd(ctx, args):
     1919def shellCmd(_ctx, args):
    18621920    if len(args) < 2:
    18631921        print("usage: shell <commands>")
     
    19261984    return 0
    19271985
    1928 def reconnectCmd(ctx, args):
     1986def reconnectCmd(ctx, _args):
    19291987    if ctx['wsinfo'] is None:
    19301988        print("Never connected...")
     
    22382296        print("created HDD at %s as %s" % (colPath(ctx,hdd.location), hdd.id))
    22392297    else:
    2240        print("cannot create disk (file %s exist?)" % (loc))
    2241        reportError(ctx,progress)
    2242        return 0
     2298        print("cannot create disk (file %s exist?)" % (loc))
     2299        reportError(ctx,progress)
     2300        return 0
    22432301
    22442302    return 0
     
    22512309    vbox = ctx['vb']
    22522310    loc = args[1]
    2253     setImageId = False
    2254     imageId = ""
    2255     setParentId = False
    2256     parentId = ""
    22572311    hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
    22582312    print("registered HDD as %s" % (hdd.id))
    22592313    return 0
    22602314
    2261 def controldevice(ctx, mach, args):
     2315def controldevice(_ctx, mach, args):
    22622316    [ctr, port, slot, devtype, uuid] = args
    22632317    mach.attachDevice(ctr, port, slot, devtype, uuid)
     
    22652319def attachHddCmd(ctx, args):
    22662320    if len(args) < 3:
    2267         print("usage: attachHdd vm hdd controller port:slot")
     2321        print("usage: attachHdd <vmname|uuid> <hdd> <controller> <port:slot>")
    22682322        return 0
    22692323
     
    23002354def detachHddCmd(ctx, args):
    23012355    if len(args) < 3:
    2302         print("usage: detachHdd vm hdd")
     2356        print("usage: detachHdd <vmname|uuid> <hdd>")
    23032357        return 0
    23042358
     
    23832437    loc = args[1]
    23842438    try:
     2439        vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     2440    except:
     2441        print("no DVD with path %s registered" % (loc))
     2442        return 0
     2443
     2444    print("Unregistered ISO at %s" % (colPath(ctx, loc)))
     2445    return 0
     2446
     2447def removeIsoCmd(ctx, args):
     2448    if len(args) != 2:
     2449        print("usage: removeIso path")
     2450        return 0
     2451
     2452    vbox = ctx['vb']
     2453    loc = args[1]
     2454    try:
    23852455        dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
    23862456    except:
     
    23882458        return 0
    23892459
    2390     progress = dvd.close()
    2391     print("Unregistered ISO at %s" % (colPath(ctx, loc)))
    2392 
    2393     return 0
    2394 
    2395 def removeIsoCmd(ctx, args):
    2396     if len(args) != 2:
    2397         print("usage: removeIso path")
    2398         return 0
    2399 
     2460    progress = dvd.deleteStorage()
     2461    if progressBar(ctx, progress):
     2462        print("Removed ISO at %s" % (colPath(ctx, dvd.location)))
     2463    else:
     2464        reportError(ctx, progress)
     2465    return 0
     2466
     2467def attachIsoCmd(ctx, args):
     2468    if len(args) < 3:
     2469        print("usage: attachIso <vmname|uuid> <iso> <controller> <port:slot>")
     2470        return 0
     2471
     2472    mach = argsToMach(ctx, args)
     2473    if mach is None:
     2474        return 0
    24002475    vbox = ctx['vb']
    2401     loc = args[1]
     2476    loc = args[2]
    24022477    try:
    24032478        dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     
    24052480        print("no DVD with path %s registered" % (loc))
    24062481        return 0
    2407 
    2408     progress = dvd.deleteStorage()
    2409     if progressBar(ctx, progress):
    2410         print("Removed ISO at %s" % (colPath(ctx, dvd.location)))
    2411     else:
    2412         reportError(ctx, progress)
    2413     return 0
    2414 
    2415 def attachIsoCmd(ctx, args):
     2482    if len(args) > 3:
     2483        ctr = args[3]
     2484        (port, slot) = args[4].split(":")
     2485    else:
     2486        [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
     2487    cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD, dvd))
     2488    return 0
     2489
     2490def detachIsoCmd(ctx, args):
    24162491    if len(args) < 3:
    2417         print("usage: attachIso vm iso controller port:slot")
     2492        print("usage: detachIso <vmname|uuid> <iso>")
    24182493        return 0
    24192494
     
    24282503        print("no DVD with path %s registered" % (loc))
    24292504        return 0
     2505
     2506    detachMedium(ctx, mach.id, dvd)
     2507    return 0
     2508
     2509def mountIsoCmd(ctx, args):
     2510    if len(args) < 3:
     2511        print("usage: mountIso <vmname|uuid> <iso> <controller> <port:slot>")
     2512        return 0
     2513
     2514    mach = argsToMach(ctx, args)
     2515    if mach is None:
     2516        return 0
     2517    vbox = ctx['vb']
     2518    loc = args[2]
     2519    try:
     2520        dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     2521    except:
     2522        print("no DVD with path %s registered" % (loc))
     2523        return 0
     2524
    24302525    if len(args) > 3:
    24312526        ctr = args[3]
    24322527        (port, slot) = args[4].split(":")
    24332528    else:
    2434         [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
    2435     cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD, dvd))
    2436     return 0
    2437 
    2438 def detachIsoCmd(ctx, args):
    2439     if len(args) < 3:
    2440         print("usage: detachIso vm iso")
    2441         return 0
    2442 
    2443     mach = argsToMach(ctx, args)
    2444     if mach is None:
    2445         return 0
    2446     vbox = ctx['vb']
    2447     loc = args[2]
    2448     try:
    2449         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
    2450     except:
    2451         print("no DVD with path %s registered" % (loc))
    2452         return 0
    2453 
    2454     detachMedium(ctx, mach.id, dvd)
    2455     return 0
    2456 
    2457 def mountIsoCmd(ctx, args):
    2458     if len(args) < 3:
    2459         print("usage: mountIso vm iso controller port:slot")
    2460         return 0
    2461 
    2462     mach = argsToMach(ctx, args)
    2463     if mach is None:
    2464         return 0
    2465     vbox = ctx['vb']
    2466     loc = args[2]
    2467     try:
    2468         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
    2469     except:
    2470         print("no DVD with path %s registered" % (loc))
    2471         return 0
    2472 
    2473     if len(args) > 3:
    2474         ctr = args[3]
    2475         (port, slot) = args[4].split(":")
    2476     else:
    24772529        # autodetect controller and location, just find first controller with media == DVD
    24782530        [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
     
    24842536def unmountIsoCmd(ctx, args):
    24852537    if len(args) < 2:
    2486         print("usage: unmountIso vm controller port:slot")
     2538        print("usage: unmountIso <vmname|uuid> <controller> <port:slot>")
    24872539        return 0
    24882540
     
    24902542    if mach is None:
    24912543        return 0
    2492     vbox = ctx['vb']
    24932544
    24942545    if len(args) > 3:
     
    25032554    return 0
    25042555
    2505 def attachCtr(ctx, mach, args):
     2556def attachCtr(_ctx, mach, args):
    25062557    [name, bus, ctrltype] = args
    25072558    ctr = mach.addStorageController(name, bus)
     
    25112562def attachCtrCmd(ctx, args):
    25122563    if len(args) < 4:
    2513         print("usage: attachCtr vm cname bus <type>")
     2564        print("usage: attachCtr <vmname|uuid> <controller name> <bus> <type>")
    25142565        return 0
    25152566
     
    25352586def detachCtrCmd(ctx, args):
    25362587    if len(args) < 3:
    2537         print("usage: detachCtr vm name")
     2588        print("usage: detachCtr <vmname|uuid> <controller name>")
    25382589        return 0
    25392590
     
    25452596    return 0
    25462597
    2547 def usbctr(ctx, mach, console, args):
     2598def usbctr(_ctx, _mach, console, args):
    25482599    if args[0]:
    25492600        console.attachUSBDevice(args[1], "")
     
    25532604def attachUsbCmd(ctx, args):
    25542605    if len(args) < 3:
    2555         print("usage: attachUsb vm deviceuid")
     2606        print("usage: attachUsb <vmname|uuid> <device uid>")
    25562607        return 0
    25572608
     
    25652616def detachUsbCmd(ctx, args):
    25662617    if len(args) < 3:
    2567         print("usage: detachUsb vm deviceuid")
     2618        print("usage: detachUsb <vmname|uuid> <device uid>")
    25682619        return 0
    25692620
     
    25932644def shareFolderCmd(ctx, args):
    25942645    if len(args) < 4:
    2595         print("usage: shareFolder vm path name <writable> <persistent>")
     2646        print("usage: shareFolder <vmname|uuid> <path> <name> <writable|persistent>")
    25962647        return 0
    25972648
     
    26172668def unshareFolderCmd(ctx, args):
    26182669    if len(args) < 3:
    2619         print("usage: unshareFolder vm name")
     2670        print("usage: unshareFolder <vmname|uuid> <name>")
    26202671        return 0
    26212672
     
    26372688def snapshotCmd(ctx, args):
    26382689    if (len(args) < 2 or args[1] == 'help'):
    2639         print("Take snapshot:    snapshot vm take name <description>")
    2640         print("Restore snapshot: snapshot vm restore name")
    2641         print("Merge snapshot:   snapshot vm merge name")
     2690        print("Take snapshot:    snapshot <vmname|uuid> take <name> <description>")
     2691        print("Restore snapshot: snapshot <vmname|uuid> restore <name>")
     2692        print("Merge snapshot:   snapshot <vmname|uuid> merge <name>")
    26422693        return 0
    26432694
     
    26482699    if cmd == 'take':
    26492700        if len(args) < 4:
    2650             print("usage: snapshot vm take name <description>")
     2701            print("usage: snapshot <vmname|uuid> take <name> <description>")
    26512702            return 0
    26522703        name = args[3]
     
    26602711    if cmd == 'restore':
    26612712        if len(args) < 4:
    2662             print("usage: snapshot vm restore name")
     2713            print("usage: snapshot <vmname|uuid> restore <name>")
    26632714            return 0
    26642715        name = args[3]
     
    26692720    if cmd == 'restorecurrent':
    26702721        if len(args) < 4:
    2671             print("usage: snapshot vm restorecurrent")
     2722            print("usage: snapshot <vmname|uuid> restorecurrent")
    26722723            return 0
    26732724        snap = mach.currentSnapshot()
     
    26772728    if cmd == 'delete':
    26782729        if len(args) < 4:
    2679             print("usage: snapshot vm delete name")
     2730            print("usage: snapshot <vmname|uuid> delete <name>")
    26802731            return 0
    26812732        name = args[3]
     
    26872738    return 0
    26882739
    2689 def natAlias(ctx, mach, nicnum, nat, args=[]):
     2740def natAlias(_ctx, _mach, _nicnum, nat, args=[]):
    26902741    """This command shows/alters NAT's alias settings.
    2691     usage: nat <vm> <nicnum> alias [default|[log] [proxyonly] [sameports]]
     2742    usage: nat <vmname|uuid> <nicnum> alias [default|[log] [proxyonly] [sameports]]
    26922743    default - set settings to default values
    26932744    log - switch on alias logging
     
    27242775    return (0, None)
    27252776
    2726 def natSettings(ctx, mach, nicnum, nat, args):
     2777def natSettings(_ctx, _mach, _nicnum, nat, args):
    27272778    """This command shows/alters NAT settings.
    2728     usage: nat <vm> <nicnum> settings [<mtu> [[<socsndbuf> <sockrcvbuf> [<tcpsndwnd> <tcprcvwnd>]]]]
     2779    usage: nat <vmname|uuid> <nicnum> settings [<mtu> [[<socsndbuf> <sockrcvbuf> [<tcpsndwnd> <tcprcvwnd>]]]]
    27292780    mtu - set mtu <= 16000
    27302781    socksndbuf/sockrcvbuf - sets amount of kb for socket sending/receiving buffer
     
    27582809    return (0, None)
    27592810
    2760 def natDns(ctx, mach, nicnum, nat, args):
     2811def natDns(_ctx, _mach, _nicnum, nat, args):
    27612812    """This command shows/alters DNS's NAT settings
    2762     usage: nat <vm> <nicnum> dns [passdomain] [proxy] [usehostresolver]
     2813    usage: nat <vmname|uuid> <nicnum> dns [passdomain] [proxy] [usehostresolver]
    27632814    passdomain - enforces builtin DHCP server to pass domain
    27642815    proxy - switch on builtin NAT DNS proxying mechanism
     
    27772828def natTftp(ctx, mach, nicnum, nat, args):
    27782829    """This command shows/alters TFTP settings
    2779     usage nat <vm> <nicnum> tftp [prefix <prefix>| bootfile <bootfile>| server <server>]
     2830    usage nat <vmname|uuid> <nicnum> tftp [prefix <prefix>| bootfile <bootfile>| server <server>]
    27802831    prefix - alters prefix TFTP settings
    27812832    bootfile - alters bootfile TFTP settings
     
    27882839            if server is None:
    27892840                server = '10.0.%d/24' % (int(nicnum) + 2)
    2790             (server, mask) = server.split('/')
     2841            (server, _mask) = server.split('/')
    27912842            while server.count('.') != 3:
    27922843                server += '.0'
    2793             (a, b, c, d) = server.split('.')
     2844            (a, b, c, _d) = server.split('.')
    27942845            server = '%d.%d.%d.4' % (a, b, c)
    27952846        prefix = nat.TFTPPrefix
     
    28162867    return (0, None)
    28172868
    2818 def natPortForwarding(ctx, mach, nicnum, nat, args):
     2869def natPortForwarding(ctx, _mach, _nicnum, nat, args):
    28192870    """This command shows/manages port-forwarding settings
    28202871    usage:
    2821         nat <vm> <nicnum> <pf> [ simple tcp|udp <hostport> <guestport>]
     2872        nat <vmname|uuid> <nicnum> <pf> [ simple tcp|udp <hostport> <guestport>]
    28222873            |[no_name tcp|udp <hostip> <hostport> <guestip> <guestport>]
    28232874            |[ex tcp|udp <pf-name> <hostip> <hostport> <guestip> <guestport>]
     
    28592910            return (1, None)
    28602911
    2861         a = pfcmd[args[1]]['func']()
     2912        _a = pfcmd[args[1]]['func']()
    28622913    return (0, None)
    28632914
    2864 def natNetwork(ctx, mach, nicnum, nat, args):
     2915def natNetwork(_ctx, _mach, nicnum, nat, args):
    28652916    """This command shows/alters NAT network settings
    2866     usage: nat <vm> <nicnum> network [<network>]
     2917    usage: nat <vmname|uuid> <nicnum> network [<network>]
    28672918    """
    28682919    if len(args) == 1:
     
    28822933def natCmd(ctx, args):
    28832934    """This command is entry point to NAT settins management
    2884     usage: nat <vm> <nicnum> <cmd> <cmd-args>
     2935    usage: nat <vmname|uuid> <nicnum> <cmd> <cmd-args>
    28852936    cmd - [alias|settings|tftp|dns|pf|network]
    28862937    for more information about commands:
     
    29062957        print(natCmd.__doc__)
    29072958        return 0
    2908     mach = ctx['argsToMach'](args)
    2909     if mach == None:
     2959    mach = argsToMach(ctx, args)
     2960    if not mach:
    29102961        print("please specify vm")
    29112962        return 0
    2912     if len(args) < 3 or not args[2].isdigit() or int(args[2]) not in list(range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType))):
    2913         print('please specify adapter num %d isn\'t in range [0-%d]' % (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType)))
     2963    platformProps = mach.platform.properties
     2964    if len(args) < 3 or not args[2].isdigit() or int(args[2]) not in list(range(0, platformProps.getMaxNetworkAdapters(mach.platform.chipsetType))):
     2965        print('please specify adapter num %d isn\'t in range [0-%d]' % (args[2], platformProps.getMaxNetworkAdapters(mach.platform.chipsetType)))
    29142966        return 0
    29152967    nicnum = int(args[2])
     
    29543006    return (0, None)
    29553007
    2956 def nicTraceSubCmd(ctx, vm, nicnum, adapter, args):
     3008def nicTraceSubCmd(_ctx, _vm, _nicnum, adapter, args):
    29573009    '''
    2958     usage: nic <vm> <nicnum> trace [on|off [file]]
     3010    usage: nic <vmname|uuid> <nicnum> trace [on|off [file]]
    29593011    '''
    29603012    (rc, r) = nicSwitchOnOff(adapter, 'traceEnabled', args)
     
    29663018    return (0, None)
    29673019
    2968 def nicLineSpeedSubCmd(ctx, vm, nicnum, adapter, args):
     3020def nicLineSpeedSubCmd(_ctx, _vm, _nicnum, adapter, args):
    29693021    if len(args) == 1:
    29703022        r = '%d kbps'% (adapter.lineSpeed)
     
    29773029    return (0, None)
    29783030
    2979 def nicCableSubCmd(ctx, vm, nicnum, adapter, args):
     3031def nicCableSubCmd(_ctx, _vm, _nicnum, adapter, args):
    29803032    '''
    2981     usage: nic <vm> <nicnum> cable [on|off]
     3033    usage: nic <vmname|uuid> <nicnum> cable [on|off]
    29823034    '''
    29833035    return nicSwitchOnOff(adapter, 'cableConnected', args)
    29843036
    2985 def nicEnableSubCmd(ctx, vm, nicnum, adapter, args):
     3037def nicEnableSubCmd(_ctx, _vm, _nicnum, adapter, args):
    29863038    '''
    2987     usage: nic <vm> <nicnum> enable [on|off]
     3039    usage: nic <vmname|uuid> <nicnum> enable [on|off]
    29883040    '''
    29893041    return nicSwitchOnOff(adapter, 'enabled', args)
    29903042
    2991 def nicTypeSubCmd(ctx, vm, nicnum, adapter, args):
     3043def nicTypeSubCmd(ctx, _vm, _nicnum, adapter, args):
    29923044    '''
    2993     usage: nic <vm> <nicnum> type [Am79c970A|Am79c970A|I82540EM|I82545EM|I82543GC|Virtio]
     3045    usage: nic <vmname|uuid> <nicnum> type [Am79c970A|Am79c970A|I82540EM|I82545EM|I82543GC|Virtio]
    29943046    '''
    29953047    if len(args) == 1:
     
    30073059    return (0, None)
    30083060
    3009 def nicAttachmentSubCmd(ctx, vm, nicnum, adapter, args):
     3061def nicAttachmentSubCmd(ctx, _vm, _nicnum, adapter, args):
    30103062    '''
    3011     usage: nic <vm> <nicnum> attachment [Null|NAT|Bridged <interface>|Internal <name>|HostOnly <interface>
     3063    usage: nic <vmname|uuid> <nicnum> attachment [Null|NAT|Bridged <interface>|Internal <name>|HostOnly <interface>
    30123064    '''
    30133065    if len(args) == 1:
     
    30683120    '''
    30693121    This command to manage network adapters
    3070     usage: nic <vm> <nicnum> <cmd> <cmd-args>
     3122    usage: nic <vmname|uuid> <nicnum> <cmd> <cmd-args>
    30713123    where cmd : attachment, trace, linespeed, cable, enable, type
    30723124    '''
     
    30953147        return 0
    30963148
     3149    platformProps = vm.platform.properties
    30973150    if    len(args) < 3 \
    3098        or int(args[2]) not in list(range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType))):
    3099         print('please specify adapter num %d isn\'t in range [0-%d]'% (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType)))
     3151       or int(args[2]) not in list(range(0, platformProps.getMaxNetworkAdapters(vm.platform.chipsetType))):
     3152        print('please specify adapter num %d isn\'t in range [0-%d]'% (args[2], platformProps.getMaxNetworkAdapters(vm.platform.chipsetType)))
    31003153        return 0
    31013154    nicnum = int(args[2])
     
    31523205def recordDemoCmd(ctx, args):
    31533206    if len(args) < 3:
    3154         print("usage: recordDemo vm filename (duration)")
    3155         return 0
    3156     mach = argsToMach(ctx, args)
    3157     if mach == None:
     3207        print("usage: recordDemo <vmname|uuid> <filename> [duration in s]")
     3208        return 0
     3209    mach = argsToMach(ctx, args)
     3210    if not mach:
    31583211        return 0
    31593212    filename = args[2]
     
    31663219def playbackDemoCmd(ctx, args):
    31673220    if len(args) < 3:
    3168         print("usage: playbackDemo vm filename (duration)")
    3169         return 0
    3170     mach = argsToMach(ctx, args)
    3171     if mach == None:
     3221        print("usage: playbackDemo <vmname|uuid> <filename> [duration in s]")
     3222        return 0
     3223    mach = argsToMach(ctx, args)
     3224    if not mach:
    31723225        return 0
    31733226    filename = args[2]
     
    32103263        return 0
    32113264    mach = argsToMach(ctx, args)
    3212     if mach == None:
     3265    if not mach:
    32133266        return 0
    32143267    cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args:  lspci(ctx, console)])
     
    32173270def attachpciCmd(ctx, args):
    32183271    if len(args) < 3:
    3219         print("usage: attachpci vm hostpci <guestpci>")
    3220         return 0
    3221     mach = argsToMach(ctx, args)
    3222     if mach == None:
     3272        print("usage: attachpci <vmname|uuid> <host pci address> <guest pci address>")
     3273        return 0
     3274    mach = argsToMach(ctx, args)
     3275    if not mach:
    32233276        return 0
    32243277    hostaddr = parsePci(args[2])
     
    32393292def detachpciCmd(ctx, args):
    32403293    if len(args) < 3:
    3241         print("usage: detachpci vm hostpci")
    3242         return 0
    3243     mach = argsToMach(ctx, args)
    3244     if mach == None:
     3294        print("usage: detachpci <vmname|uuid> <host pci address>")
     3295        return 0
     3296    mach = argsToMach(ctx, args)
     3297    if not mach:
    32453298        return 0
    32463299    hostaddr = parsePci(args[2])
     
    32733326
    32743327commands = {'help':['Prints help information', helpCmd, 0],
    3275             'start':['Start virtual machine by name or uuid: start Linux headless', startCmd, 0],
    3276             'createVm':['Create virtual machine: createVm macvm MacOS', createVmCmd, 0],
     3328            'start':['Start virtual machine by name or uuid: start mytestvm headless', startCmd, 0],
     3329            'createVm':['Create virtual machine: createVm myvmname x86 MacOS', createVmCmd, 0],
    32773330            'removeVm':['Remove virtual machine', removeVmCmd, 0],
    32783331            'pause':['Pause virtual machine', pauseCmd, 0],
     
    32903343            'alias':['Control aliases', aliasCmd, 0],
    32913344            'verbose':['Toggle verbosity', verboseCmd, 0],
    3292             'setvar':['Set VMs variable: setvar Fedora BIOSSettings.ACPIEnabled True', setvarCmd, 0],
     3345            'setvar':['Set VM variable: setvar mytestvm firmwareSettings.ACPIEnabled True', setvarCmd, 0],
    32933346            'eval':['Evaluate arbitrary Python construction: eval \'for m in getMachines(ctx): print(m.name, "has", m.memorySize, "M")\'', evalCmd, 0],
    32943347            'quit':['Exits', quitCmd, 0],
    32953348            'host':['Show host information', hostCmd, 0],
    3296             'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0],
    3297             'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd, 0],
    3298             'monitorGuestKbd':['Monitor guest keyboard for some time: monitorGuestKbd Win32 10', monitorGuestKbdCmd, 0],
    3299             'monitorGuestMouse':['Monitor guest mouse for some time: monitorGuestMouse Win32 10', monitorGuestMouseCmd, 0],
    3300             'monitorGuestMultiTouch':['Monitor guest touch screen for some time: monitorGuestMultiTouch Win32 10', monitorGuestMultiTouchCmd, 0],
     3349            'guest':['Execute command for guest: guest mytestvm \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0],
     3350            'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest mytestvm 10', monitorGuestCmd, 0],
     3351            'monitorGuestKbd':['Monitor guest keyboard for some time: monitorGuestKbd mytestvm 10', monitorGuestKbdCmd, 0],
     3352            'monitorGuestMouse':['Monitor guest mouse for some time: monitorGuestMouse mytestvm 10', monitorGuestMouseCmd, 0],
     3353            'monitorGuestMultiTouch':['Monitor guest touch screen for some time: monitorGuestMultiTouch mytestvm 10', monitorGuestMultiTouchCmd, 0],
    33013354            'monitorVBox':['Monitor what happens with VirtualBox for some time: monitorVBox 10', monitorVBoxCmd, 0],
    3302             'portForward':['Setup permanent port forwarding for a VM, takes adapter number host port and guest port: portForward Win32 0 8080 80', portForwardCmd, 0],
    3303             'showLog':['Show log file of the VM, : showLog Win32', showLogCmd, 0],
    3304             'findLog':['Show entries matching pattern in log file of the VM, : findLog Win32 PDM|CPUM', findLogCmd, 0],
    3305             'findAssert':['Find assert in log file of the VM, : findAssert Win32', findAssertCmd, 0],
     3355            'portForward':['Setup permanent port forwarding for a VM, takes adapter number host port and guest port: portForward mytestvm 0 8080 80', portForwardCmd, 0],
     3356            'showLog':['Show log file of the VM, : showLog mytestvm', showLogCmd, 0],
     3357            'findLog':['Show entries matching pattern in log file of the VM, : findLog mytestvm PDM|CPUM', findLogCmd, 0],
     3358            'findAssert':['Find assert in log file of the VM, : findAssert mytestvm', findAssertCmd, 0],
    33063359            'reloadExt':['Reload custom extensions: reloadExt', reloadExtCmd, 0],
    33073360            'runScript':['Run VBox script: runScript script.vbox', runScriptCmd, 0],
    33083361            'sleep':['Sleep for specified number of seconds: sleep 3.14159', sleepCmd, 0],
    33093362            'shell':['Execute external shell command: shell "ls /etc/rc*"', shellCmd, 0],
    3310             'exportVm':['Export VM in OVF format: exportVm Win /tmp/win.ovf', exportVMCmd, 0],
    3311             'screenshot':['Take VM screenshot to a file: screenshot Win /tmp/win.png 1024 768 0', screenshotCmd, 0],
    3312             'teleport':['Teleport VM to another box (see openportal): teleport Win anotherhost:8000 <passwd> <maxDowntime>', teleportCmd, 0],
     3363            'exportVm':['Export VM in OVF format: exportVm mytestvm /tmp/win.ovf', exportVMCmd, 0],
     3364            'screenshot':['Take VM screenshot to a file: screenshot mytestvm /tmp/win.png 1024 768 0', screenshotCmd, 0],
     3365            'teleport':['Teleport VM to another box (see openportal): teleport mytestvm anotherhost:8000 <passwd> <maxDowntime>', teleportCmd, 0],
    33133366            'typeGuest':['Type arbitrary text in guest: typeGuest Linux "^lls\\n&UP;&BKSP;ess /etc/hosts\\nq^c" 0.7', typeGuestCmd, 0],
    3314             'openportal':['Open portal for teleportation of VM from another box (see teleport): openportal Win 8000 <passwd>', openportalCmd, 0],
     3367            'openportal':['Open portal for teleportation of VM from another box (see teleport): openportal mytestvm 8000 <passwd>', openportalCmd, 0],
    33153368            'closeportal':['Close teleportation portal (see openportal, teleport): closeportal Win', closeportalCmd, 0],
    33163369            'getextra':['Get extra data, empty key lists all: getextra <vm|global> <key>', getExtraDataCmd, 0],
    33173370            'setextra':['Set extra data, empty value removes key: setextra <vm|global> <key> <value>', setExtraDataCmd, 0],
    3318             'gueststats':['Print available guest stats (only Windows guests with additions so far): gueststats Win32', gueststatsCmd, 0],
    3319             'plugcpu':['Add a CPU to a running VM: plugcpu Win 1', plugcpuCmd, 0],
     3371            'gueststats':['Print available guest stats (only Windows guests with additions so far): gueststats mytestvm', gueststatsCmd, 0],
     3372            'plugcpu':['Add a CPU to a running VM: plugcpu mytestvm 1', plugcpuCmd, 0],
    33203373            'unplugcpu':['Remove a CPU from a running VM (additions required, Windows cannot unplug): unplugcpu Linux 1', unplugcpuCmd, 0],
    33213374            'createHdd': ['Create virtual HDD:  createHdd 1000 /disk.vdi ', createHddCmd, 0],
     
    33233376            'registerHdd': ['Register HDD image with VirtualBox instance: registerHdd /disk.vdi', registerHddCmd, 0],
    33243377            'unregisterHdd': ['Unregister HDD image with VirtualBox instance: unregisterHdd /disk.vdi', unregisterHddCmd, 0],
    3325             'attachHdd': ['Attach HDD to the VM: attachHdd win /disk.vdi "IDE Controller" 0:1', attachHddCmd, 0],
    3326             'detachHdd': ['Detach HDD from the VM: detachHdd win /disk.vdi', detachHddCmd, 0],
     3378            'attachHdd': ['Attach HDD to the VM: attachHdd mytestvm /disk.vdi "IDE Controller" 0:1', attachHddCmd, 0],
     3379            'detachHdd': ['Detach HDD from the VM: detachHdd mytestvm /disk.vdi', detachHddCmd, 0],
    33273380            'registerIso': ['Register CD/DVD image with VirtualBox instance: registerIso /os.iso', registerIsoCmd, 0],
    33283381            'unregisterIso': ['Unregister CD/DVD image with VirtualBox instance: unregisterIso /os.iso', unregisterIsoCmd, 0],
    33293382            'removeIso': ['Permanently remove CD/DVD image: removeIso /os.iso', removeIsoCmd, 0],
    3330             'attachIso': ['Attach CD/DVD to the VM: attachIso win /os.iso "IDE Controller" 0:1', attachIsoCmd, 0],
    3331             'detachIso': ['Detach CD/DVD from the VM: detachIso win /os.iso', detachIsoCmd, 0],
    3332             'mountIso': ['Mount CD/DVD to the running VM: mountIso win /os.iso "IDE Controller" 0:1', mountIsoCmd, 0],
    3333             'unmountIso': ['Unmount CD/DVD from running VM: unmountIso win "IDE Controller" 0:1', unmountIsoCmd, 0],
    3334             'attachCtr': ['Attach storage controller to the VM: attachCtr win Ctr0 IDE ICH6', attachCtrCmd, 0],
    3335             'detachCtr': ['Detach HDD from the VM: detachCtr win Ctr0', detachCtrCmd, 0],
    3336             'attachUsb': ['Attach USB device to the VM (use listUsb to show available devices): attachUsb win uuid', attachUsbCmd, 0],
    3337             'detachUsb': ['Detach USB device from the VM: detachUsb win uuid', detachUsbCmd, 0],
     3383            'attachIso': ['Attach CD/DVD to the VM: attachIso mytestvm /os.iso "IDE Controller" 0:1', attachIsoCmd, 0],
     3384            'detachIso': ['Detach CD/DVD from the VM: detachIso mytestvm /os.iso', detachIsoCmd, 0],
     3385            'mountIso': ['Mount CD/DVD to the running VM: mountIso mytestvm /os.iso "IDE Controller" 0:1', mountIsoCmd, 0],
     3386            'unmountIso': ['Unmount CD/DVD from running VM: unmountIso mytestvm "IDE Controller" 0:1', unmountIsoCmd, 0],
     3387            'attachCtr': ['Attach storage controller to the VM: attachCtr mytestvm Ctr0 IDE ICH6', attachCtrCmd, 0],
     3388            'detachCtr': ['Detach HDD from the VM: detachCtr mytestvm Ctr0', detachCtrCmd, 0],
     3389            'attachUsb': ['Attach USB device to the VM (use listUsb to show available devices): attachUsb mytestvm uuid', attachUsbCmd, 0],
     3390            'detachUsb': ['Detach USB device from the VM: detachUsb mytestvm uuid', detachUsbCmd, 0],
    33383391            'listMedia': ['List media known to this VBox instance', listMediaCmd, 0],
    33393392            'listUsb': ['List known USB devices', listUsbCmd, 0],
    3340             'shareFolder': ['Make host\'s folder visible to guest: shareFolder win /share share writable', shareFolderCmd, 0],
     3393            'shareFolder': ['Make host\'s folder visible to guest: shareFolder mytestvm /share share writable', shareFolderCmd, 0],
    33413394            'unshareFolder': ['Remove folder sharing', unshareFolderCmd, 0],
    33423395            'gui': ['Start GUI frontend', guiCmd, 0],
     
    33483401            'foreachvm' : ['Perform command for each VM', foreachvmCmd, 0],
    33493402            'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm[@OSTypeId=\'MacOS\'] "print(obj.name)"', foreachCmd, 0],
    3350             'recordDemo':['Record demo: recordDemo Win32 file.dmo 10', recordDemoCmd, 0],
    3351             'playbackDemo':['Playback demo: playbackDemo Win32 file.dmo 10', playbackDemoCmd, 0],
    3352             'lspci': ['List PCI devices attached to the VM: lspci Win32', lspciCmd, 0],
    3353             'attachpci': ['Attach host PCI device to the VM: attachpci Win32 01:00.0', attachpciCmd, 0],
    3354             'detachpci': ['Detach host PCI device from the VM: detachpci Win32 01:00.0', detachpciCmd, 0],
     3403            'recordDemo':['Record demo: recordDemo mytestvm file.dmo 10', recordDemoCmd, 0],
     3404            'playbackDemo':['Playback demo: playbackDemo mytestvm file.dmo 10', playbackDemoCmd, 0],
     3405            'lspci': ['List PCI devices attached to the VM: lspci mytestvm', lspciCmd, 0],
     3406            'attachpci': ['Attach host PCI device to the VM: attachpci mytestvm 01:00.0', attachpciCmd, 0],
     3407            'detachpci': ['Detach host PCI device from the VM: detachpci mytestvm 01:00.0', detachpciCmd, 0],
    33553408            'goto': ['Go to line in script (script-only)', gotoCmd, 0]
    33563409            }
     
    33943447# they will also be picked up, so this way one can exchange
    33953448# shell extensions easily.
    3396 def addExtsFromFile(ctx, cmds, filename):
     3449def addExtsFromFile(_ctx, cmds, filename):
    33973450    if not os.path.isfile(filename):
    33983451        return
    33993452    d = {}
    34003453    try:
    3401         exec(compile(open(filename).read(), filename, 'exec'), d, d)
     3454        exec(compile(open(filename, encoding='utf-8').read(), filename, 'exec'), d, d) # pylint: disable=exec-used
    34023455        for (k, v) in list(d['commands'].items()):
    34033456            if g_fVerbose:
     
    34823535            else:
    34833536                if sys.version_info[0] <= 2:
    3484                     cmd = raw_input(ctx['prompt'])
     3537                    cmd = raw_input(ctx['prompt']) # pylint: disable=undefined-variable
    34853538                else:
    34863539                    cmd = input(ctx['prompt'])
     
    35023555    try:
    35033556        # There is no need to disable metric collection. This is just an example.
    3504         if ct['perf']:
     3557        if ctx['perf']:
    35053558            ctx['perf'].disable(['*'], [vbox.host])
    35063559    except:
     
    35153568def runGuestCommandCb(ctx, uuid, guestLambda, args):
    35163569    mach = machById(ctx, uuid)
    3517     if mach == None:
     3570    if not mach:
    35183571        return 0
    35193572    args.insert(0, guestLambda)
     
    35213574    return 0
    35223575
    3523 def main(argv):
     3576def main(_argv):
    35243577
    35253578    #
     
    35343587    parse.add_option("-o", dest="opt_line", help = "option line")
    35353588    global g_fVerbose, g_sScriptFile, g_fBatchMode, g_fHasColors, g_fHasReadline, g_sCmd
    3536     (options, args) = parse.parse_args()
     3589    (options, _args) = parse.parse_args()
    35373590    g_fVerbose = options.verbose
    35383591    style = options.style
     
    36333686if __name__ == '__main__':
    36343687    main(sys.argv)
    3635 
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette