Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into bugfix/DVPL-6745
- Loading branch information
Showing
40 changed files
with
940 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
notifications: | ||
email: false | ||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
# Create .splunkrc file with default credentials | ||
- echo host=127.0.0.1 >> $HOME/.splunkrc | ||
- echo username=admin >> $HOME/.splunkrc | ||
- echo password=changeme >> $HOME/.splunkrc | ||
# Set SPLUNK_HOME | ||
- export SPLUNK_HOME="/opt/splunk" | ||
# Pull docker image | ||
- docker pull splunk/splunk-sdk-travis-ci:$SPLUNK_VERSION | ||
# Add DOCKER to iptables, 1/10 times this is needed, force 0 exit status | ||
- sudo iptables -N DOCKER || true | ||
# Start Docker container | ||
- docker run -p 127.0.0.1:8089:8089 -d splunk/splunk-sdk-travis-ci:$SPLUNK_VERSION | ||
# curl Splunk until it returns valid data indicating it has been setup, try 20 times maximum | ||
- for i in `seq 0 20`; do if curl --fail -k https://localhost:8089/services/server/info &> /dev/null; then break; fi; echo $i; sleep 1; done | ||
# The upload test needs to refer to a file that Splunk has in the docker | ||
# container | ||
- export INPUT_EXAMPLE_UPLOAD=$SPLUNK_HOME/var/log/splunk/splunkd_ui_access.log | ||
# After initial setup, we do not want to give the SDK any notion that it has | ||
# a local Splunk installation it can use, so we create a blank SPLUNK_HOME | ||
# for it, and make a placeholder for log files (which some tests generate) | ||
- export SPLUNK_HOME=`pwd`/splunk_home | ||
- mkdir -p $SPLUNK_HOME/var/log/splunk | ||
|
||
env: | ||
- SPLUNK_VERSION=6.2.6-sdk | ||
- SPLUNK_VERSION=6.3.1-sdk | ||
|
||
language: python | ||
|
||
python: | ||
- "2.7" | ||
- "2.6" | ||
|
||
install: "pip install unittest2" | ||
|
||
before_script: python setup.py build dist | ||
|
||
script: python setup.py test |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICdTCCAd4CCQDAsfQhOfrWaTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJV | ||
UzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDzANBgNVBAoT | ||
BlNwbHVuazEXMBUGA1UEAxMOU3BsdW5rQ29tbW9uQ0ExITAfBgkqhkiG9w0BCQEW | ||
EnN1cHBvcnRAc3BsdW5rLmNvbTAeFw0wNjA3MjQxNzEyMTlaFw0xNjA3MjExNzEy | ||
MTlaMH8xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZy | ||
YW5jaXNjbzEPMA0GA1UEChMGU3BsdW5rMRcwFQYDVQQDEw5TcGx1bmtDb21tb25D | ||
MIICdTCCAd4CCQDlsvzBaZf1RjANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJV | ||
UzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDzANBgNVBAoM | ||
BlNwbHVuazEXMBUGA1UEAwwOU3BsdW5rQ29tbW9uQ0ExITAfBgkqhkiG9w0BCQEW | ||
EnN1cHBvcnRAc3BsdW5rLmNvbTAeFw0xNTA1MTExOTUxMzdaFw0yNTA1MDgxOTUx | ||
MzdaMH8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZy | ||
YW5jaXNjbzEPMA0GA1UECgwGU3BsdW5rMRcwFQYDVQQDDA5TcGx1bmtDb21tb25D | ||
QTEhMB8GCSqGSIb3DQEJARYSc3VwcG9ydEBzcGx1bmsuY29tMIGfMA0GCSqGSIb3 | ||
DQEBAQUAA4GNADCBiQKBgQDJmb55yvam1GqGgTK0dfHXWJiB0Fh8fsdJFRc5dxBJ | ||
PFaC/klmtbLFLbYuXdC2Jh4cm/uhj1/FWmA0Wbhb02roAV03Z3SX0pHyFa3Udyqr | ||
9f5ERJ0AYFA+y5UhbMnD9zlhs7J8ucub3XvA8rn79ejkYtDX2rMQWPNZYPcrxUEh | ||
iwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAKW37NFwTikJOMo9Z8cjmJDz9wa4yckB | ||
MlEA1/s6k6OmzZH0gkAssLstRkBavlr1uIBPZ2Jfse6FjoJ5ekC1AoXkInwmCspW | ||
GTVCoe8rwhU0xaj0GsC+wA3ykL+UKuXz6iE3oDcnLr0qxiNT2OxdTxz+EB9T0ynR | ||
x/F2KL1hdfCR | ||
iwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFd9dzyyb2wnlDy3tlFVH2BUXdJZPKIC | ||
E3VyMsPTNhXDq7ESVWBLJeUQh6uJ1A3QyLrtTqG/1h62vvP+UxAw4THZ4g3a2i65 | ||
3T1q78dhq1cKneOuE83Te/fREH54QokzrnAXoz+v/aGJkzjEpSEwrWUwLA1koE8I | ||
/0XFEwxWbEbt | ||
-----END CERTIFICATE----- |
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,75 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2011-2015 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. | ||
|
||
"""A command line utility for interacting with Splunk KV Store Collections.""" | ||
|
||
import sys, os, json | ||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) | ||
|
||
from splunklib.client import connect | ||
|
||
try: | ||
from utils import parse | ||
except ImportError: | ||
raise Exception("Add the SDK repository to your PYTHONPATH to run the examples " | ||
"(e.g., export PYTHONPATH=~/splunk-sdk-python.") | ||
|
||
def main(): | ||
opts = parse(sys.argv[1:], {}, ".splunkrc") | ||
opts.kwargs["owner"] = "nobody" | ||
opts.kwargs["app"] = "search" | ||
service = connect(**opts.kwargs) | ||
|
||
print "KV Store Collections:" | ||
for collection in service.kvstore: | ||
print " %s" % collection.name | ||
|
||
# Let's delete a collection if it already exists, and then create it | ||
collection_name = "example_collection" | ||
if collection_name in service.kvstore: | ||
service.kvstore.delete(collection_name) | ||
|
||
# Let's create it and then make sure it exists | ||
service.kvstore.create(collection_name) | ||
collection = service.kvstore[collection_name] | ||
|
||
# Let's make sure it doesn't have any data | ||
print "Should be empty: %s" % json.dumps(collection.data.query()) | ||
|
||
# Let's add some data | ||
collection.data.insert(json.dumps({"_key": "item1", "somekey": 1, "otherkey": "foo"})) | ||
collection.data.insert(json.dumps({"_key": "item2", "somekey": 2, "otherkey": "foo"})) | ||
collection.data.insert(json.dumps({"somekey": 3, "otherkey": "bar"})) | ||
|
||
# Let's make sure it has the data we just entered | ||
print "Should have our data: %s" % json.dumps(collection.data.query(), indent=1) | ||
|
||
# Let's run some queries | ||
print "Should return item1: %s" % json.dumps(collection.data.query_by_id("item1"), indent=1) | ||
|
||
query = json.dumps({"otherkey": "foo"}) | ||
print "Should return item1 and item2: %s" % json.dumps(collection.data.query(query=query), indent=1) | ||
|
||
query = json.dumps({"otherkey": "bar"}) | ||
print "Should return third item with auto-generated _key: %s" % json.dumps(collection.data.query(query=query), indent=1) | ||
|
||
# Let's delete the collection | ||
collection.delete() | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
||
|
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
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.