puppet-filebeat icon indicating copy to clipboard operation
puppet-filebeat copied to clipboard

Working directory 'C:/Program Files/Filebeat' does not exist

Open cdenneen opened this issue 6 years ago • 7 comments
trafficstars

module version: 3.4.0

[mNotice: /Stage[main]/Filebeat::Install::Windows/Archive[C:/Windows/Temp/filebeat-6.8.2-windows-x86_64.zip]/ensure: download archive from https://artifactory.example.com/beats-windows/filebeat/filebeat-6.8.2-windows-x86_64.zip to C:/Windows/Temp/filebeat-6.8.2-windows-x86_64.zip  without cleanup[0m
[mNotice: /Stage[main]/Filebeat::Install::Windows/Exec[unzip filebeat-6.8.2-windows-x86_64]/returns: executed successfully[0m
[mNotice: /Stage[main]/Filebeat::Install::Windows/File[C:/Windows/Temp/filebeat-6.8.2-windows-x86_64.zip]/ensure: removed[0m
[mNotice: /Stage[main]/Filebeat::Install::Windows/Exec[rename filebeat-6.8.2-windows-x86_64]/returns: executed successfully[0m
[mNotice: /Stage[main]/Filebeat::Install::Windows/Exec[mark filebeat-6.8.2-windows-x86_64]/returns: executed successfully[0m
[1;31mError: /Stage[main]/Filebeat::Install::Windows/Exec[install filebeat-6.8.2-windows-x86_64]: Failed to call refresh: Working directory 'C:/Program Files/Filebeat' does not exist[0m
[1;31mError: /Stage[main]/Filebeat::Install::Windows/Exec[install filebeat-6.8.2-windows-x86_64]: Working directory 'C:/Program Files/Filebeat' does not exist[0m
[1;31mError: Cannot create C:/Program Files/Filebeat/conf.d; parent directory C:/Program Files/Filebeat does not exist[0m
[1;31mError: /Stage[main]/Filebeat::Config/File[filebeat-config-dir]/ensure: change from absent to directory failed: Cannot create C:/Program Files/Filebeat/conf.d; parent directory C:/Program Files/Filebeat does not exist[0m

This is definitely an ordering issue because the second run works fine. I'm just trying to track down which resource is the culprit.

cdenneen avatar Aug 12 '19 16:08 cdenneen

@pcfens I do not use chocolatey and install 7zip prior to this step. So I'm guessing this works for people who use chocolatey vs those using 7zip.

if that's the case maybe a boolean of use_chocolatey or use_7zip that would allow for extract => true parameter to archive and wrapping around the unzip command that doesn't seem to be working in my case.

https://github.com/pcfens/puppet-filebeat/blob/master/manifests/install/windows.pp#L40-L47

cdenneen avatar Aug 12 '19 16:08 cdenneen

If it's possible to resolve the dependency issue without requiring a specific piece of software then I think that's a good thing, but since I'm not a Windows person at all I'm not sure what's reasonable on that front and what isn't.

I don't know if @edestecd is still around, but his comments might be helpful since he's the original author of this (and included a comment about it).

I read the comment as though any unzip package will work with the current implementation, but the archive module requires 7zip. By not using the archive module's built in feature users are free to use whichever unzip tool they like.

pcfens avatar Aug 13 '19 00:08 pcfens

This should have nothing to do with 7zip or chocolatey as far as i can see. Neither is used here. Powershell commands are used to unzip the archive.

edestecd avatar Aug 19 '19 13:08 edestecd

All the proper requires are used here. I have experienced some "lag" in windows file manipulation in the past. This is my guess. I don't really know how to fix this as it seems like an underlying os or puppet issue.

edestecd avatar Aug 19 '19 13:08 edestecd

@edestecd not sure. It constantly is failing for my users trying to apply configuration that the parent directory of C:\Program Files\Filebeat doesn’t exist. (install_dir)

cdenneen avatar Aug 19 '19 15:08 cdenneen

I can confirm this. it looks like provider => powershell, is taking too long

this is weird filebeat installer should also create the directory and the config should wait any way.

Personally, Filebeat should be putting conf files in the ProgramsData location anyway. ProgramsData\Filebeat\conf.d
and the data directory should be in the ProgramsData\Filebeat\data
thats my op

maybe on windows decouple the conf from the Program Files\Filebeat\ and place it into ProgramsData\Filebeat\ ? I know this is opinionated tho

freibuis avatar Aug 21 '19 02:08 freibuis

I've seen a similar issue with the metricbeat module. I've seen the note in the install module about the archive module requiring 7-zip to be installed but this isn't strictly true (at least not any more). The archive resource will happily unzip a .zip file using PowerShell (and as a bonus clean up after itself). If 7-zip is installed it will use that instead so it'll be faster.

Today I submitted a PR to the metricbeat module which allows the behaviour to be configurable - feel free to take it if it's possible that this may help with this issue (since it means that the archive resource will unzip and cleanup in one fell swoop).

dannygoulder avatar Feb 16 '21 19:02 dannygoulder