Kintyre / ksconf

Kintyre's Splunk Configuration tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unarchive: The system cannot find the file specified

SID800 opened this issue · comments

commented

Env:
ksconf 0.7.7rc1
Windows

Issue:
Looks like unarchive is looking for git and failing to find it?
Adding --git-mode nochange did not change the error either.

Stack

C:\Temp\test>ksconf unarchive c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting archive:               c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting destination folder:    C:\Temp\test\Splunk_TA_windows
Unhandled top-level exception.  [Error 2] The system cannot find the file specified
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\ksconf\__main__.py", line 185, in cli
    return_code = args.funct(args)
  File "c:\python27\lib\site-packages\ksconf\commands\__init__.py", line 377, in launch
    return_code = self.run(args)
  File "c:\python27\lib\site-packages\ksconf\commands\unarchive.py", line 186, in run
    is_git = git_is_working_tree(args.dest)
  File "c:\python27\lib\site-packages\ksconf\vc\git.py", line 67, in git_is_working_tree
    return git_cmd(["rev-parse", "--is-inside-work-tree"], cwd=path).returncode == 0
  File "c:\python27\lib\site-packages\ksconf\vc\git.py", line 20, in git_cmd
    proc = Popen(cmdline_args, stdout=out, stderr=out, shell=shell, cwd=cwd)
  File "c:\python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

First, are you attempting to use git integration here, or is it just getting in the way? (Ksconf should autodetect when git isn't available and just disable that functionality without any additional fuss; but it's possible that's not working as designed.)

If you don't want to use git, try using ksconf unarchive --git-mode nochange --git-sanity-check off and see if that makes a difference.

If you are trying to use git integration, can you confirm that (1) Git is in your PATH, and (2) can you provide the version info. (Just typing git --version at the prompt should answer both questions.)
Also, can you confirm that your destination path is part of a git repo? (So C:\Temp\Test is a git working tree.)

commented

In this case, not specifically looking to leverage the git integration features of ksconf.

--git-mode nochange --git-sanity-check off
still the same error occurs.

Git is installed ( C:\Program Files\Git\cmd\git.exe ) but not in the PATH.
C:\temp\test\ is NOT a repro -- just standalone folders for testing this out ;)
git version 2.22.0.windows.1

Hmm. Can you try adding GIT to your PATH and see if that works correctly? You should see the phrase without version control support show up in the output regarding the destination folder. (Ksconf actually uses git to determine if a folder is part of a working tree or not; as simply searching for the .git folder isn't always "good enough" in some corner cases leading for false positives and false negatives.)

Either way, this is clearly a bug. But this workaround may let you keep working.

I'm, doing more local testing on my side. This could be another Windows vs Nix variation. I typically run ksconf alongside git.

commented

git in the path did not help.

C:\Temp\test>ksconf unarchive --git-mode nochange --git-sanity-check off c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting archive:               c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting destination folder:    C:\Temp\test\Splunk_TA_windows
Unhandled top-level exception.  [Error 2] The system cannot find the file specified
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\ksconf\__main__.py", line 185, in cli
    return_code = args.funct(args)
  File "c:\python27\lib\site-packages\ksconf\commands\__init__.py", line 377, in launch
    return_code = self.run(args)
  File "c:\python27\lib\site-packages\ksconf\commands\unarchive.py", line 177, in run
    is_git = git_is_working_tree(dest_app)
  File "c:\python27\lib\site-packages\ksconf\vc\git.py", line 67, in git_is_working_tree
    return git_cmd(["rev-parse", "--is-inside-work-tree"], cwd=path).returncode == 0
  File "c:\python27\lib\site-packages\ksconf\vc\git.py", line 20, in git_cmd
    proc = Popen(cmdline_args, stdout=out, stderr=out, shell=shell, cwd=cwd)
  File "c:\python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

C:\Temp\test>git --version
git version 2.22.0.windows.1

Yeah, found and hopefully resolved several bugs in there where git stuff was assumed to be in place that was never intended in the design. Thanks for your patience and willingness to submit all these bug reports. I truly appreciate the feedback!

Give v0.7.7rc2 a try and let me know how it goes. Several commands like unarchive and promote (batch mode) have been quite difficult to get unit tests around. I'll do my best to prevent future regressions.

commented

v0.7.7rc2 works without this error.

I need to figure out the various parameters, as it nuked all my customization (default.d/my-org/*.conf). More testing that tomorrow....

C:\Temp>ksconf unarchive c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting archive:               c:\temp\test\Splunk_TA_windows-4.8.4.tar.gz
Inspecting destination folder:    C:\Temp\Splunk_TA_windows
 Installed app packaging info:    'Splunk Add-on for Microsoft Windows' by Splunk, Inc. (version 4.8.4)
   Tarball app packaging info:    'Splunk Add-on for Microsoft Windows' by Splunk, Inc. (version 4.8.4)
About to upgrade the Splunk_TA_windows app without version control support (git not present).
Before upgrade.  App has 143 files
Extraction exclude patterns:  []
Extracting app now...
<snip>
Extracted 100 files:  96 new, 4 existing, and 139 removed
Keep file patterns:  [u'(^|.../).git*', u'local/...', u'(^|.../)local.meta']
Removing files not present in the upgraded version of the app.
<snip>

Found an additional bug in the rc2 which was caught by Windows automated testing, but I just now saw it. Publishing v0.7.7rc4 with the fix. This should properly handle git detection in all cases on Windows.

0.7.7 was officially released.