Kintyre / ksconf

Kintyre's Splunk Configuration tool
Apache License 2.0
50 stars 13 forks source link

Splunk app upgrade issue: Add support for cleanup of old entrypoint data #37

Closed lowell80 closed 5 years ago

lowell80 commented 5 years ago

The problem

The leftover .dist-info and/or .egg-info folders in the bin/lib directory will likely start to cause issues after subsequent Splunk app upgrades.

The first indication of this was found on my own machine where the --version page shows two different versions at the same time.

Eventually this could keep new commands from being visible since that info is all loaded via entrypoints (which are specific to the versioned folder)

Environment

Details

$ /Applications/splunk/bin/ksconf --version
 _                         __
| | _____  ___ ___  _ __  / _|
| |/ / __|/ __/ _ \| '_ \| |_
|   <\__ \ (_| (_) | | | |  _|
|_|\_\___/\___\___/|_| |_|_|

ksconf 0.6.1  (Build 252)
Python: 2.7.15  (/Applications/splunk/bin/python)
Git SHA1 dd218785 committed on 2019-02-07
Written by Lowell Alleman <lowell@kintyre.co>.
Copyright (c) 2019 Kintyre Solutions, Inc.
Licensed under Apache Public License v2

Commands:
    check            (stable, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    combine          (beta, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    diff             (stable, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    filter           (alpha, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    merge            (stable, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    minimize         (beta, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    promote          (beta, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    rest-export      (beta, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    snapshot         (alpha, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    sort             (stable, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))
    unarchive        (beta, from Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))

Briefly,

ksconf 0.6.1  (Build 252)
Distribution('kintyre_splunk_conf', '0.6.0rc5-py2.7'))

Note 0.6.1 (package) vs 0.6.0rc5 (commands).

Steps To Reproduce Issue

Upgrade Splunk app between versions.

lowell80 commented 5 years ago

https://conf.splunk.com/files/2016/slides/extending-splunks-rest-api-for-fun-and-profit.pdf

slide 21

lowell80 commented 5 years ago

Hmm, I'm also seeing that this is happening on my own local box with pip installs. Tracked it down to the entrypoints module. Opened a question there to get more insight to see if I'm doing something wrong. https://github.com/takluyver/entrypoints/issues/27

pkg_resources isn't really an option since Splunk ships with a stripped-down version of Python... but I suppose I could do-away with all entrypoints for the Splunk-app version of ksconf.