File 0001-SCRD-2696-Install-systemd-service-files-into-etc-sys.patch of Package python-ardana-packager

From 3d6a531e43ac03de9e9d4ec28be12118fb75d5a0 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold <tbechtold@suse.com>
Date: Fri, 2 Feb 2018 11:58:45 +0100
Subject: [PATCH 2/2] SCRD-2696 Install systemd service files into /etc/systemd

/usr/lib/systemd is owned by packages so use the correct place to
install custom service files.

Also do not create an Alias with a duplicate name.
The [install] section of a systemd .service file should not create an
Alias= entry with the same name as the .service file itself. This
information is redundant and  will lead to eg:

$ systemctl reenable swift-proxy-server
Failed to execute operation: Invalid argument

when trying to (re)enable a service.

Note: This only happens since the custom .service files moved from
/usr/lib/systemd/system to /etc/system/system .

Change-Id: I55f3895abb0c5103436a99a3e459402d557404e8
---
 .../packager/ardana_packager/setup_systemd.py      | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/ansible/library_python/packager/ardana_packager/setup_systemd.py b/ansible/library_python/packager/ardana_packager/setup_systemd.py
index a8ca95a..eae2b2f 100644
--- a/ansible/library_python/packager/ardana_packager/setup_systemd.py
+++ b/ansible/library_python/packager/ardana_packager/setup_systemd.py
@@ -40,7 +40,7 @@ from ardana_packager.ansible import AnsibleModule
 #             Default: simple
 
 # Location of systemd system dir
-SYSTEMD_DIR = "/usr/lib/systemd/system"
+SYSTEMD_DIR = "/etc/systemd/system"
 SYSTEMCTL = "/bin/systemctl"
 
 
@@ -226,24 +226,24 @@ def write_systemd(service, cmd, name, install_path, user, group,
          "StandardError={stderr}\n"
          "\n"
          "[Install]\n"
-         "WantedBy=multi-user.target {wanted_by}\n"
-         "Alias={name}.service\n").format(service=service,
-                                          cmd=cmd,
-                                          name=name,
-                                          install_path=install_path,
-                                          user=user,
-                                          group=group,
-                                          args=args,
-                                          startup_type=startup_type,
-                                          env=env_str,
-                                          restart_params=restart_params,
-                                          limit_params=limit_params,
-                                          wants=wants,
-                                          wanted_by=wanted_by,
-                                          before=before,
-                                          after=after,
-                                          stdout=stdout,
-                                          stderr=stderr)
+         "WantedBy=multi-user.target {wanted_by}\n").format(
+             service=service,
+             cmd=cmd,
+             name=name,
+             install_path=install_path,
+             user=user,
+             group=group,
+             args=args,
+             startup_type=startup_type,
+             env=env_str,
+             restart_params=restart_params,
+             limit_params=limit_params,
+             wants=wants,
+             wanted_by=wanted_by,
+             before=before,
+             after=after,
+             stdout=stdout,
+             stderr=stderr)
 
     return file_write_check(s, name)
 
-- 
2.16.1

openSUSE Build Service is sponsored by