From 2be8c634584561158960fc5cf2f363f3f5c4cc4c Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Tue, 3 Nov 2020 06:43:57 +0100 Subject: [PATCH] pycodestyle fixes --- cdist/argparse.py | 2 +- cdist/scan/commandline.py | 2 +- cdist/scan/scan.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cdist/argparse.py b/cdist/argparse.py index ff195e8c..88759d7b 100644 --- a/cdist/argparse.py +++ b/cdist/argparse.py @@ -473,7 +473,7 @@ def get_parsers(): # Scan = config + further parser['scan'] = parser['sub'].add_parser('scan', add_help=False, - parents=[parser['config']]) + parents=[parser['config']]) parser['scan'] = parser['sub'].add_parser( 'scan', parents=[parser['loglevel'], diff --git a/cdist/scan/commandline.py b/cdist/scan/commandline.py index 0fb718e5..eca4cf13 100644 --- a/cdist/scan/commandline.py +++ b/cdist/scan/commandline.py @@ -37,7 +37,7 @@ def commandline(args): if not args.mode: # By default scan and trigger, but do not call any action - args.mode = ['scan', 'trigger' ] + args.mode = ['scan', 'trigger', ] if 'trigger' in args.mode: t = scan.Trigger(interfaces=args.interfaces) diff --git a/cdist/scan/scan.py b/cdist/scan/scan.py index fcbf1899..0ce4dff3 100644 --- a/cdist/scan/scan.py +++ b/cdist/scan/scan.py @@ -30,9 +30,12 @@ # Scanner logic # - save results to configdir: # basedir = ~/.cdist/scan/ -# last_seen = ~/.cdist/scan//last_seen -- record unix time or similar -# last_configured = ~/.cdist/scan//last_configured -- record unix time or similar -# last_installed = ~/.cdist/scan//last_configured -- record unix time or similar +# last_seen = ~/.cdist/scan//last_seen -- record unix time +# or similar +# last_configured = ~/.cdist/scan//last_configured -- record +# unix time or similar +# last_installed = ~/.cdist/scan//last_configured -- record +# unix time or similar # # # @@ -58,6 +61,7 @@ import datetime log = logging.getLogger("scan") + class Trigger(object): """ Trigger an ICMPv6EchoReply from all hosts that are alive @@ -91,6 +95,7 @@ class Trigger(object): log.debug(f"Sending request on {interface}") send(packet, verbose=self.verbose) + class Scanner(object): """ Scan for replies of hosts, maintain the up-to-date database @@ -134,7 +139,6 @@ class Scanner(object): prn=self.handle_pkg) - if __name__ == '__main__': t = Trigger(interfaces=["wlan0"]) t.start()