[scanner] fix minor CLI handling and --list bugs / typo
This commit is contained in:
		
					parent
					
						
							
								ab10b453f2
							
						
					
				
			
			
				commit
				
					
						b8733c65f5
					
				
			
		
					 2 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
					@ -495,7 +495,7 @@ def get_parsers():
 | 
				
			||||||
        action='store_true',
 | 
					        action='store_true',
 | 
				
			||||||
        help='Try to configure detected hosts')
 | 
					        help='Try to configure detected hosts')
 | 
				
			||||||
    parser['scan'].add_argument(
 | 
					    parser['scan'].add_argument(
 | 
				
			||||||
        '-I', '--interfaces',
 | 
					        '-I', '--interface',
 | 
				
			||||||
        action='append',  default=[], required=True,
 | 
					        action='append',  default=[], required=True,
 | 
				
			||||||
        help='On which interfaces to scan/trigger')
 | 
					        help='On which interfaces to scan/trigger')
 | 
				
			||||||
    parser['scan'].add_argument(
 | 
					    parser['scan'].add_argument(
 | 
				
			||||||
| 
						 | 
					@ -503,7 +503,7 @@ def get_parsers():
 | 
				
			||||||
        action='store',  default=None,
 | 
					        action='store',  default=None,
 | 
				
			||||||
        help='Map addresses to names, required for config mode')
 | 
					        help='Map addresses to names, required for config mode')
 | 
				
			||||||
    parser['scan'].add_argument(
 | 
					    parser['scan'].add_argument(
 | 
				
			||||||
        '-d', '--delay',
 | 
					        '-d', '--config-delay',
 | 
				
			||||||
        action='store',  default=3600, type=int,
 | 
					        action='store',  default=3600, type=int,
 | 
				
			||||||
        help='How long (seconds) to wait before reconfiguring after last try')
 | 
					        help='How long (seconds) to wait before reconfiguring after last try')
 | 
				
			||||||
    parser['scan'].add_argument(
 | 
					    parser['scan'].add_argument(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ def run(scan, args):
 | 
				
			||||||
    processes = []
 | 
					    processes = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if 'trigger' in args.mode:
 | 
					    if 'trigger' in args.mode:
 | 
				
			||||||
        t = scan.Trigger(interfaces=args.interfaces,
 | 
					        t = scan.Trigger(interfaces=args.interface,
 | 
				
			||||||
                         sleeptime=args.trigger_delay)
 | 
					                         sleeptime=args.trigger_delay)
 | 
				
			||||||
        t.start()
 | 
					        t.start()
 | 
				
			||||||
        processes.append(t)
 | 
					        processes.append(t)
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ def run(scan, args):
 | 
				
			||||||
    if 'scan' in args.mode:
 | 
					    if 'scan' in args.mode:
 | 
				
			||||||
        s = scan.Scanner(
 | 
					        s = scan.Scanner(
 | 
				
			||||||
                autoconfigure='config' in args.mode,
 | 
					                autoconfigure='config' in args.mode,
 | 
				
			||||||
                interfaces=args.interfaces,
 | 
					                interfaces=args.interface,
 | 
				
			||||||
                name_mapper=args.name_mapper)
 | 
					                name_mapper=args.name_mapper)
 | 
				
			||||||
        s.start()
 | 
					        s.start()
 | 
				
			||||||
        processes.append(s)
 | 
					        processes.append(s)
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ def run(scan, args):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def list(scan, args):
 | 
					def list(scan, args):
 | 
				
			||||||
    s = scan.Scanner(interfaces=args.interfaces, name_mapper=args.name_mapper)
 | 
					    s = scan.Scanner(interfaces=args.interface, name_mapper=args.name_mapper)
 | 
				
			||||||
    hosts = s.list()
 | 
					    hosts = s.list()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # A full IPv6 addresses id composed of 8 blocks of 4 hexa chars +
 | 
					    # A full IPv6 addresses id composed of 8 blocks of 4 hexa chars +
 | 
				
			||||||
| 
						 | 
					@ -75,10 +75,10 @@ def list(scan, args):
 | 
				
			||||||
            last_seen = '-'
 | 
					            last_seen = '-'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        last_configured = host.last_configured()
 | 
					        last_configured = host.last_configured()
 | 
				
			||||||
        if last_configured:
 | 
					        if last_configured is not None:
 | 
				
			||||||
            last_configured = last_configured.strftime(scan.datetime_format)
 | 
					            last_configured = last_configured.strftime(scan.datetime_format)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            '-'
 | 
					            last_configured = '-'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        print("{} | {} | {} | {}".format(
 | 
					        print("{} | {} | {} | {}".format(
 | 
				
			||||||
            host.name(default='-').ljust(name_max_size),
 | 
					            host.name(default='-').ljust(name_max_size),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue