def deploy_default_lookup_files(self): processed_files = [] logger.debug( 'Examining directory="' + os.path.join(bundle_paths.get_base_path(), "insteon", "lookups") + '"') for root, dirs, files in os.walk( os.path.join(bundle_paths.get_base_path(), "insteon", "lookups")): logger.debug("Found files=" + str(len(files))) for filename in files: processed_files.append({ "file": filename, "copied": self.copy_default_lookup(root, filename) }) # Output the data indicating what was done self.output_results(processed_files)
def get_apps_base(): # Find the apps base relative to Splunk, respecting SHP/etc. try: import splunk.clilib.bundle_paths as bundle_paths return bundle_paths.get_base_path() except: return os.path.join(get_splunk_home(), "etc", "apps")
def deploy_default_lookup_files(self): processed_files = [] logger.debug( 'Examining directory="' + os.path.join(bundle_paths.get_base_path(), "insteon", "lookups") + '"' ) for root, dirs, files in os.walk( os.path.join(bundle_paths.get_base_path(), "insteon", "lookups")): logger.debug("Found files=" + str(len(files))) for filename in files: processed_files.append({ "file" : filename, "copied": self.copy_default_lookup(root, filename) }) # Output the data indicating what was done self.output_results(processed_files)
def __init__(self, appname, conf_filename): # In unit testing scenario we don't want to use btool if get_test_state(): app_path = os.path.join(get_base_path(), appname) self.config = cli.getAppConf(conf_filename, appname, use_btool=False, app_path=app_path) else: self.config = cli.getMergedConf(conf_filename)
def getViewsFromLayer(app, which): d = os.path.abspath( os.path.join(bundle_paths.get_base_path(), app, which, "data/ui/views")) views = {} for directory, subdirectory, files in os.walk(d): for filename in files: viewName, view = getViewXML(directory, filename) views[viewName] = view return views
def __init__(self, *args, **kwargs): super(SplunkWebAppsFinder, self).__init__(*args, **kwargs) # In case there is an error, we initialize it with the SPLUNK_HOME versions apps_root = os.path.normpath(os.path.join(os.environ['SPLUNK_HOME'], "etc", "apps")) slave_apps_root = os.path.normpath(os.path.join(os.environ['SPLUNK_HOME'], "etc", "slave_apps")) try: # Find the true locations (respecting SHP, etc) for apps import splunk.clilib.bundle_paths as bundle_paths apps_root = bundle_paths.get_base_path() slave_apps_root = bundle_paths.get_slaveapps_base_path() except Exception, e: pass
def __init__(self, *args, **kwargs): super(SplunkWebAppsFinder, self).__init__(*args, **kwargs) # In case there is an error, we initialize it with the SPLUNK_HOME versions apps_root = os.path.normpath( os.path.join(os.environ['SPLUNK_HOME'], "etc", "apps")) slave_apps_root = os.path.normpath( os.path.join(os.environ['SPLUNK_HOME'], "etc", "slave_apps")) try: # Find the true locations (respecting SHP, etc) for apps import splunk.clilib.bundle_paths as bundle_paths apps_root = bundle_paths.get_base_path() slave_apps_root = bundle_paths.get_slaveapps_base_path() except Exception, e: pass
import splunk import splunk.admin as admin import splunk.clilib.bundle_paths as bundle_paths import splunk.clilib.cli_common as comm import splunk.util as util, traceback import splunk.appserver.mrsparkle.lib.i18n as i18n from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path import os, time, urllib2, string, tarfile, sys, socket APPS_PATH = bundle_paths.get_base_path() PACKAGE_PATH = os.path.join(bundle_paths.get_system_bundle_path(), 'static', 'app-packages') TEMPLATES_PATH = make_splunkhome_path(['share', 'splunk', 'app_templates']) TEXT_EXTENSIONS = ['txt', 'html', 'htm', 'xhtml', 'css', 'py', 'pl', 'ps1', 'bat', 'sh', 'conf', 'js', 'xml', 'xsl', 'conf', 'meta'] TXT_PREFIX = '__' ''' Needed to prevent collisions between mako and appbuilder templates ''' class SafeTemplate(string.Template): delimiter = '$$' ''' Returns Splunkd uri ''' def _getSplunkdUri(): return comm.getMgmtUri().replace('127.0.0.1',socket.gethostname().lower()) ''' Returns Splunkweb uri
import splunk import splunk.admin as admin import splunk.clilib.bundle_paths as bundle_paths import splunk.clilib.cli_common as comm import splunk.util as util, traceback import splunk.appserver.mrsparkle.lib.i18n as i18n from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path import os, time, urllib2, string, tarfile, sys, socket APPS_PATH = bundle_paths.get_base_path() PACKAGE_PATH = os.path.join(bundle_paths.get_system_bundle_path(), 'static', 'app-packages') TEMPLATES_PATH = make_splunkhome_path(['share', 'splunk', 'app_templates']) TEXT_EXTENSIONS = [ 'txt', 'html', 'htm', 'xhtml', 'css', 'py', 'pl', 'ps1', 'bat', 'sh', 'conf', 'js', 'xml', 'xsl', 'conf', 'meta' ] TXT_PREFIX = '__' ''' Needed to prevent collisions between mako and appbuilder templates ''' class SafeTemplate(string.Template): delimiter = '$$' ''' Returns Splunkd uri