Skip to content

Conversation

mxzinke
Copy link

@mxzinke mxzinke commented Aug 23, 2021

Supporting Windows:

@genebean
Copy link
Collaborator

So, the notify that is in here already should actually be correct. I think the issue my lie in the way service.pp or config.pp is applied on Raspbian. Can you post the output of facter os and also share what version of puppet you are using?

@mxzinke
Copy link
Author

mxzinke commented Aug 24, 2021

With systemd::unit_file you don't need a notify anymore.

Facts:

{
  architecture => "armv7l",
  distro => {
    codename => "buster",
    description => "Raspbian GNU/Linux 10 (buster)",
    id => "Raspbian",
    release => {
      full => "10.10",
      major => "10",
      minor => "10"
    }
  },
  family => "Debian",
  hardware => "armv7l",
  name => "Raspbian",
  release => {
    full => "10.10",
    major => "10",
    minor => "10"
  },
  selinux => {
    enabled => false
  }
}

@genebean
Copy link
Collaborator

@mxzinke What version of Puppet?

enable => $promtail::service_enable,
require => Systemd::Unit_file['promtail.service'],
enable => $promtail::service_enable,
active => $promtail::service_ensure == 'running'
Copy link
Contributor

Choose a reason for hiding this comment

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

I love the syntax <3

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not familiar with this syntax @bastelfreak, what does it do and why do you <3 it?

Copy link
Author

Choose a reason for hiding this comment

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

Maybe because it's readable?

class promtail::service {
case $facts['kernel'] {
'Linux': {
include systemd::systemctl::daemon_reload
Copy link
Contributor

Choose a reason for hiding this comment

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

this resource is gone in latest releases of the systemd module. The module now requires puppet 6.1 or newer because that version contains the automatic systemctl daemon-reload und changed/new unit files.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This module already states 6.1 as the bottom end so I think removing this would make sense.

@genebean
Copy link
Collaborator

@mxzinke I need a couple of things:

  1. please fix the syntax error shown in the tests. You can easily check for others by running pdk validate and pdk test unit locally if you want.
  2. please remove the daemon_reload line as noted above.

Also, still wondering what version of puppet you are running.

@bastelfreak
Copy link
Contributor

@mxzinke which version of the systemd module do you have in your environment and which puppet version are you on? And you use systemd, right (the code really looke like it but the error message sounds so much like sysv)?

as mentioned in the inline comment, camptocamp/systemd dropped the exec resource which does a systemctl daemon-reload with the 3.0.0 release: voxpupuli/puppet-systemd#171

to make this a bit more confusing, after the release the module got migrated to Vox Pupuli. To work properly you need the latest camptocamp module and puppet 6.1 or newer. I assume you've a combination of an older systemd module and/or puppet. I'm not aware of any issues with the latest version + puppet 6.1 so the code changes shouldn't be required, but I also think it's a good cleanup and the service should be managed through systemd::unit_file (as long as the promtail isn't installed from a package).

@mxzinke
Copy link
Author

mxzinke commented Aug 30, 2021

@mxzinke What version of Puppet?

Puppet Version 6.23

Hash $positions_config_hash,
Hash $scrape_configs_hash,
Stdlib::Absolutepath $bin_dir,
Stdlib::Absolutepath $bin_dir = promtail::params::bin_dir,
Copy link
Contributor

Choose a reason for hiding this comment

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

my personal opinion is that instead of adding a params.pp, hiera in modules should be used (but I'm not a maintainer here).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, please move this to the existing in module data. I will comment below with some pointers in case this is not something you have done before (no disrespect intended if you have, just trying to help)

Copy link
Author

Choose a reason for hiding this comment

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

Would be nice. If you could do it. Also would be nice if you could have a look at the windows service thing, it seems to not work correctly.

Copy link
Collaborator

@genebean genebean left a comment

Choose a reason for hiding this comment

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

I absolutely love that you are adding Windows support, but that work also needs to be its own PR, not added onto this one.

Regarding this PR, @bastelfreak brought up in #33 (comment) that your issue might well be related to the version of the systemd module you are using. Does that line up at all with what you have locally?

Hash $positions_config_hash,
Hash $scrape_configs_hash,
Stdlib::Absolutepath $bin_dir,
Stdlib::Absolutepath $bin_dir = promtail::params::bin_dir,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, please move this to the existing in module data. I will comment below with some pointers in case this is not something you have done before (no disrespect intended if you have, just trying to help)

Comment on lines +8 to +11
'Linux': {
$bin_dir = '/usr/local/bin'
$data_dir = '/usr/local/promtail_data'
$config_dir = '/etc/promtail'
Copy link
Collaborator

Choose a reason for hiding this comment

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

These items belong in data/kernel/Linux.yaml

Comment on lines +14 to +16
$bin_dir = 'C:\\Program Files\\promtail'
$data_dir = "${bin_dir}\\versions"
$config_dir = "${bin_dir}\\config"
Copy link
Collaborator

Choose a reason for hiding this comment

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

These items belong in data/kernel/windows.yaml

@mxzinke
Copy link
Author

mxzinke commented Sep 16, 2021

I absolutely love that you are adding Windows support, but that work also needs to be its own PR, not added onto this one.

Sorry, I actually worked with my fork and forgot to change the branch. The original issue is actually gone. So may we just change the title and work on the Windows Support. It's actually needed soon.

Regarding this PR, @bastelfreak brought up in #33 (comment) that your issue might well be related to the version of the systemd module you are using. Does that line up at all with what you have locally?

The solution for my issue was to set the correct default provider.

@mxzinke mxzinke changed the title Fix Service on Raspbian OS Support Windows Sep 16, 2021
@mxzinke
Copy link
Author

mxzinke commented Sep 16, 2021

Just to tell one more time and to not confuse:

The original problem resolved by setting a correct default service provider. (to systemd)

I changed the title of the PR to now supporting windows. Sorry for switching topics, but I am really in a hurry and sometimes you mess things up

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Maximilian Zinke seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

# @param [Stdlib::Absolutepath] bin_dir
# The directory in which to create a symlink to the promtail binary
#
# @param [Stdlib::Absolutepath] config_dir
Copy link
Contributor

Choose a reason for hiding this comment

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

since newer puppet-strings releases, you don't have to provide the datatype here, puppet-strings will read it from the actual code

#
# Sets default variables per OS
#
# @api private
Copy link
Contributor

Choose a reason for hiding this comment

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

if this class is private I suggest adding assert_private() to the code

@mxzinke
Copy link
Author

mxzinke commented Aug 24, 2022

@bastelfreak In case this topic is still in your interest, please go on. I've no time for managing bringing the change into the project. Sorry.

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.

4 participants