Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supports: - Pushing multiple stanzas to a specific config endpoint at once, in a fairly efficient process. - Changes made on the server are show in the form of a diff. (Eventually, this should be configurable, and a dry-run mode should be added.) - Supports pushing to a live Splunk instance (via Splunkd REST API). This should replace the use of 'rest-export' for MOST use cases. - Supports reading and applying metadata (ACLs, owner, shared, app) to imported objects. - Any type of conf entry should be supported. Limitations: - **NO UNIT TESTING!** (This will require some fancy mock work.) - Doesn't support attribute-level metadata. - No SSL validation setup yet. This is primarily because of how Splunk's Python SDK works. For other Python HTTP libraries this is enabled by default. Squashed commit of the following: commit 80855ed Author: Lowell Alleman <lowell@kintyre.co> Date: Tue Feb 26 22:00:00 2019 -0500 Add changelog for rest-publish commit 8c8c60a Author: Lowell Alleman <lowell@kintyre.co> Date: Tue Feb 26 21:14:26 2019 -0500 Fixed small bug in rest-publish Resolved issue where 'diff' output would crash if the Splunkd version of the stanza contained a blank attribute (which was being returned as a None) which was screwing up the show_diff() function. - Replace values of None with '' for attributes returned from Splunkd (REST). This fixes the core issue in rest-publish. - Placed protective code in the show_diff() to be slightly better at handling unexpected None values. This is a secondary protection method that should at least NOT CRASH if somehow a None leaks in from somewhere else. commit 5ef130c Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 18:39:54 2019 -0500 Fixed bugs in rest-publish - Fixed issue where rest-publish would fail if '--conf' wasn't explicitly set. Has something to do with encoding. Splunk SDK is looking for a non-unicode value for conf-type. Whatever. - Fixed corner-case thing where ACL has 'read' or 'write' is an empty list. commit d0a3df2 Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 18:08:56 2019 -0500 Reduce server round-trips for rest-publish - Fix ACL diff output (requires some manipulation of the 'access' data to some wonky hybrid of (1) what the conf file looks like, (2) what the rest endpoint returns, and (3) what the ACL end-point expect. (Because you know, all 3 have to be different.) - Remove unnecessary ACL endpoint call (due to typo). - Remove the 'exists' check per stanza overhead. - Fixed an always-update bug that caused an extra round-trip. - Improved some output for some error conditions (lots of room for improvement here). Sill no unit tests, and no dry-run mode, ... In testing with a simple 4 stanzas file. I was able to get the best case run (where no changes are needed) down from from 17 REST calls down to 5. Which the theoretical best case possible (1 per stanzas plus 1 for login). First pushes will still be slower, at about 13 calls, but this should still feel much faster then before. (Running a few hundred felt quite painful.) commit c4e7dba Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 13:31:54 2019 -0500 Various fixes to rest-publish - Explicitly sort stanzas for additional predicable behavior. - Fixed missing/limited 'path' when publishing stanzas (diff header). - Expand/fine rest-publish CLI docs. - Noted some additional issues in comments. commit e7b4b34 Author: Lowell Alleman <lowell@kintyre.co> Date: Wed Feb 20 22:52:36 2019 -0500 Metadata support for rest-publish - Adds initial support for per-object metadata support for the rest-publish command. - Wonky workaround required for splunksdk limitation where posting to the '/acl' endpoint doesn't work due to kwargs handling. See upstream issue here: splunk/splunk-sdk-python#207 Still no unit-tests for rest-publish, and I'm not sure if mock is enough to handle this complex mess! (I'm really not excited about launching a Splunk instance from within Travis CI, either.) commit 747701e Author: Lowell Alleman <lowell@kintyre.co> Date: Tue Feb 19 15:41:40 2019 -0500 Add '--delete' support to rest-publish - Complete delete support. (Refactoring may still make sense). - Improved 'diff' output by showing REST endpoint on the one side, along with the modification time (when known). commit 0403008 Author: Lowell Alleman <lowell@kintyre.co> Date: Thu Feb 14 22:40:31 2019 -0500 Working rest-publish prototype development snapshot - Completed first pass of 'rest-publish'. Needs work, but functional. commit b745e14 Author: Lowell Alleman <lowell@kintyre.co> Date: Thu Feb 14 14:37:22 2019 -0500 First draft of 'rest-publish' command Development snapshot before direction change. Current implementation is based on 'requests' with custom calls to REST endpoints, but switching over to splunk-sdk. - Moved common splunkd access argparse arguments to shared function. - Split some common REST path handling functions in a shared ksconf.util.rest module. - Changed rest-export interface to use '--owner' (object owner) instead of using '--user' which is used for Splunkd auth. Currently the old argument is still supported with a deprecation warning.
- Loading branch information