You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved.
import splunk.admin as admin
import splunk.entity as en
from install.itsiinstaller import ITInstaller
class ConfigITApp(admin.MConfigHandler):
'''
Set up supported arguments
'''
def setup(self):
if self.requestedAction == admin.ACTION_EDIT:
for arg in ['IT_do_install']:
self.supportedArgs.addOptArg(arg)
'''
Lists configurable parameters
'''
def handleList(self, confInfo):
stanza = "general_settings"
confInfo[stanza].append('IT_do_install', '1')
'''
Controls parameters
'''
def handleEdit(self, confInfo):
name = self.callerArgs.id # noqa F841
args = self.callerArgs # noqa F841
if self.callerArgs.data['IT_do_install'][0] in [1, '1']:
# Run the installer
ITInstaller.doInstall(sessionKey=self.getSessionKey())
# reload the app to trigger splunkd restart
# self.handleReload()
def handleReload(self, confInfo=None):
"""
Handles refresh/reload of the configuration options
"""
try:
refreshInfo = en.refreshEntities('apps/local/itsi', sessionKey=self.getSessionKey()) # noqa F841
except Exception:
raise
# initialize the handler
admin.init(ConfigITApp, admin.CONTEXT_NONE)