Error from ksconf minimize
lowell80 opened this issue · comments
The problem
This looks to be an issue with path handling, possibly that proxy class thing. idk.
Environment
- Ksconf version: 0.7.7
- OS & version used: RH
- Python version:
- Installed via: pip
Details
$ ksconf --version
...
Traceback:
[splunk@usnscsplunkdply1 bin]$ KSCONF_DEBUG=1 ksconf minimize /opt/splunk/etc/system/local/limits.conf /opt/splunk/etc/system/default/limits.conf --dry-run
Unhandled top-level exception. 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
File "/opt/kintyre/historian/lib/python2.7/site-packages/ksconf/__main__.py", line 197, in cli
return_code = args.funct(args)
File "/opt/kintyre/historian/lib/python2.7/site-packages/ksconf/commands/__init__.py", line 377, in launch
return_code = self.run(args)
File "/opt/kintyre/historian/lib/python2.7/site-packages/ksconf/commands/minimize.py", line 96, in run
local_cfg = args.target.data
AttributeError: 'NoneType' object has no attribute 'data'
$ ksconf --version
_ __
| | / _|
| | _____ ___ ___ _ __ | |_
| |/ / __|/ __/ _ \| '_ \| _|
| <\__ \ (_| (_) | | | | |
|_|\_\___/\___\___/|_| |_|_|
ksconf 0.7.7 (Build 482)
Python: 2.7.5 (/opt/kintyre/historian/bin/python)
Git SHA1 e90fddf6 committed on 2020-03-05
Installed at: /opt/kintyre/historian/lib/python2.7/site-packages/ksconf
Platform: #1 SMP Thu Oct 4 20:48:51 UTC 2018
Git support: (/bin/git) git version 1.8.3.1
Written by Lowell Alleman <lowell@kintyre.co>.
Copyright (c) 2019 Kintyre Solutions, Inc, all rights reserved.
Licensed under Apache Public License v2
kintyre_splunk_conf (0.7.7)
Commands:
check (stable) OK
combine (beta) OK
diff (stable) OK
filter (alpha) OK
merge (stable) OK
minimize (beta) OK
promote (beta) OK
rest-export (beta) OK
rest-publish (alpha) Missing 3rd party module: No module named splunklib.client
snapshot (alpha) OK
sort (stable) OK
unarchive (beta) OK
xml-format (alpha) OK (lxml 4.5.0)
The issue is that you forgot the --target
option. This is a slightly awkward interface as it request an option (which should be optional, by convention.) But in this case, we require --target
to be explicitly stated. The reason for this, is that (1) it felt awkward to place target first (positional argument), and (2) we didn't want to place it at the end because then if you accidentally forget the target, then you could accidentally modify a file you intended as a source. Therefore we require the target to be explicitly labeled as such.
So most likely the command you intended is:
ksconf minimize --target /opt/splunk/etc/system/local/limits.conf /opt/splunk/etc/system/default/limits.conf
I'm working on a fix to report this error correctly to the user. Because an unhandled exception is quite unhelpful.