-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue running ksconf sort #95
Comments
This is odd. It seems like some kind of argument parsing issue. It looks like it's seeing What output do you get if you run these two commands?
Also, are you using a command prompt or powershell? |
Lowell,
Here is the output you requested:
D:\Temp\Splunk>ksconf sort
usage: ksconf sort [-h] [--target FILE | --inplace] [-F] [-q] [-n LINES]
FILE [FILE ...]
ksconf sort: error: the following arguments are required: FILE
D:\Temp\Splunk>ksconf sort --help
usage: ksconf [-h] [--version] [--force-color] [--disable-color]
{check,combine,diff,filter,merge,minimize,package,promote,rest-export,rest-publish,snapshot,sort,unarchive,xml-format}
...
ksconf: error: invalid choice: 'sort --help' (choose from 'check',
'combine', 'diff', 'filter', 'merge', 'minimize', 'package', 'promote',
'rest-export', 'rest-publish', 'snapshot', 'sort', 'unarchive',
'xml-format')
D:\Temp\Splunk>dir *.conf
Volume in drive D is Data
Volume Serial Number is 3A1E-0FE8
Directory of D:\Temp\Splunk
01/31/2023 04:05 PM 16,909 props.conf
1 File(s) 16,909 bytes
0 Dir(s) 771,302,277,120 bytes free
D:\Temp\Splunk>ksconf sort --inplace *.conf
usage: ksconf [-h] [--version] [--force-color] [--disable-color]
{check,combine,diff,filter,merge,minimize,package,promote,rest-export,rest-publish,snapshot,sort,unarchive,xml-format}
...
ksconf: error: invalid choice: 'sort --inplace *.conf' (choose from
'check', 'combine', 'diff', 'filter', 'merge', 'minimize', 'package',
'promote', 'rest-export', 'rest-publish', 'snapshot', 'sort', 'unarchive',
'xml-format')
D:\Temp\Splunk>
…On Thu, Jan 26, 2023 at 10:11 AM Lowell Alleman ***@***.***> wrote:
This is odd. It seems like some kind of argument parsing issue. It looks
like it's seeing sort --inplace *.conf as a single argument.
What output do you get if you run these two commands?
ksconf sort
ksconf sort --help
—
Reply to this email directly, view it on GitHub
<#95 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHLUKSA4KK26TDLWLUUDQT3WUKHY7ANCNFSM6AAAAAAUG33JCI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Unfortunately I don't have a Windows machine at my fingertips to run a quick test on. I do have some unit tests in place that do some simple sorts and other tests that should fail if this argument parsing behavior is broken more broadly. (which seems to be the case here. I'm guessing that I'll see if I can test at some point soon but these feels like an environmental issue more than a code problem.... In the mean time, can you answer/check any of the following:
|
Lowell,,
I ran the test in a DOS box on another machine to see if this was an issue
with my laptop. Here are the results:
D:\Temp>ver
Microsoft Windows [Version 10.0.19044.2604]
D:\Temp>splunk version
Splunk 9.0.4 (build de405f4a7979)
D:\Temp>dir
Volume in drive D is Data
Volume Serial Number is 6675-72D8
Directory of D:\Temp
02/18/2023 11:46 AM <DIR> .
02/18/2023 11:46 AM <DIR> ..
01/20/2023 02:22 PM 34,302 props.conf
1 File(s) 34,302 bytes
2 Dir(s) 1,138,365,452,288 bytes free
D:\Temp>ksconf sort --inplace *.conf
usage: ksconf [-h] [--version] [--force-color] [--disable-color]
{check,combine,diff,filter,merge,minimize,package,promote,rest-export,rest-publish,snapshot,sort,unarchive,xml-format}
...
ksconf: error: invalid choice: 'sort --inplace *.conf' (choose from
'check', 'combine', 'diff', 'filter', 'merge', 'minimize', 'package',
'promote', 'rest-export', 'rest-publish', 'snapshot', 'sort', 'unarchive',
'xml-format')
D:\Temp>
D:\Temp>ksconf --version
#
##
### ## #### ###### ####### ### ## #######
### ## ### ### ## #### ##
##### ### ### ## ## ####### #######
### ## ### ### ## ## ### ### ##
### ## ##### ###### ##### ### ## ##
#
ksconf 0.9.2 (Build 1043)
Python: 3.7.11 (D:\Program Files\Splunk\bin\python3.exe)
Git SHA1 3a52fef committed on 2022-03-04
Installed at: D:\Program Files\Splunk\etc\apps\ksconf\bin\lib\ksconf
Platform: 10.0.19041
Git support: 'git' not found in PATH
Written by Lowell Alleman ***@***.***>.
Copyright (c) 2019 Kintyre Solutions, Inc, all rights reserved.
Licensed under Apache Public License v2
kintyre (splunk-conf)
Commands:
check (stable) OK
combine (beta) OK
diff (stable) OK
filter (alpha) OK
merge (stable) OK
minimize (beta) OK
package (alpha) OK
promote (beta) OK
rest-export (beta) OK
rest-publish (alpha) OK (splunk-sdk 1.6.18)
snapshot (alpha) OK
sort (stable) OK
unarchive (beta) OK
xml-format (alpha) OK (lxml 4.6.5)
D:\Temp>
And this is what I get if I run on the same server in PowerShell:
PS D:\temp> $PSVersionTable.PSVersion
Major Minor Build Revision
…----- ----- ----- --------
5 1 19041 2364
PS D:\temp> splunk version
Splunk 9.0.4 (build de405f4a7979)
PS D:\temp> dir
Directory: D:\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/20/2023 2:22 PM 34302 props.conf
PS D:\temp> ksconf sort --inplace *.conf
usage: ksconf [-h] [--version] [--force-color] [--disable-color]
{check,combine,diff,filter,merge,minimize,package,promote,rest-export,rest-publish,snapshot,sort,unarchive,xml-format}
...
ksconf: error: invalid choice: 'sort --inplace *.conf' (choose from
'check', 'combine', 'diff', 'filter', 'merge', 'minimize', 'package',
'promote', 'rest-export', 'rest-publish', 'snapshot', 'sort', 'unarchive',
'xml-format')
PS D:\temp>
PS D:\temp> ksconf --version
_ __ __ ___ __ __ _ ___
| |/ /' _/ / _//__\| \| | __|
| <`._`.| \_| \/ | | ' | _|
|_|\_\___/ \__/\__/|_|\__|_|
ksconf 0.9.2 (Build 1043)
Python: 3.7.11 (D:\Program Files\Splunk\bin\python3.exe)
Git SHA1 3a52fef committed on 2022-03-04
Installed at: D:\Program Files\Splunk\etc\apps\ksconf\bin\lib\ksconf
Platform: 10.0.19041
Git support: 'git' not found in PATH
Written by Lowell Alleman ***@***.***>.
Copyright (c) 2019 Kintyre Solutions, Inc, all rights reserved.
Licensed under Apache Public License v2
kintyre (splunk-conf)
Commands:
check (stable) OK
combine (beta) OK
diff (stable) OK
filter (alpha) OK
merge (stable) OK
minimize (beta) OK
package (alpha) OK
promote (beta) OK
rest-export (beta) OK
rest-publish (alpha) OK (splunk-sdk 1.6.18)
snapshot (alpha) OK
sort (stable) OK
unarchive (beta) OK
xml-format (alpha) OK (lxml 4.6.5)
PS D:\temp>
I am not that knowledgeable in Python. If you can provide the steps, I can
run the test using a standalone version of Python.
On Tue, Feb 7, 2023 at 10:39 AM Lowell Alleman ***@***.***> wrote:
Unfortunately I don't have a Windows machine at my fingertips to run a
quick test on. I do have some unit tests in place that do some simple sorts
and other tests that should fail if this argument parsing behavior is
broken more broadly. Testing is done using plain vanilla version of python
(rather than the version embedded with Splunk) but it should work the same
unless something is broken with the Splunk install.
I'll see if I can test at some point soon but these feels like an
environmental issue more than a code problem.... In the mean time, can
- Do you have the same behavior if you attempt to run the command from
a PowerShell prompt?
- Do you have more than one machine you can test this on?
- What version of Splunk are you using? Do you have the same problem
if you use a standalone Python install? (rather than using the embedded
Python that ships with Splunk)
—
Reply to this email directly, view it on GitHub
<#95 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHLUKSBCLFWUQW7HPV2YWJ3WWJUCDANCNFSM6AAAAAAUG33JCI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
BTW, was not able to replicate this on my own windows10 desktop at home, using both the Command Prompt and Windows PS. Also worked fine using WSL2. Splunk is not installed. I am using Windows Terminal version 1.16.10261.0, the latest from the Microsoft store, so maybe try that if you haven't already @EdGarrity Microsoft Windows [Version 10.0.19044.2251] Installed KSCONF 0.10.0b7
|
Ah, found v0.9.2 by the old name, can't replicate this issue with kintyre_splunk_conf 0.9.2 either:
|
I also was not able to get ksconf to sort a .conf file running inside the
Python virtual environment.
…On Sat, Feb 18, 2023 at 3:22 PM pmeyerson ***@***.***> wrote:
Ah, found v0.9.2 by the old name, can't replicate this issue with
kintyre_splunk_conf 0.9.2 either:
(.venv) C:\Users\phil\Documents\repos\ktest>ksconf sort --inplace *.conf
Error trying to process file a.conf. Error: Unexpected entry: '"[general]"
'
Replaced file a.conf with sorted content.
Error trying to process file b.conf. Error: Unexpected entry: '"[Default]"
'
Replaced file b.conf with sorted content.
(.venv) C:\Users\phil\Documents\repos\ktest>
—
Reply to this email directly, view it on GitHub
<#95 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHLUKSGF4WWEOQT3JTK3WULWYEVPPANCNFSM6AAAAAAUG33JCI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The problem
We are having issues using ksconf to sort a conf file. When we run the script following the instructions, we get an error message as if the script does not recognize the sort command.
Environment
ksconf --version
)ksconf 0.9.2 (Build 1043)
Python: 3.7.11 (D:\Program Files\Splunk\bin\python3.exe)
OS & version used:
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.19044 N/A Build 19044
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Python version:
Python 3.7.11
Installed via: (pip, git, Splunk app, or so on)
Installed via Splunk app
Details
Running "ksconf sort --inplace *.conf" produces the following output:
The text was updated successfully, but these errors were encountered: