forked from ungleich-public/cdist
pycodestyle fixes
This commit is contained in:
parent
09dfcfe81e
commit
2be8c63458
3 changed files with 10 additions and 6 deletions
|
@ -473,7 +473,7 @@ def get_parsers():
|
||||||
|
|
||||||
# Scan = config + further
|
# Scan = config + further
|
||||||
parser['scan'] = parser['sub'].add_parser('scan', add_help=False,
|
parser['scan'] = parser['sub'].add_parser('scan', add_help=False,
|
||||||
parents=[parser['config']])
|
parents=[parser['config']])
|
||||||
|
|
||||||
parser['scan'] = parser['sub'].add_parser(
|
parser['scan'] = parser['sub'].add_parser(
|
||||||
'scan', parents=[parser['loglevel'],
|
'scan', parents=[parser['loglevel'],
|
||||||
|
|
|
@ -37,7 +37,7 @@ def commandline(args):
|
||||||
|
|
||||||
if not args.mode:
|
if not args.mode:
|
||||||
# By default scan and trigger, but do not call any action
|
# By default scan and trigger, but do not call any action
|
||||||
args.mode = ['scan', 'trigger' ]
|
args.mode = ['scan', 'trigger', ]
|
||||||
|
|
||||||
if 'trigger' in args.mode:
|
if 'trigger' in args.mode:
|
||||||
t = scan.Trigger(interfaces=args.interfaces)
|
t = scan.Trigger(interfaces=args.interfaces)
|
||||||
|
|
|
@ -30,9 +30,12 @@
|
||||||
# Scanner logic
|
# Scanner logic
|
||||||
# - save results to configdir:
|
# - save results to configdir:
|
||||||
# basedir = ~/.cdist/scan/<ipv6-address>
|
# basedir = ~/.cdist/scan/<ipv6-address>
|
||||||
# last_seen = ~/.cdist/scan/<ipv6-address>/last_seen -- record unix time or similar
|
# last_seen = ~/.cdist/scan/<ipv6-address>/last_seen -- record unix time
|
||||||
# last_configured = ~/.cdist/scan/<ipv6-address>/last_configured -- record unix time or similar
|
# or similar
|
||||||
# last_installed = ~/.cdist/scan/<ipv6-address>/last_configured -- record unix time or similar
|
# last_configured = ~/.cdist/scan/<ipv6-address>/last_configured -- record
|
||||||
|
# unix time or similar
|
||||||
|
# last_installed = ~/.cdist/scan/<ipv6-address>/last_configured -- record
|
||||||
|
# unix time or similar
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -58,6 +61,7 @@ import datetime
|
||||||
|
|
||||||
log = logging.getLogger("scan")
|
log = logging.getLogger("scan")
|
||||||
|
|
||||||
|
|
||||||
class Trigger(object):
|
class Trigger(object):
|
||||||
"""
|
"""
|
||||||
Trigger an ICMPv6EchoReply from all hosts that are alive
|
Trigger an ICMPv6EchoReply from all hosts that are alive
|
||||||
|
@ -91,6 +95,7 @@ class Trigger(object):
|
||||||
log.debug(f"Sending request on {interface}")
|
log.debug(f"Sending request on {interface}")
|
||||||
send(packet, verbose=self.verbose)
|
send(packet, verbose=self.verbose)
|
||||||
|
|
||||||
|
|
||||||
class Scanner(object):
|
class Scanner(object):
|
||||||
"""
|
"""
|
||||||
Scan for replies of hosts, maintain the up-to-date database
|
Scan for replies of hosts, maintain the up-to-date database
|
||||||
|
@ -134,7 +139,6 @@ class Scanner(object):
|
||||||
prn=self.handle_pkg)
|
prn=self.handle_pkg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
t = Trigger(interfaces=["wlan0"])
|
t = Trigger(interfaces=["wlan0"])
|
||||||
t.start()
|
t.start()
|
||||||
|
|
Loading…
Reference in a new issue