Esempio n. 1
0
# /////////////////////////////////////////////////////////////////////////////
#  This stub file is a proxy for importing all the of bundled custom REST
#  endpoint handlers.

#  The path insertion here allows all python scripts that are added in the
#  bundles to be accessible from other python modules under the following:
#       import splunk.rest.external.<module_name>
#
#  For instance, if you add the file, /etc/bundles/imap/rest/mailbox.py
#  then that module will be available at:
#       import splunk.rest.external.mailbox
#
# /////////////////////////////////////////////////////////////////////////////

import os
from splunk.clilib import bundle_paths

# locate eligible python scripts paths within the bundle system
bundleList = (bundle_paths.get_bundle_subdirs("bin") +
              bundle_paths.get_bundle_subdirs("rest"))
bundleList.sort()
for scriptsPath in bundleList:
    if os.access(scriptsPath, os.R_OK):

        # inject bundle path into local python module path
        __path__.insert(0, scriptsPath)
Esempio n. 2
0
# /////////////////////////////////////////////////////////////////////////////
#  This stub file is a proxy for importing all the of bundled custom REST
#  endpoint handlers.  

#  The path insertion here allows all python scripts that are added in the
#  bundles to be accessible from other python modules under the following:
#       import splunk.rest.external.<module_name>
#
#  For instance, if you add the file, /etc/bundles/imap/rest/mailbox.py
#  then that module will be available at:
#       import splunk.rest.external.mailbox
#
# /////////////////////////////////////////////////////////////////////////////

import os
from splunk.clilib import bundle_paths

# locate eligible python scripts paths within the bundle system
bundleList = (bundle_paths.get_bundle_subdirs("bin") +
              bundle_paths.get_bundle_subdirs("rest"));
bundleList.sort()
for scriptsPath in bundleList:
    if os.access(scriptsPath, os.R_OK):

        # inject bundle path into local python module path
        __path__.insert(0, scriptsPath)
Esempio n. 3
0
#Copyright (C) 2005-2011 Splunk Inc. All Rights Reserved. This work contains trade
#secrets and confidential material of Splunk Inc., and its use or disclosure in
#whole or in part without the express written permission of Splunk Inc. is prohibited.

#
# locate and insert any registered custom web bundle python scripts
#
# the expected format is that any bundle directory have a 'web' subdirectory
# that contains python methods
#

import os, sys
from splunk.clilib import bundle_paths

# locate scripts directory
bundleList = (bundle_paths.get_bundle_subdirs("bin") +
              bundle_paths.get_bundle_subdirs("web"));
bundleList.sort()
for scriptsPath in bundleList:
    if os.access(scriptsPath, os.F_OK):
        # inject the bundle path into pythonpath
        sys.path.append(scriptsPath)
        #print "Loading appserver path: %s" % scriptsPath