Import Splunk Add-On for Unix and Linux version 9.2.0
This commit is contained in:
commit
92ac2630a1
77 changed files with 11487 additions and 0 deletions
38
bin/setupservice.py
Normal file
38
bin/setupservice.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# SPDX-FileCopyrightText: 2024 Splunk, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
import splunk
|
||||
import splunk.bundle as bundle
|
||||
|
||||
|
||||
class SetupService(splunk.rest.BaseRestHandler):
|
||||
def handle_GET(self):
|
||||
try:
|
||||
is_recognized_unix = not sys.platform.startswith("win")
|
||||
self.response.write(json.dumps(is_recognized_unix))
|
||||
except Exception as e:
|
||||
self.response.write(e)
|
||||
|
||||
def handle_POST(self):
|
||||
sessionKey = self.sessionKey
|
||||
try:
|
||||
conf = bundle.getConf(
|
||||
"app", sessionKey, namespace="Splunk_TA_nix", owner="nobody"
|
||||
)
|
||||
stanza = conf.stanzas["install"].findKeys("is_configured")
|
||||
if stanza:
|
||||
if stanza["is_configured"] == "0" or stanza["is_configured"] == "false":
|
||||
conf["install"]["is_configured"] = "true"
|
||||
splunk.rest.simpleRequest(
|
||||
"/apps/local/Splunk_TA_nix/_reload", sessionKey=sessionKey
|
||||
)
|
||||
else:
|
||||
conf["install"]["is_configured"] = "true"
|
||||
splunk.rest.simpleRequest(
|
||||
"/apps/local/Splunk_TA_nix/_reload", sessionKey=sessionKey
|
||||
)
|
||||
except Exception as e:
|
||||
self.response.write(e)
|
Loading…
Add table
Add a link
Reference in a new issue