Skip to content
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

WIP : Add chocolatey support #237

Closed
wants to merge 20 commits into from
Closed

WIP : Add chocolatey support #237

wants to merge 20 commits into from

Conversation

hdep
Copy link

@hdep hdep commented Jan 8, 2020

No description provided.

manifests/params.pp Outdated Show resolved Hide resolved
manifests/init.pp Outdated Show resolved Hide resolved
manifests/init.pp Outdated Show resolved Hide resolved
@pcfens
Copy link
Owner

pcfens commented Jan 10, 2020

Thanks for all the work on this so far. I've added a few comments on what you've done so far, but this is significantly more then I would have been able to set up.

@hdep hdep force-pushed the choco branch 2 times, most recently from f59c21f to 583fedf Compare January 11, 2020 14:54
@hdep
Copy link
Author

hdep commented Jan 11, 2020

hi @pcfens I did the change you asked. Can you please review them ? Thanks !

@pcfens
Copy link
Owner

pcfens commented Jan 13, 2020

Looks great. If you have time, could you add the new parameters to the comments in init.pp and to the README? A note that package_provider is ignored unless you're on a Windows box would be helpful too. If you're running out of time I'm happy to add both of those too.

Thanks for putting all of this together. As soon as you drop the WIP flag I'm happy to merge it.

@hdep
Copy link
Author

hdep commented Jan 15, 2020

If this version is ok for you, last thing to do is to test on a windows box.

@pcfens
Copy link
Owner

pcfens commented Jan 17, 2020

Thanks a ton for putting this together. I don't have access to a good setup to test - do you?

If not, we can probably merge whenever since the changes won't break existing installs (I'll just add a note that chocolatey support is experimental or something).

@hdep
Copy link
Author

hdep commented Jan 18, 2020

I do have windows server so I'll be able to test as soon as I've got some time.
But yeah if you are not afraid you can merge and i'll test with master :)

@hdep
Copy link
Author

hdep commented Jan 20, 2020

I just run one test : it fails beause by default we set 7.1.0 for package_ensure, but this version doesn't exist in chocolatey repository.

either we upgrade the value of 7.1.0 to something like 7.2.0 or I need to set a case statement in params.pp

what do you prefer ?

Here is the available release :
https://chocolatey.org/packages/filebeat#versionhistory

@hdep
Copy link
Author

hdep commented Jan 20, 2020

Last but not least, chocolatey install the package into C:\ProgramData\chocolatey\lib\filebeat\tools by default, hence we need to manage this as well. I'll give a look if I can specify specific value when using chocolatey

manifests/params.pp Outdated Show resolved Hide resolved
@pcfens
Copy link
Owner

pcfens commented Jan 21, 2020

Thanks for all your work on this - I'm sorry we keep running in to little things.

Feel free to update the default to 7.2.0 (or latest, I imagine most folks set some value).

@hdep
Copy link
Author

hdep commented Jan 22, 2020

this code doesn't work. The if statement return false, I don't understand why.
So the path are wrong :

Info: Applying configuration version '1579685172'
Error: Cannot create C:/Program Files/Filebeat/conf.d; parent directory C:/Program Files/Filebeat does not exist
Error: /Stage[main]/Filebeat::Config/File[filebeat-config-dir]/ensure: change from 'absent' to 'directory' failed: Canno
t create C:/Program Files/Filebeat/conf.d; parent directory C:/Program Files/Filebeat does not exist (corrective)
Notice: /Stage[main]/Filebeat::Config/File[filebeat.yml]: Dependency File[filebeat-config-dir] has failures: true
Warning: /Stage[main]/Filebeat::Config/File[filebeat.yml]: Skipping because of failed dependencies
Warning: /Stage[main]/Profiles::Base::Windows/Filebeat::Input[syslog]/File[filebeat-syslog]: Skipping because of failed
dependencies
Warning: /Stage[main]/Filebeat::Service/Service[filebeat]: Skipping because of failed dependencies
Warning: /Stage[main]/Filebeat/Anchor[filebeat::end]: Skipping because of failed dependencies
Notice: Applied catalog in 33.87 seconds

@pcfens
Copy link
Owner

pcfens commented Jan 22, 2020

I'm not sure that conditional defaults are possible since params.pp is evaluated before the init.pp. I think the logic might have to be implemented either in init.pp or in the install/windows.pp file.

I've seen this done before by setting all of the values to undef, then checking them later on (kind of like we're doing for the download URL)

@hdep
Copy link
Author

hdep commented Feb 3, 2020

Hi @pcfens I've working hard trying to make this work, but I'm stuck. I'm not able to manage properly the path file for Chocolatey. Any help are more than welcome.

Thanks

@@ -100,11 +102,17 @@
Optional[String] $systemd_beat_log_opts_override = undef,
String $systemd_beat_log_opts_template = $filebeat::params::systemd_beat_log_opts_template,
String $systemd_override_dir = $filebeat::params::systemd_override_dir,

Variant[String, Enum['exec', 'chocolatey']] $package_provider = undef,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I would expect this to use exec by default as one of the params. $filebeat::params::package_provider, but I can see why maybe not drop it into the params since it would not be platform agnostic

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I want exec by default and chocolatey as an option. Not sure what I can do here ? I want to let the choice to the user. what do you recommend ?

$filebeat_path = join([$cmd_install_dir, 'Filebeat', 'filebeat.exe'], '\\')
}
else {
$filebeat_path = 'C:/ProgramData/chocolatey/lib/filebeat/tools/filebeat.exe'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"$env:ChocolateyInstall/bin/filebeat.exe" (needs ruby code for environment) - also I'm pointing to the shim in the bin folder, but you can stick with lib if you want.

@ferventcoder
Copy link

I would like to see source be a possibility as most folks using Puppet are not likely to be using the community repo (the default). However, If they've already configured default sources, then choco will just use those - so not being explicit has a way to just work. 👍

@hdep
Copy link
Author

hdep commented Feb 20, 2020

Hi @ferventcoder thanks, my main issue is that I'm not able to make $package_provider by default exec and switch to chocolatey if specified.

In my test environment it just fail to run with chocolatey.

@hdep
Copy link
Author

hdep commented Apr 8, 2020

Hi,

i've been debuging this. It doesn't works because params.pp is evaluated first (init.pp herits from params.pp).
I don't know yet how to do manage this.
Any idea are more than welcome !

@hdep
Copy link
Author

hdep commented Apr 15, 2020

I close this ins favor of #247

@hdep hdep closed this Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants