quattor / configuration-modules-core

Node Configuration Manager Components for Everyone
www.quattor.org
Other
6 stars 54 forks source link

ncm-systemd 17.7: unable to create service #1209

Open jouvin opened 6 years ago

jouvin commented 6 years ago

I cannot succeed to get a service created with ncm-systemd despite doing something very similar to another working one. The main difference is probably the errata level of the 2 machines (both CentOS 7.4). The ncm-systemd config is:

'/software/components/systemd/skip/service' = false;

prefix '/software/components/systemd/unit/sonarqube/file/config/unit';
'After' = list('network.target');
'Description' = 'SonarQube service';
prefix '/software/components/systemd/unit/sonarqube/file/config/install';
'WantedBy' = list('multi-user.target');
prefix '/software/components/systemd/unit/sonarqube/file/config/service';
'ExecStart' = format('%s start', LAL_SONAR_BIN);
'ExecStop' = format('%s stop', LAL_SONAR_BIN);
'ExecReload' = format('%s restart', LAL_SONAR_BIN);
'Restart' = 'always';
'Type' = 'forking';
'Group' = SONARQUBE_GROUP;
'User' = SONARQUBE_USER;

When running ncm-systemd, this results in the following error after creating the sonarqube.service.d directory with the quattor.conf file (I attached a debug 1 output: :

[ERROR] systemctl_command_units /usr/bin/systemctl enable -- sonarqube.service returned ec 256 and output Failed to execute operation: No such file or directory
stdweird commented 6 years ago

@jouvin is there a sonarqube.service unitfile in /usr/lib/systemd/system/? if not or and you want to make a unitfile to "replace" the shipped one, you need to set /software/components/systemd/unit/sonarqube/file/replace = true. the unitfile you need should be called sonarqube.service; unitfiles in a .d subdir only refine system provided ones. the replace boolean indicates this.

jouvin commented 6 years ago

@stdweird thanks! I should have read the documentation as it is probably said... this was obviously the problem and it works fine now.

jouvin commented 6 years ago

I'm just wondering why I didn't have the problem in the other service I added on another machine where I'm missing also replace=true (as this other service is not in /usr/lib/systemd/system/ too. Should not replace apply only to service that already have a "standard" definition in /usr/lib/systemd/system/?

stdweird commented 6 years ago

yes, but i'm not sure if it is as simple as checking of there's a unit in /usr/lib/systemd/system. also, it could be you are missing an rpm or something like that provides a unitfile, there should be a way to handle the scenario where you add one later. i think the main problem is lack of documentation/examples, so i'd probably spend some effort there rather than to look for better default behaviour

jouvin commented 6 years ago

Good enough for the time being! It would be good to have a documentation for all the great features of ncm-systemd! I find it really a powerful component.