Skip to content

Commit

Permalink
Reindent audodiscover.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Jun 19, 2021
1 parent 4522a23 commit 4873f06
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions glances/autodiscover.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
# Copyright (C) 2019 Nicolargo <[email protected]>
# Copyright (C) 2021 Nicolargo <[email protected]>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -211,21 +211,30 @@ def __init__(self, hostname, args=None):
# Start the zeroconf service
try:
self.info = ServiceInfo(
zeroconf_type, '{}:{}.{}'.format(
hostname, args.port, zeroconf_type),
address=socket.inet_pton(
address_family, zeroconf_bind_address),
port=args.port, weight=0, priority=0, properties={}, server=hostname)
zeroconf_type,
'{}:{}.{}'.format(hostname,
args.port,
zeroconf_type),
address=socket.inet_pton(address_family, zeroconf_bind_address),
port=args.port,
weight=0,
priority=0,
properties={},
server=hostname)
except TypeError:
# Manage issue 1663 with breaking change on ServiceInfo method
# address (only one address) is replaced by addresses (list of addresses)
self.info = ServiceInfo(
zeroconf_type, '{}:{}.{}'.format(
hostname, args.port, zeroconf_type),
addresses=[socket.inet_pton(
address_family, zeroconf_bind_address)],
port=args.port, weight=0, priority=0, properties={}, server=hostname)

zeroconf_type,
'{}:{}.{}'.format(hostname,
args.port,
zeroconf_type),
addresses=[socket.inet_pton(address_family, zeroconf_bind_address)],
port=args.port,
weight=0,
priority=0,
properties={},
server=hostname)
try:
self.zeroconf.register_service(self.info)
except socket.error as e:
Expand Down

0 comments on commit 4873f06

Please sign in to comment.