-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: use subprocess.call instead of os.system (#718) Docs: https://docs.python.org/3/library/subprocess.html#replacing-os-system * chore: warn that running just ucc-gen will be deprecated (#719) * refactor: remove time from logs (#722) * chore: add a script to compare output from 2 different versions of add-on (#723) * fix: change the order in the sys.path in import_declare_test (#724) The add-on should use libraries packaged with it first and only then try to use libraries provided by Splunk. * docs: initial version of describing solnlib and splunktaucclib (#726) * fix: openapi.json should not contain disabled property for input creation (#727) * fix: openapi.json should not contain disabled property for input creation ; resolves #725 * fix: help text for generated account (#728) * chore: don't show traceback when not a git repo (#734) Instead of showing a traceback, show an error message in logs and suggest users a solution. * test: mimic code structure in unit tests (#735) * chore: removed license from test files * test: mimic code structure in unit tests --------- Co-authored-by: hsekowski-splunk <74253926+hsekowski-splunk@users.noreply.github.com> Co-authored-by: Daniel Federschmidt <daniel@federschmidt.xyz>
- Loading branch information
1 parent
973869d
commit 6b3e649
Showing
48 changed files
with
249 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# UCC-related libraries | ||
|
||
There are two UCC-related libraries: | ||
|
||
* [`solnlib`](https://github.com/splunk/addonfactory-solutions-library-python) | ||
* [`splunktaucclib`](https://github.com/splunk/addonfactory-ucc-library) | ||
|
||
## `solnlib` | ||
|
||
`solnlib` contains a number of functions and classes that can be used during | ||
the add-on development. The documentation can be found | ||
[here](https://splunk.github.io/addonfactory-solutions-library-python). | ||
|
||
Commonly used modules are: | ||
|
||
* `log` - file-based logging to `$SPLUNK_HOME/var/log/splunk` folder | ||
* `modular_input.checkpointers` - contains classes to manage checkpoints | ||
|
||
Below is the example of the code that can be used to get a logger for a | ||
specific add-on. | ||
|
||
```python | ||
import logging | ||
|
||
from solnlib import log | ||
|
||
|
||
def logger_for_input(input_name: str) -> logging.Logger: | ||
return log.Logs().get_logger(f"<add-on name>_{input_name}") | ||
``` | ||
|
||
## `splunktaucclib` | ||
|
||
`splunktaucclib` powers backend of the add-on. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /usr/bin/env bash | ||
# The script installs 2 different version of the `splunk-add-on-ucc-framework`, | ||
# builds the add-on, cleans up some folders and then prints the difference between | ||
# the 2 built versions. | ||
# | ||
# The script assumes uses `python3` binary (you can change it for your needs) and needs | ||
# 2 versions of the `splunk-add-on-ucc-framework` as parameters. | ||
# An example of calling the script: | ||
# `./compare_ucc_versions 5.19.0 5.24.0` | ||
|
||
set -euo pipefail | ||
|
||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
|
||
rm -rf output_$1 | ||
rm -rf output_$2 | ||
|
||
echo "Installing splunk-add-on-ucc-framework==$1" | ||
pip install splunk-add-on-ucc-framework==$1 > /dev/null 2>&1 | ||
.venv/bin/ucc-gen > /dev/null 2>&1 | ||
mv output/ output_$1/ | ||
|
||
echo "Installing splunk-add-on-ucc-framework==$2" | ||
pip install splunk-add-on-ucc-framework==$2 > /dev/null 2>&1 | ||
.venv/bin/ucc-gen > /dev/null 2>&1 | ||
mv output/ output_$2/ | ||
|
||
echo "Removing lib/ and appserver/static/jb/" | ||
rm -rf output_$1/*/lib/ | ||
rm -rf output_$2/*/lib/ | ||
rm -rf output_$1/*/appserver/static/js/ | ||
rm -rf output_$2/*/appserver/static/js/ | ||
|
||
diff -bur output_$1 output_$2 | ||
|
||
rm -rf output_$1 | ||
rm -rf output_$2 | ||
|
||
deactivate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ | |
# | ||
class CouldNotVersionFromGitException(Exception): | ||
pass | ||
|
||
|
||
class IsNotAGitRepo(Exception): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +0,0 @@ | ||
# | ||
# Copyright 2021 Splunk Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.