Fixed relative path resolution for plugins
This commit is contained in:
parent
642140a0d5
commit
f0ee0015d6
14
ifxlookup
14
ifxlookup
@ -75,8 +75,10 @@ class IFXLookup():
|
||||
delegateconfig = self.totalconfig[delegatename]
|
||||
else :
|
||||
delegateconfig = {}
|
||||
# Run Plugin
|
||||
delegateinstance = delegate(delegateconfig,self.namespace,self._subjects,delegatereports)
|
||||
delegateresponse = delegateinstance._lookup_subjects()
|
||||
|
||||
if delegateinstance.error != [] :
|
||||
self.errorinfo.update({delegatename:delegateinstance.error})
|
||||
if delegateresponse:
|
||||
@ -123,10 +125,14 @@ class IFXLookup():
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Load Plugins
|
||||
plugindir="plugins"
|
||||
pluginfiles = [x for x in os.listdir(plugindir) if x != "servicebase.py" and x.endswith('.py')]
|
||||
pluginfolder = 'plugins'
|
||||
testpath = os.path.realpath(__file__)
|
||||
filedir = '/'.join(testpath.split('/')[:-1])
|
||||
pluginpath = filedir + '/' + pluginfolder
|
||||
plugindir = pluginfolder
|
||||
pluginfiles = [x for x in os.listdir(pluginpath) if x != "servicebase.py" and x.endswith('.py')]
|
||||
pluginfiles = sorted(pluginfiles)
|
||||
importlib.import_module(plugindir)
|
||||
importlib.import_module(pluginfolder)
|
||||
delegates = []
|
||||
for pluginfile in pluginfiles :
|
||||
delegates.append(getattr(importlib.import_module(plugindir+"."+pluginfile.split('.')[0]),"ServiceDelegate"))
|
||||
@ -142,7 +148,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument(arguments[0],arguments[1],action=arguments[2],help=arguments[3])
|
||||
parser.add_argument('-a', '--all', action='store_true', help="Return all searchable information about the subject")
|
||||
parser.add_argument('-v', '--debug', action='count', help="Include debug information in the output. Add 'v's for more output.")
|
||||
parser.add_argument('subjects', metavar='subjects', nargs='+', help='IPs or hostnames to look up.')
|
||||
parser.add_argument('subjects', metavar='subjects', nargs='+', help='IP\'s, hostnames, MAC\'s, or usernames to look up.')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Dispatch master object
|
||||
|
@ -8,7 +8,7 @@ class ServiceDelegate(ServiceBase) :
|
||||
|
||||
def get_arguments(cls) :
|
||||
"""Returns an array of information used to construct an argumentparser argument."""
|
||||
return ['-r', '--vpn','store_true',"Return VPN information about the subject"]
|
||||
return ['-r', '--vpn','store_true',"Return VPN information about the subject (openvpn)"]
|
||||
|
||||
def startup(self) :
|
||||
for requirement in ['hosts','username','key'] :
|
||||
|
Loading…
Reference in New Issue
Block a user