xneelo / hetzner-needrestart

A puppet module for installing and configuring needrestart
3 stars 8 forks source link

override_rc parameter crashes needrestart as documented #17

Closed anarcat closed 4 years ago

anarcat commented 5 years ago

The following configuration, provided as an example in the README, crashes needrestart:

override_rc:
    'qr(^dbus)': 0
    'qr(^gdm)': 0
    'qr(^mysql)': 0
    'qr(^apache2)': 0

This is the error:

Error parsing /etc/needrestart/needrestart.conf: Error parsing /etc/needrestart/conf.d/overrides.conf: Can't modify pattern quote (qr//) in scalar assignment at (eval 18) line 6, at EOF
syntax error at (eval 18) line 7, near ";
    qr(^gdm)"
syntax error at (eval 18) line 10, near ";
}"

And this is the generated configuration:

 $nrconf{override_rc} = {
-    qr(^bacula-sd\.service$) = 0;
+    qr(^dbus) = 0;
+    qr(^gdm) = 0;
+    qr(^mysql) = 0;
+    qr(^apache2) = 0;
 };

I have tried to find the right way of setting those overrides and it seems there was some work done to do that in #5, but the template that was modified there isn't used anywhere. It looks like @vorlon's fork and this version (available on the forge) have significantly diverged, enough that the parameters in that template are not in use.

anarcat commented 5 years ago

similarily, passing parameters to the class directly, like this:

class { 'needrestart':
  configs => [ 'restart' => 'a' ]
}

crashes with:

Error parsing /etc/needrestart/needrestart.conf: Error parsing /etc/needrestart/conf.d/overrides.conf: Can't modify constant item in scalar assignment at (eval 19) line 4, at EOF

the generated config is, strangely:

$nrconf{default_value} = {
    restart = 'a';
};

update: #18 is an attempt at fixing this.

anarcat commented 5 years ago

and i used this as a workaround for this general issue:

  $ignorelist = {
    'backups' => ['bacula-sd'],
  }

  # https://github.com/hetznerZA/hetzner-needrestart/issues/17
  file {
    '/etc/needrestart/conf.d/more_overrides.conf':
      content => template('needrestart/needrestart_customisations.conf.erb');
  }

would sure be nice to figure out what to do with that template :)

anarcat commented 5 years ago

i think this problem might have been introduced in #12 or #13

HenluStarke commented 5 years ago

Hi there, Thanks for bringing the issue to our attention, we will have a look and revert back in the coming weeks.

anarcat commented 5 years ago

hello! did you look at this again?