Skip to content

Commit b36d6eb

Browse files
authored
Merge pull request #364 from splunk/release/1.6.15
Release v1.6.15
2 parents 465522d + ddebf73 commit b36d6eb

21 files changed

+307
-133
lines changed

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ before_install:
1212
- echo password=changed! >> $HOME/.splunkrc
1313
# Set SPLUNK_HOME
1414
- export SPLUNK_HOME="/opt/splunk"
15-
# Pull docker image
16-
- docker pull splunk/splunk-sdk-travis-ci:$SPLUNK_VERSION
1715
# Add DOCKER to iptables, 1/10 times this is needed, force 0 exit status
1816
- sudo iptables -N DOCKER || true
19-
# Start Docker container
20-
- docker run -p 127.0.0.1:8089:8089 -d splunk/splunk-sdk-travis-ci:$SPLUNK_VERSION
21-
# curl Splunk until it returns valid data indicating it has been setup, try 20 times maximum
22-
- 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
17+
# Start docker-compose in detached mode
18+
- docker-compose up -d
19+
# Health Check (3 minutes)
20+
- for i in `seq 0 180`; do if docker exec -it splunk /sbin/checkstate.sh &> /dev/null; then break; fi; echo $i; sleep 1; done
2321
# The upload test needs to refer to a file that Splunk has in the docker
2422
# container
2523
- export INPUT_EXAMPLE_UPLOAD=$SPLUNK_HOME/var/log/splunk/splunkd_ui_access.log
@@ -32,8 +30,8 @@ before_install:
3230
language: python
3331

3432
env:
35-
- SPLUNK_VERSION=7.3-sdk
36-
- SPLUNK_VERSION=8.0-sdk
33+
- SPLUNK_VERSION=7.3
34+
- SPLUNK_VERSION=8.0
3735

3836
python:
3937
- "2.7"

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Splunk Enterprise SDK for Python Changelog
22

