Merge pull request #268 from Varriount/make-ipmi-optional

This commit is contained in:
Cyril Levis 2023-02-28 09:24:33 +01:00 committed by GitHub
commit e0d734d0ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -78,6 +78,7 @@ def get_config():
help='Regex to ignore interfaces')
p.add_argument('--network.ignore_ips', default=r'^(127\.0\.0\..*|fe80.*|::1.*)',
help='Regex to ignore IPs')
p.add_argument('--network.ipmi', default=True, help='Enable gathering IPMI information')
p.add_argument('--network.lldp', help='Enable auto-cabling feature through LLDP infos')
p.add_argument('--inventory', action='store_true',
help='Enable HW inventory (CPU, Memory, RAID Cards, Disks) feature')

View file

@ -496,9 +496,12 @@ class Network(object):
class ServerNetwork(Network):
def __init__(self, server, *args, **kwargs):
super(ServerNetwork, self).__init__(server, args, kwargs)
self.ipmi = self.get_ipmi()
if config.network.ipmi:
self.ipmi = self.get_ipmi()
if self.ipmi:
self.nics.append(self.ipmi)
self.server = server
self.device = self.server.get_netbox_server()
self.nb_net = nb.dcim