Code cleanup
This commit is contained in:
parent
1cb656b8ab
commit
583574ffd3
@ -84,7 +84,7 @@ class IFXLookup():
|
||||
return final_result
|
||||
|
||||
def use_plugins(self,plugins,reload=False) :
|
||||
"""Defines plugins that should be used in a lookup, optionally forcing them to reset."""
|
||||
"""Defines plugins that should be used in a lookup, optionally forcing them to reload."""
|
||||
# Verify data
|
||||
if type(plugins) is not list :
|
||||
raise ValueError('argument \'plugins\' should be of type list')
|
||||
@ -108,7 +108,7 @@ class IFXLookup():
|
||||
return self._delegate_map
|
||||
|
||||
def search_plugins(self,directory=None) :
|
||||
"""Searches a given directory for compatible plugins and returns a map of available plugin names and classes"""
|
||||
"""Searches a given directory for compatible plugins and returns a map of available plugin names and classes."""
|
||||
if not directory :
|
||||
directory = '/'.join(os.path.realpath(__file__).split('/')[:-1]) + '/' + 'plugins'
|
||||
directory = os.path.normpath(os.path.expanduser(os.path.expandvars(directory)))
|
||||
@ -141,7 +141,7 @@ class IFXLookup():
|
||||
yaml.dump(self._config, file_handle, default_flow_style=False)
|
||||
|
||||
def set_debug_level(self,level) :
|
||||
"""Sets the debug level"""
|
||||
"""Sets the debug level."""
|
||||
try:
|
||||
level = int(level)
|
||||
except Exception:
|
||||
@ -150,7 +150,7 @@ class IFXLookup():
|
||||
return self
|
||||
|
||||
def debug_level(self) :
|
||||
"""Gets the debug level"""
|
||||
"""Gets the debug level."""
|
||||
return this._debug_level
|
||||
|
||||
def enable_caching(self) :
|
||||
|
@ -27,10 +27,13 @@ class ServiceDelegate(ServiceBase) :
|
||||
self._return_payload = {}
|
||||
|
||||
logincandidates = self.choose_host(subject)
|
||||
if logincandidates == {} :
|
||||
if len(logincandidates) == 0 :
|
||||
# Idk what to do here, do we give up or do we log in to all of them?
|
||||
self._error.append('Unable to find an LB to log into to check host ' + str(subject))
|
||||
return None
|
||||
# Search all
|
||||
logincandidates = {x:x for x in self._hosts}
|
||||
# Give up
|
||||
# return None
|
||||
|
||||
for host in logincandidates.keys() :
|
||||
auth_header = self.get_iq_auth_header(host,self._config['username'],self._config['key'])
|
||||
@ -130,7 +133,7 @@ class ServiceDelegate(ServiceBase) :
|
||||
for host in self._hosts.keys() :
|
||||
if potentialdc.lower() in host.lower() :
|
||||
hosts.update({host:self._hosts[host]})
|
||||
if hosts != {} :
|
||||
if len(hosts) > 0 :
|
||||
return hosts
|
||||
self.debug('Unable to determine DC from subject name: ' + subject,3)
|
||||
# No hostname match, maybe we have info from bluecat?
|
||||
|
@ -6,9 +6,12 @@ click==7.1.2
|
||||
click-plugins==1.1.1
|
||||
colorama==0.4.3
|
||||
cryptography==2.9.2
|
||||
decorator==4.4.2
|
||||
dnspython==1.16.0
|
||||
idna==2.9
|
||||
jsonpath-ng==1.5.1
|
||||
paramiko==2.7.1
|
||||
ply==3.11
|
||||
pycparser==2.20
|
||||
PyNaCl==1.3.0
|
||||
PyYAML==5.3.1
|
||||
|
Loading…
Reference in New Issue
Block a user