Skip to content

Commit bfa6a52

Browse files
author
Shakeel Mohamed
committed
Release 1.6.1
2 parents ceba6a0 + e75f1e7 commit bfa6a52

File tree

11 files changed

+75
-22
lines changed

11 files changed

+75
-22
lines changed

CHANGELOG.md

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

3+
## Version 1.6.1
4+
5+
### Bug Fixes
6+
7+
* Fixed Search Commands exiting if the external process returns a zero status code (Windows only).
8+
9+
* Fixed Search Command Protocol v2 not parsing the `maxresultrows` and `command` metadata properties.
10+
11+
* Fixed double prepending the `Splunk ` prefix for authentication tokens.
12+
13+
* Fixed `Index.submit()` for namespaced `Service` instances.
14+
15+
* Fixed uncaught `AttributeError` when accessing `Entity` properties (GitHub issue #131).
16+
17+
### Minor Changes
18+
19+
* Fixed broken tests due to expired SSL certificate.
20+
321
## Version 1.6.0
422

523
### New Features and APIs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build Status](https://travis-ci.org/splunk/splunk-sdk-python.svg?branch=master)](https://travis-ci.org/splunk/splunk-sdk-python)
22
# The Splunk Software Development Kit for Python
33

4-
#### Version 1.6.0
4+
#### Version 1.6.1
55

66
The Splunk Software Development Kit (SDK) for Python contains library code and
77
examples designed to enable developers to build applications using Splunk.

examples/handlers/cacert.pem

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
-----BEGIN CERTIFICATE-----
2-
MIICdTCCAd4CCQDAsfQhOfrWaTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJV
3-
UzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDzANBgNVBAoT
4-
BlNwbHVuazEXMBUGA1UEAxMOU3BsdW5rQ29tbW9uQ0ExITAfBgkqhkiG9w0BCQEW
5-
EnN1cHBvcnRAc3BsdW5rLmNvbTA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ynR
15-
x/F2KL1hdfCR
12+
iwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFd9dzyyb2wnlDy3tlFVH2BUXdJZPKIC
13+
E3VyMsPTNhXDq7ESVWBLJeUQh6uJ1A3QyLrtTqG/1h62vvP+UxAw4THZ4g3a2i65
14+
3T1q78dhq1cKneOuE83Te/fREH54QokzrnAXoz+v/aGJkzjEpSEwrWUwLA1koE8I
15+
/0XFEwxWbEbt
1616
-----END CERTIFICATE-----

examples/searchcommands_app/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def run(self):
432432
setup(
433433
description='Custom Search Command examples',
434434
name=os.path.basename(project_dir),
435-
version='1.6.0',
435+
version='1.6.1',
436436
author='Splunk, Inc.',
437437
author_email='devinfo@splunk.com',
438438
url='http://github.com/splunk/splunk-sdk-python',

splunklib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
"""Python library for Splunk."""
1616

17-
__version_info__ = (1, 6, 0)
17+
__version_info__ = (1, 6, 1)
1818
__version__ = ".".join(map(str, __version_info__))
1919

splunklib/binding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ def request(url, message, **kwargs):
13431343
head = {
13441344
"Content-Length": str(len(body)),
13451345
"Host": host,
1346-
"User-Agent": "splunk-sdk-python/1.6.0",
1346+
"User-Agent": "splunk-sdk-python/1.6.1",
13471347
"Accept": "*/*",
13481348
"Connection": "Close",
13491349
} # defaults

splunklib/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
import socket
6868
import contextlib
6969

70-
from binding import Context, HTTPError, AuthenticationError, namespace, UrlEncoded, _encode, _make_cookie_header
70+
from binding import Context, HTTPError, AuthenticationError, namespace, UrlEncoded, _encode, _make_cookie_header, _NoAuthenticationToken
7171
from data import record
7272
import data
7373

@@ -100,8 +100,8 @@
100100
PATH_SAVED_SEARCHES = "saved/searches/"
101101
PATH_STANZA = "configs/conf-%s/%s" # (file, stanza)
102102
PATH_USERS = "authentication/users/"
103-
PATH_RECEIVERS_STREAM = "receivers/stream"
104-
PATH_RECEIVERS_SIMPLE = "receivers/simple"
103+
PATH_RECEIVERS_STREAM = "/services/receivers/stream"
104+
PATH_RECEIVERS_SIMPLE = "/services/receivers/simple"
105105
PATH_STORAGE_PASSWORDS = "storage/passwords"
106106

107107
XNAMEF_ATOM = "{http://www.w3.org/2005/Atom}%s"
@@ -884,7 +884,7 @@ def __contains__(self, item):
884884
try:
885885
self[item]
886886
return True
887-
except KeyError:
887+
except KeyError, AttributeError:
888888
return False
889889

890890
def __eq__(self, other):
@@ -1937,7 +1937,9 @@ def attach(self, host=None, source=None, sourcetype=None):
19371937
if sourcetype is not None: args['sourcetype'] = sourcetype
19381938
path = UrlEncoded(PATH_RECEIVERS_STREAM + "?" + urllib.urlencode(args), skip_encode=True)
19391939

1940-
cookie_or_auth_header = "Authorization: %s\r\n" % self.service.token
1940+
cookie_or_auth_header = "Authorization: Splunk %s\r\n" % \
1941+
(self.service.token if self.service.token is _NoAuthenticationToken
1942+
else self.service.token.replace("Splunk ", ""))
19411943

19421944
# If we have cookie(s), use them instead of "Authorization: ..."
19431945
if self.service.has_cookies():

splunklib/searchcommands/external_search_command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def terminate_child():
142142
p.wait()
143143

144144
logger.debug('finished command="%s", arguments=%s, pid=%d, returncode=%d', path, argv, p.pid, p.returncode)
145-
sys.exit(p.returncode)
145+
146+
if p.returncode != 0:
147+
sys.exit(p.returncode)
146148

147149
@staticmethod
148150
def _search_path(executable, paths):

splunklib/searchcommands/search_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def _process_protocol_v2(self, argv, ifile, ofile):
684684
# Write search command configuration for consumption by splunkd
685685
# noinspection PyBroadException
686686
try:
687-
self._record_writer = RecordWriterV2(ofile, getattr(self._metadata, 'maxresultrows', None))
687+
self._record_writer = RecordWriterV2(ofile, getattr(self._metadata.searchinfo, 'maxresultrows', None))
688688
self.fieldnames = []
689689
self.options.reset()
690690

tests/searchcommands/test_search_command.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ def test_process_scpv2(self):
378378
'"show_configuration={show_configuration}",'
379379
'"required_option_1=value_1",'
380380
'"required_option_2=value_2"'
381-
']'
381+
'],'
382+
'"maxresultrows": 10,'
383+
'"command": "countmatches"'
382384
'}}'
383385
'}}')
384386

@@ -472,6 +474,8 @@ def test_process_scpv2(self):
472474
self.assertEqual(command_metadata.searchinfo.splunk_version, '20150522')
473475
self.assertEqual(command_metadata.searchinfo.splunkd_uri, 'https://127.0.0.1:8089')
474476
self.assertEqual(command_metadata.searchinfo.username, 'admin')
477+
self.assertEqual(command_metadata.searchinfo.maxresultrows, 10)
478+
self.assertEqual(command_metadata.searchinfo.command, 'countmatches')
475479

476480
command.search_results_info.search_metrics = command.search_results_info.search_metrics.__dict__
477481
command.search_results_info.optional_fields_json = command.search_results_info.optional_fields_json.__dict__

0 commit comments

Comments
 (0)