3+
## Version 1.6.15
4+
5+
### Bug fixes
6+
[#301](https://github.com/splunk/splunk-sdk-python/pull/301) Fix chunk synchronization
7+
[#327](https://github.com/splunk/splunk-sdk-python/pull/327) Rename and cleanup follow-up for chunk synchronization
8+
[#352](https://github.com/splunk/splunk-sdk-python/pull/352) Allow supplying of a key-value body when calling Context.post()
9+
10+
### Minor changes
11+
[#350](https://github.com/splunk/splunk-sdk-python/pull/350) Initial end-to-end tests for streaming, reporting, generating custom search commands
12+
[#348](https://github.com/splunk/splunk-sdk-python/pull/348) Update copyright years to 2020
13+
[#346](https://github.com/splunk/splunk-sdk-python/pull/346) Readme updates to urls, terminology, and formatting
14+
[#317](https://github.com/splunk/splunk-sdk-python/pull/317) Fix deprecation warnings
15+
316
## Version 1.6.14
417

518
### Bug fix

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# The Splunk Enterprise Software Development Kit for Python
55

6-
#### Version 1.6.14
6+
#### Version 1.6.15
77

88
The Splunk Enterprise Software Development Kit (SDK) for Python contains library code and examples designed to enable developers to build applications using the Splunk platform.
99

@@ -13,7 +13,7 @@ The Splunk platform is popular with system administrators for aggregation and mo
1313

1414
The Splunk developer platform enables developers to take advantage of the same technology used by the Splunk platform to build exciting new applications.
1515

16-
For more information, see [Splunk Enterprise SDK for Python](https://dev.splunk.com/enterprise/docs/devtools/python/sdk-python/) on the Splunk Developer Portal.
16+
## Getting started with the Splunk SDK for Python
1717

1818

1919
## Get started with the Splunk Enterprise SDK for Python
@@ -37,7 +37,6 @@ Here's what you need to get going with the Splunk Enterprise SDK for Python.
3737

3838
Get the Splunk Enterprise SDK for Python from [PyPI](https://pypi.org/project/splunk-sdk/). If you want to contribute to the SDK, clone the repository from [GitHub](https://github.com/splunk/splunk-sdk-python).
3939

40-
4140
### Install the SDK
4241

4342
Use the following commands to install the Splunk Enterprise SDK for Python libraries in different ways. However, it's not necessary to install the libraries to run the examples and unit tests from the SDK.
@@ -58,8 +57,17 @@ Install the sources you cloned from GitHub:
5857

5958
[sudo] python setup.py install
6059

60+
## Testing Quickstart
61+
62+
You'll need `docker` and `docker-compose` to get up and running using this method.
6163

62-
### Run the examples and unit tests
64+
```
65+
make up SPLUNK_VERSION=8.0
66+
make wait_up
67+
make splunkrc_default
68+
make test
69+
make down
70+
```
6371

6472
To run the examples and unit tests, you must put the root of the SDK on your PYTHONPATH. For example, if you downloaded the SDK to your home folder and are running OS X or Linux, add the following line to your **.bash_profile** file:
6573

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.6'
2+
3+
services:
4+
splunk:
5+
image: "splunk/splunk:${SPLUNK_VERSION}"
6+
container_name: splunk
7+
environment:
8+
- SPLUNK_START_ARGS=--accept-license
9+
- SPLUNK_HEC_TOKEN=11111111-1111-1111-1111-1111111111113
10+
- SPLUNK_PASSWORD=changed!
11+
- SPLUNK_APPS_URL=https://github.com/splunk/sdk-app-collection/releases/download/v1.0.0/sdk-app-collection.tgz
12+
ports:
13+
- 8000:8000
14+
- 8088:8088
15+
- 8089:8089
16+
healthcheck:
17+
test: ['CMD', 'curl', '-f', 'http://localhost:8000']
18+
interval: 5s
19+
timeout: 5s
20+
retries: 20

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
# General information about the project.
4545
project = u'Splunk SDK for Python'
46-
copyright = u'2014, Splunk Inc'
46+
copyright = u'2020, Splunk Inc'
4747

4848
# The version info for the project you're documenting, acts as replacement for
4949
# |version| and |release|, also used in various other places throughout the
@@ -95,7 +95,7 @@
9595
# a list of builtin themes.
9696

9797
# agogo, default, epub, haiku, nature, pyramid, scrolls, sphinxdoc, traditional
98-
html_theme = 'default'
98+
html_theme = 'default'
9999

100100
# Theme options are theme-specific and customize the look and feel of a theme
101101
# further. For a list of options available for each theme, see the

examples/searchcommands_app/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def run(self):
439439
setup(
440440
description='Custom Search Command examples',
441441
name=os.path.basename(project_dir),
442-
version='1.6.14',
442+
version='1.6.15',
443443
author='Splunk, Inc.',
444444
author_email='[email protected]',
445445
url='http://github.com/splunk/splunk-sdk-python',

scripts/build-splunkrc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
'host': 'localhost',
2626
'port': '8089',
2727
'username': 'admin',
28-
'password': 'changeme',
28+
'password': 'changed!',
2929
'scheme': 'https',
30-
'version': '6.3'
30+
'version': '8.0'
3131
}
3232

3333
DEFAULT_SPLUNKRC_PATH = os.path.join(str(Path.home()), '.splunkrc')

splunklib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
from __future__ import absolute_import
1818
from splunklib.six.moves import map
19-
__version_info__ = (1, 6, 14)
19+
__version_info__ = (1, 6, 15)
2020
__version__ = ".".join(map(str, __version_info__))

splunklib/binding.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,12 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=None, *
724724
:type headers: ``list`` of 2-tuples.
725725
:param query: All other keyword arguments, which are used as query
726726
parameters.
727-
:type query: ``string``
727+
:param body: Parameters to be used in the post body. If specified,
728+
any parameters in the query will be applied to the URL instead of
729+
the body. If a dict is supplied, the key-value pairs will be form
730+
encoded. If a string is supplied, the body will be passed through
731+
in the request unchanged.
732+
:type body: ``dict`` or ``str``
728733
:return: The response from the server.
729734
:rtype: ``dict`` with keys ``body``, ``headers``, ``reason``,
730735
and ``status``
@@ -1223,6 +1228,8 @@ def post(self, url, headers=None, **kwargs):
12231228
headers.append(("Content-Type", "application/x-www-form-urlencoded"))
12241229

12251230
body = kwargs.pop('body')
1231+
if isinstance(body, dict):
1232+
body = _encode(**body).encode('utf-8')
12261233
if len(kwargs) > 0:
12271234
url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True)
12281235
else:
@@ -1378,7 +1385,7 @@ def request(url, message, **kwargs):
13781385
head = {
13791386
"Content-Length": str(len(body)),
13801387
"Host": host,
1381-
"User-Agent": "splunk-sdk-python/1.6.14",
1388+
"User-Agent": "splunk-sdk-python/1.6.15",
13821389
"Accept": "*/*",
13831390
"Connection": "Close",
13841391
} # defaults

splunklib/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ def delete(self, username, realm=None):
18721872
name = UrlEncoded(realm, encode_slash=True) + ":" + UrlEncoded(username, encode_slash=True)
18731873

18741874
# Append the : expected at the end of the name
1875-
if name[-1] is not ":":
1875+
if name[-1] != ":":
18761876
name = name + ":"
18771877
return Collection.delete(self, name)
18781878

splunklib/searchcommands/generating_command.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,21 @@ def _execute(self, ifile, process):
204204
205205
"""
206206
if self._protocol_version == 2:
207-
result = self._read_chunk(self._as_binary_stream(ifile))
207+
self._execute_v2(ifile, self.generate())
208+
else:
209+
assert self._protocol_version == 1
210+
self._record_writer.write_records(self.generate())
211+
self.finish()
208212

209-
if not result:
213+
def _execute_chunk_v2(self, process, chunk):
214+
count = 0
215+
for row in process:
216+
self._record_writer.write_record(row)
217+
count += 1
218+
if count == self._record_writer._maxresultrows:
219+
self._finished = False
210220
return
211-
212-
metadata, body = result
213-
action = getattr(metadata, 'action', None)
214-
215-
if action != 'execute':
216-
raise RuntimeError('Expected execute action, not {}'.format(action))
217-
218-
self._record_writer.write_records(self.generate())
219-
self.finish()
221+
self._finished = True
220222

221223
# endregion
222224

0 commit comments

Comments
 (0)