Overview
Comment: | Removed some pylint warnings |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
86c3c38746aff6232f6a491d228a7c82 |
User & Date: | vitus on 2019-10-04 17:14:01 |
Other Links: | manifest | tags |
Context
2020-01-14
| ||
12:00 | Some documentation improvements check-in: bea4cf20e9 user: vitus tags: trunk | |
2019-10-04
| ||
17:14 | Removed some pylint warnings check-in: 86c3c38746 user: vitus tags: trunk | |
09:44 | Removed extra undescore from list of keys check-in: 9139746602 user: vitus tags: trunk | |
Changes
Modified vws from [772ec62123] to [7cc9536f49].
︙ | ︙ | |||
145 146 147 148 149 150 151 | answer = send_command(sock, "info block") return re.search(": /tmp", answer) is not None def read_netinfo(filename): """ Reads network information from start script """ with open(filename, "r") as f: for line in f: | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | answer = send_command(sock, "info block") return re.search(": /tmp", answer) is not None def read_netinfo(filename): """ Reads network information from start script """ with open(filename, "r") as f: for line in f: match = re.search("-net nic,(?:\\S*,)?macaddr=(\\S+) -net ([^, ]+)", line) if match: f = {"mac":match.group(1)} if match.group(2) == "user": f["iface"] = "user" elif match.group(2) == "bridge": f["iface"] = re.search("br=(\\S+)", line).group(1) else: |
︙ | ︙ | |||
338 339 340 341 342 343 344 | def cmd_cdrom(options): """ vws cdrom """ if options.id is None: # Search for devices which could be interpreted as CDROM devlist = send_command(options.sock, "info block") idx = devlist.find("info block") if idx != -1: | | | | | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | def cmd_cdrom(options): """ vws cdrom """ if options.id is None: # Search for devices which could be interpreted as CDROM devlist = send_command(options.sock, "info block") idx = devlist.find("info block") if idx != -1: devlist = devlist[devlist.find("\n", idx)+1:] for dev in devlist.split("\r\n\r\n"): if dev.find("\n Removable device: ") == -1: continue if dev.startswith("floppy"): continue dev_id = dev[:dev.find(":")] idx = dev_id.find(" ") if idx != -1: dev_id = dev[:idx] options.id = dev_id break if options.id is None: print("No CDROM device found among:\n" + devlist, file=sys.stderr) return 1 if options.file == "": print("Please specify either --eject or iso image", file=sys.stderr) return 1 if options.file is None: |
︙ | ︙ | |||
546 547 548 549 550 551 552 | else: print(send_command(options.sock, "stopcapture " + match.group(1))) def cmd_sendkey(options): """ vws sendkey """ for keyspec in options.keyspec: if keyspec == " ": | | | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | else: print(send_command(options.sock, "stopcapture " + match.group(1))) def cmd_sendkey(options): """ vws sendkey """ for keyspec in options.keyspec: if keyspec == " ": keyspec = "spc" print(send_command(options.sock, "sendkey " + keyspec)) def cmd_version(_): """ vws cersion """ print(VERSION) |
︙ | ︙ | |||
948 949 950 951 952 953 954 | # Parse argument args = ArgumentParser(description="Manage Virtual Workstations") cmds = args.add_subparsers(dest='command', help="sub-command help") p = cmds.add_parser("list", help="List existing VWs", description="List existing VWs") p.add_argument("-l", "--state", const=True, default=False, dest='state', action='store_const', help='Show state of the machine') | | | | | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | # Parse argument args = ArgumentParser(description="Manage Virtual Workstations") cmds = args.add_subparsers(dest='command', help="sub-command help") p = cmds.add_parser("list", help="List existing VWs", description="List existing VWs") p.add_argument("-l", "--state", const=True, default=False, dest='state', action='store_const', help='Show state of the machine') p.add_argument('-u', "--usb", action='store_const', const=True, default=False, dest='usb', help='Show connected USB devices') p.add_argument("pattern", nargs='*', default='*', help="Name patterns") p = cmds.add_parser("version", help="show vws version") p = cmds.add_parser("autostart", help="Autostart all VMs marked as autostartable") p = cmds.add_parser("shutdown", help="shut down all running VMs") p.add_argument('-w', "--wait", help="wait until all machines would be shutdown", action="store_const", const=True, default=False, dest="wait") p.add_argument('-t', "--timeout", type=int, default=90, help="how long to way for VMs shutdown before forcing it off") # Power management p = new_command(cmds, 'start', help='Start VW and connect to console', description="Start VW if not running and connect " + |
︙ | ︙ | |||
1015 1016 1017 1018 1019 1020 1021 | p.add_argument('snapname', help='name of snapshot to revert to') p = new_command(cmds, 'commit', help='Commit snapshot changes into backing file') p = new_command(cmds, 'snapshots', help='List existing snapshots') # Screenshoits and recording p = new_command(cmds, 'screenshot', help='take a screenshot', description='Takes a screenshot', | | > | | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | p.add_argument('snapname', help='name of snapshot to revert to') p = new_command(cmds, 'commit', help='Commit snapshot changes into backing file') p = new_command(cmds, 'snapshots', help='List existing snapshots') # Screenshoits and recording p = new_command(cmds, 'screenshot', help='take a screenshot', description='Takes a screenshot', epilog="Writes current screen contents of the virtual " + "machine into PPM format file") p.add_argument('filename', metavar='filename.ppm', help='PPM image filename to write screenshot to') p = new_command(cmds, 'record', help='Record audio output from VM') p.add_argument('filename', help='wav file to record autdio to') new_command(cmds, 'stoprecord', help='stop recording audio') p = new_command(cmds, 'sendkey', help='Send a keystroke to VM', description='Send a key combination into VM', epilog='Each key combination should be passed as separate' + 'argument.\nAll non-alphanumeric keys should be passed by' + |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 | parsed_args = args.parse_args(sys.argv[1:]) os.umask(0o002) # Create command is totally different, so it is handled separately if parsed_args.command == 'create': try: cmd_create(parsed_args) | | | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | parsed_args = args.parse_args(sys.argv[1:]) os.umask(0o002) # Create command is totally different, so it is handled separately if parsed_args.command == 'create': try: cmd_create(parsed_args) except Exception as ex: # pylint: disable=broad-except print(str(ex), file=sys.stderr) if hasattr(parsed_args, "dir"): import shutil shutil.rmtree(parsed_args.dir) sys.exit(1) sys.exit(0) |
︙ | ︙ |