File pacemaker-libcrmservice-separate-LSB-specific-code-into-own-source-files.patch of Package pacemaker.26413

commit 8f74a6abec0f5dbb778f98e433077f9ef589c07c
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Mon May 7 12:53:01 2018 -0500

    Refactor: libcrmservice: separate LSB-specific code into own source files
    
    ... to be more orthogonal to systemd and upstart. No code changes other
    than some function renames.

Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/Makefile.am
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/services/Makefile.am
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/Makefile.am
@@ -1,19 +1,8 @@
-# Copyright (c) 2012 David Vossel <davidvossel@gmail.com>
 #
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# 
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-# 
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# Copyright 2012-2018 David Vossel <davidvossel@gmail.com>
 #
+# This source code is licensed under the GNU Lesser General Public License
+# version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
 #
 
 MAINTAINERCLEANFILES = Makefile.in
@@ -21,7 +10,8 @@ MAINTAINERCLEANFILES = Makefile.in
 AM_CPPFLAGS			= -I$(top_srcdir)/include
 
 lib_LTLIBRARIES			= libcrmservice.la
-noinst_HEADERS			= pcmk-dbus.h upstart.h systemd.h services_private.h
+noinst_HEADERS			= pcmk-dbus.h upstart.h systemd.h \
+				  services_lsb.h services_private.h
 
 libcrmservice_la_LDFLAGS	= -version-info 8:0:0
 libcrmservice_la_CPPFLAGS	= -DOCF_ROOT_DIR=\"@OCF_ROOT_DIR@\" $(AM_CPPFLAGS)
@@ -32,7 +22,7 @@ libcrmservice_la_LDFLAGS	+= $(LDFLAGS_HA
 
 libcrmservice_la_LIBADD		= $(GIO_LIBS) $(top_builddir)/lib/common/libcrmcommon.la $(DBUS_LIBS)
 
-libcrmservice_la_SOURCES	= services.c services_linux.c
+libcrmservice_la_SOURCES	= services.c services_linux.c services_lsb.c
 if BUILD_DBUS
 libcrmservice_la_SOURCES	+= dbus.c
 endif
Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/services.c
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/services/services.c
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/services.c
@@ -25,6 +25,7 @@
 #include <crm/services.h>
 #include <crm/msg_xml.h>
 #include "services_private.h"
+#include "services_lsb.h"
 
 #if SUPPORT_UPSTART
 #  include <upstart.h>
@@ -48,14 +49,6 @@ static GList *inflight_ops = NULL;
 
 static void handle_blocked_ops(void);
 
-svc_action_t *
-services_action_create(const char *name, const char *action,
-                       guint interval_ms, int timeout)
-{
-    return resources_action_create(name, PCMK_RESOURCE_CLASS_LSB, NULL, name,
-                                   action, interval_ms, timeout, NULL, 0);
-}
-
 /*!
  * \brief Find first service class that can provide a specified agent
  *
@@ -70,11 +63,6 @@ services_action_create(const char *name,
 const char *
 resources_find_service_class(const char *agent)
 {
-    /* Priority is:
-     * - lsb
-     * - systemd
-     * - upstart
-     */
     char *path = NULL;
 
 #ifdef LSB_ROOT_DIR
@@ -858,225 +846,6 @@ handle_blocked_ops(void)
     processing_blocked_ops = FALSE;
 }
 
-#define lsb_metadata_template  \
-    "<?xml version='1.0'?>\n"                                           \
-    "<!DOCTYPE resource-agent SYSTEM 'ra-api-1.dtd'>\n"                 \
-    "<resource-agent name='%s' version='" PCMK_DEFAULT_AGENT_VERSION "'>\n" \
-    "  <version>1.0</version>\n"                                        \
-    "  <longdesc lang='en'>\n"                                          \
-    "%s"                                                                \
-    "  </longdesc>\n"                                                   \
-    "  <shortdesc lang='en'>%s</shortdesc>\n"                           \
-    "  <parameters>\n"                                                  \
-    "  </parameters>\n"                                                 \
-    "  <actions>\n"                                                     \
-    "    <action name='meta-data'    timeout='5' />\n"                  \
-    "    <action name='start'        timeout='15' />\n"                 \
-    "    <action name='stop'         timeout='15' />\n"                 \
-    "    <action name='status'       timeout='15' />\n"                 \
-    "    <action name='restart'      timeout='15' />\n"                 \
-    "    <action name='force-reload' timeout='15' />\n"                 \
-    "    <action name='monitor'      timeout='15' interval='15' />\n"   \
-    "  </actions>\n"                                                    \
-    "  <special tag='LSB'>\n"                                           \
-    "    <Provides>%s</Provides>\n"                                     \
-    "    <Required-Start>%s</Required-Start>\n"                         \
-    "    <Required-Stop>%s</Required-Stop>\n"                           \
-    "    <Should-Start>%s</Should-Start>\n"                             \
-    "    <Should-Stop>%s</Should-Stop>\n"                               \
-    "    <Default-Start>%s</Default-Start>\n"                           \
-    "    <Default-Stop>%s</Default-Stop>\n"                             \
-    "  </special>\n"                                                    \
-    "</resource-agent>\n"
-
-/* See "Comment Conventions for Init Scripts" in the LSB core specification at:
- * http://refspecs.linuxfoundation.org/lsb.shtml
- */
-#define LSB_INITSCRIPT_INFOBEGIN_TAG "### BEGIN INIT INFO"
-#define LSB_INITSCRIPT_INFOEND_TAG "### END INIT INFO"
-#define PROVIDES    "# Provides:"
-#define REQ_START   "# Required-Start:"
-#define REQ_STOP    "# Required-Stop:"
-#define SHLD_START  "# Should-Start:"
-#define SHLD_STOP   "# Should-Stop:"
-#define DFLT_START  "# Default-Start:"
-#define DFLT_STOP   "# Default-Stop:"
-#define SHORT_DSCR  "# Short-Description:"
-#define DESCRIPTION "# Description:"
-
-#define lsb_meta_helper_free_value(m)           \
-    do {                                        \
-        if ((m) != NULL) {                      \
-            xmlFree(m);                         \
-            (m) = NULL;                         \
-        }                                       \
-    } while(0)
-
-/*!
- * \internal
- * \brief Grab an LSB header value
- *
- * \param[in]     line    Line read from LSB init script
- * \param[in,out] value   If not set, will be set to XML-safe copy of value
- * \param[in]     prefix  Set value if line starts with this pattern
- *
- * \return TRUE if value was set, FALSE otherwise
- */
-static inline gboolean
-lsb_meta_helper_get_value(const char *line, char **value, const char *prefix)
-{
-    if (!*value && crm_starts_with(line, prefix)) {
-        *value = (char *)xmlEncodeEntitiesReentrant(NULL, BAD_CAST line+strlen(prefix));
-        return TRUE;
-    }
-    return FALSE;
-}
-
-#define DESC_MAX 2048
-
-static int
-lsb_get_metadata(const char *type, char **output)
-{
-    char ra_pathname[PATH_MAX] = { 0, };
-    FILE *fp = NULL;
-    char buffer[1024] = { 0, };
-    char *provides = NULL;
-    char *req_start = NULL;
-    char *req_stop = NULL;
-    char *shld_start = NULL;
-    char *shld_stop = NULL;
-    char *dflt_start = NULL;
-    char *dflt_stop = NULL;
-    char *s_dscrpt = NULL;
-    char *xml_l_dscrpt = NULL;
-    int offset = 0;
-    bool in_header = FALSE;
-    char description[DESC_MAX] = { 0, };
-
-    if (type[0] == '/') {
-        snprintf(ra_pathname, sizeof(ra_pathname), "%s", type);
-    } else {
-        snprintf(ra_pathname, sizeof(ra_pathname), "%s/%s",
-                 LSB_ROOT_DIR, type);
-    }
-
-    crm_trace("Looking into %s", ra_pathname);
-    fp = fopen(ra_pathname, "r");
-    if (fp == NULL) {
-        return -errno;
-    }
-
-    /* Enter into the LSB-compliant comment block */
-    while (fgets(buffer, sizeof(buffer), fp)) {
-
-        // Ignore lines up to and including the block delimiter
-        if (crm_starts_with(buffer, LSB_INITSCRIPT_INFOBEGIN_TAG)) {
-            in_header = TRUE;
-            continue;
-        }
-        if (!in_header) {
-            continue;
-        }
-
-        /* Assume each of the following eight arguments contain one line */
-        if (lsb_meta_helper_get_value(buffer, &provides, PROVIDES)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &req_start, REQ_START)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &req_stop, REQ_STOP)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &shld_start, SHLD_START)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &shld_stop, SHLD_STOP)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &dflt_start, DFLT_START)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &dflt_stop, DFLT_STOP)) {
-            continue;
-        }
-        if (lsb_meta_helper_get_value(buffer, &s_dscrpt, SHORT_DSCR)) {
-            continue;
-        }
-
-        /* Long description may cross multiple lines */
-        if ((offset == 0) // haven't already found long description
-            && crm_starts_with(buffer, DESCRIPTION)) {
-            bool processed_line = TRUE;
-
-            // Get remainder of description line itself
-            offset += snprintf(description, DESC_MAX, "%s",
-                               buffer + strlen(DESCRIPTION));
-
-            // Read any continuation lines of the description
-            buffer[0] = '\0';
-            while (fgets(buffer, sizeof(buffer), fp)) {
-                if (crm_starts_with(buffer, "#  ")
-                    || crm_starts_with(buffer, "#\t")) {
-                    /* '#' followed by a tab or more than one space indicates a
-                     * continuation of the long description.
-                     */
-                    offset += snprintf(description + offset, DESC_MAX - offset,
-                                       "%s", buffer + 1);
-                } else {
-                    /* This line is not part of the long description,
-                     * so continue with normal processing.
-                     */
-                    processed_line = FALSE;
-                    break;
-                }
-            }
-
-            // Make long description safe to use in XML
-            xml_l_dscrpt = (char *)xmlEncodeEntitiesReentrant(NULL, BAD_CAST(description));
-
-            if (processed_line) {
-                // We grabbed the line into the long description
-                continue;
-            }
-        }
-
-        // Stop if we leave the header block
-        if (crm_starts_with(buffer, LSB_INITSCRIPT_INFOEND_TAG)) {
-            break;
-        }
-        if (buffer[0] != '#') {
-            break;
-        }
-    }
-    fclose(fp);
-
-    *output = crm_strdup_printf(lsb_metadata_template, type,
-                                (xml_l_dscrpt? xml_l_dscrpt : type),
-                                (s_dscrpt? s_dscrpt : type),
-                                (provides? provides : ""),
-                                (req_start? req_start : ""),
-                                (req_stop? req_stop : ""),
-                                (shld_start? shld_start : ""),
-                                (shld_stop? shld_stop : ""),
-                                (dflt_start? dflt_start : ""),
-                                (dflt_stop? dflt_stop : ""));
-
-    lsb_meta_helper_free_value(xml_l_dscrpt);
-    lsb_meta_helper_free_value(s_dscrpt);
-    lsb_meta_helper_free_value(provides);
-    lsb_meta_helper_free_value(req_start);
-    lsb_meta_helper_free_value(req_stop);
-    lsb_meta_helper_free_value(shld_start);
-    lsb_meta_helper_free_value(shld_stop);
-    lsb_meta_helper_free_value(dflt_start);
-    lsb_meta_helper_free_value(dflt_stop);
-
-    crm_trace("Created fake metadata: %llu",
-              (unsigned long long) strlen(*output));
-    return pcmk_ok;
-}
-
 #if SUPPORT_NAGIOS
 static int
 nagios_get_metadata(const char *type, char **output)
@@ -1155,7 +924,7 @@ action_get_metadata(svc_action_t *op)
     }
 
     if (safe_str_eq(class, PCMK_RESOURCE_CLASS_LSB)) {
-        return (lsb_get_metadata(op->agent, &op->stdout_data) >= 0);
+        return (services__get_lsb_metadata(op->agent, &op->stdout_data) >= 0);
     }
 
 #if SUPPORT_NAGIOS
@@ -1209,12 +978,6 @@ get_directory_list(const char *root, gbo
 }
 
 GList *
-services_list(void)
-{
-    return resources_list_agents(PCMK_RESOURCE_CLASS_LSB, NULL);
-}
-
-GList *
 resources_list_standards(void)
 {
     GList *standards = NULL;
@@ -1272,7 +1035,7 @@ resources_list_agents(const char *standa
 
         GList *tmp1;
         GList *tmp2;
-        GList *result = resources_os_list_lsb_agents();
+        GList *result = services__list_lsb_agents();
 
         if (standard == NULL) {
             tmp1 = result;
@@ -1302,7 +1065,7 @@ resources_list_agents(const char *standa
     } else if (strcasecmp(standard, PCMK_RESOURCE_CLASS_OCF) == 0) {
         return resources_os_list_ocf_agents(provider);
     } else if (strcasecmp(standard, PCMK_RESOURCE_CLASS_LSB) == 0) {
-        return resources_os_list_lsb_agents();
+        return services__list_lsb_agents();
 #if SUPPORT_SYSTEMD
     } else if (strcasecmp(standard, PCMK_RESOURCE_CLASS_SYSTEMD) == 0) {
         return systemd_unit_listall();
Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_linux.c
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/services/services_linux.c
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_linux.c
@@ -872,12 +872,6 @@ services_os_get_directory_list(const cha
 }
 
 GList *
-resources_os_list_lsb_agents(void)
-{
-    return get_directory_list(LSB_ROOT_DIR, TRUE, TRUE);
-}
-
-GList *
 resources_os_list_ocf_providers(void)
 {
     return get_directory_list(OCF_ROOT_DIR "/resource.d", FALSE, TRUE);
Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_lsb.c
===================================================================
--- /dev/null
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_lsb.c
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2010-2018 Andrew Beekhof <andrew@beekhof.net>
+ *
+ * This source code is licensed under the GNU Lesser General Public License
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
+ */
+
+#include <crm_internal.h>
+
+#ifndef _GNU_SOURCE
+#  define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+
+#include <crm/crm.h>
+#include <crm/services.h>
+#include "services_private.h"
+#include "services_lsb.h"
+
+#define lsb_metadata_template  \
+    "<?xml version='1.0'?>\n"                                           \
+    "<!DOCTYPE resource-agent SYSTEM 'ra-api-1.dtd'>\n"                 \
+    "<resource-agent name='%s' version='" PCMK_DEFAULT_AGENT_VERSION "'>\n" \
+    "  <version>1.0</version>\n"                                        \
+    "  <longdesc lang='en'>\n"                                          \
+    "%s"                                                                \
+    "  </longdesc>\n"                                                   \
+    "  <shortdesc lang='en'>%s</shortdesc>\n"                           \
+    "  <parameters>\n"                                                  \
+    "  </parameters>\n"                                                 \
+    "  <actions>\n"                                                     \
+    "    <action name='meta-data'    timeout='5' />\n"                  \
+    "    <action name='start'        timeout='15' />\n"                 \
+    "    <action name='stop'         timeout='15' />\n"                 \
+    "    <action name='status'       timeout='15' />\n"                 \
+    "    <action name='restart'      timeout='15' />\n"                 \
+    "    <action name='force-reload' timeout='15' />\n"                 \
+    "    <action name='monitor'      timeout='15' interval='15' />\n"   \
+    "  </actions>\n"                                                    \
+    "  <special tag='LSB'>\n"                                           \
+    "    <Provides>%s</Provides>\n"                                     \
+    "    <Required-Start>%s</Required-Start>\n"                         \
+    "    <Required-Stop>%s</Required-Stop>\n"                           \
+    "    <Should-Start>%s</Should-Start>\n"                             \
+    "    <Should-Stop>%s</Should-Stop>\n"                               \
+    "    <Default-Start>%s</Default-Start>\n"                           \
+    "    <Default-Stop>%s</Default-Stop>\n"                             \
+    "  </special>\n"                                                    \
+    "</resource-agent>\n"
+
+/* See "Comment Conventions for Init Scripts" in the LSB core specification at:
+ * http://refspecs.linuxfoundation.org/lsb.shtml
+ */
+#define LSB_INITSCRIPT_INFOBEGIN_TAG "### BEGIN INIT INFO"
+#define LSB_INITSCRIPT_INFOEND_TAG "### END INIT INFO"
+#define PROVIDES    "# Provides:"
+#define REQ_START   "# Required-Start:"
+#define REQ_STOP    "# Required-Stop:"
+#define SHLD_START  "# Should-Start:"
+#define SHLD_STOP   "# Should-Stop:"
+#define DFLT_START  "# Default-Start:"
+#define DFLT_STOP   "# Default-Stop:"
+#define SHORT_DSCR  "# Short-Description:"
+#define DESCRIPTION "# Description:"
+
+#define lsb_meta_helper_free_value(m)           \
+    do {                                        \
+        if ((m) != NULL) {                      \
+            xmlFree(m);                         \
+            (m) = NULL;                         \
+        }                                       \
+    } while(0)
+
+/*!
+ * \internal
+ * \brief Grab an LSB header value
+ *
+ * \param[in]     line    Line read from LSB init script
+ * \param[in,out] value   If not set, will be set to XML-safe copy of value
+ * \param[in]     prefix  Set value if line starts with this pattern
+ *
+ * \return TRUE if value was set, FALSE otherwise
+ */
+static inline gboolean
+lsb_meta_helper_get_value(const char *line, char **value, const char *prefix)
+{
+    if (!*value && crm_starts_with(line, prefix)) {
+        *value = (char *)xmlEncodeEntitiesReentrant(NULL, BAD_CAST line+strlen(prefix));
+        return TRUE;
+    }
+    return FALSE;
+}
+
+#define DESC_MAX 2048
+
+int
+services__get_lsb_metadata(const char *type, char **output)
+{
+    char ra_pathname[PATH_MAX] = { 0, };
+    FILE *fp = NULL;
+    char buffer[1024] = { 0, };
+    char *provides = NULL;
+    char *req_start = NULL;
+    char *req_stop = NULL;
+    char *shld_start = NULL;
+    char *shld_stop = NULL;
+    char *dflt_start = NULL;
+    char *dflt_stop = NULL;
+    char *s_dscrpt = NULL;
+    char *xml_l_dscrpt = NULL;
+    int offset = 0;
+    bool in_header = FALSE;
+    char description[DESC_MAX] = { 0, };
+
+    if (type[0] == '/') {
+        snprintf(ra_pathname, sizeof(ra_pathname), "%s", type);
+    } else {
+        snprintf(ra_pathname, sizeof(ra_pathname), "%s/%s",
+                 LSB_ROOT_DIR, type);
+    }
+
+    crm_trace("Looking into %s", ra_pathname);
+    fp = fopen(ra_pathname, "r");
+    if (fp == NULL) {
+        return -errno;
+    }
+
+    /* Enter into the LSB-compliant comment block */
+    while (fgets(buffer, sizeof(buffer), fp)) {
+
+        // Ignore lines up to and including the block delimiter
+        if (crm_starts_with(buffer, LSB_INITSCRIPT_INFOBEGIN_TAG)) {
+            in_header = TRUE;
+            continue;
+        }
+        if (!in_header) {
+            continue;
+        }
+
+        /* Assume each of the following eight arguments contain one line */
+        if (lsb_meta_helper_get_value(buffer, &provides, PROVIDES)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &req_start, REQ_START)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &req_stop, REQ_STOP)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &shld_start, SHLD_START)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &shld_stop, SHLD_STOP)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &dflt_start, DFLT_START)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &dflt_stop, DFLT_STOP)) {
+            continue;
+        }
+        if (lsb_meta_helper_get_value(buffer, &s_dscrpt, SHORT_DSCR)) {
+            continue;
+        }
+
+        /* Long description may cross multiple lines */
+        if ((offset == 0) // haven't already found long description
+            && crm_starts_with(buffer, DESCRIPTION)) {
+            bool processed_line = TRUE;
+
+            // Get remainder of description line itself
+            offset += snprintf(description, DESC_MAX, "%s",
+                               buffer + strlen(DESCRIPTION));
+
+            // Read any continuation lines of the description
+            buffer[0] = '\0';
+            while (fgets(buffer, sizeof(buffer), fp)) {
+                if (crm_starts_with(buffer, "#  ")
+                    || crm_starts_with(buffer, "#\t")) {
+                    /* '#' followed by a tab or more than one space indicates a
+                     * continuation of the long description.
+                     */
+                    offset += snprintf(description + offset, DESC_MAX - offset,
+                                       "%s", buffer + 1);
+                } else {
+                    /* This line is not part of the long description,
+                     * so continue with normal processing.
+                     */
+                    processed_line = FALSE;
+                    break;
+                }
+            }
+
+            // Make long description safe to use in XML
+            xml_l_dscrpt = (char *)xmlEncodeEntitiesReentrant(NULL, BAD_CAST(description));
+
+            if (processed_line) {
+                // We grabbed the line into the long description
+                continue;
+            }
+        }
+
+        // Stop if we leave the header block
+        if (crm_starts_with(buffer, LSB_INITSCRIPT_INFOEND_TAG)) {
+            break;
+        }
+        if (buffer[0] != '#') {
+            break;
+        }
+    }
+    fclose(fp);
+
+    *output = crm_strdup_printf(lsb_metadata_template, type,
+                                (xml_l_dscrpt? xml_l_dscrpt : type),
+                                (s_dscrpt? s_dscrpt : type),
+                                (provides? provides : ""),
+                                (req_start? req_start : ""),
+                                (req_stop? req_stop : ""),
+                                (shld_start? shld_start : ""),
+                                (shld_stop? shld_stop : ""),
+                                (dflt_start? dflt_start : ""),
+                                (dflt_stop? dflt_stop : ""));
+
+    lsb_meta_helper_free_value(xml_l_dscrpt);
+    lsb_meta_helper_free_value(s_dscrpt);
+    lsb_meta_helper_free_value(provides);
+    lsb_meta_helper_free_value(req_start);
+    lsb_meta_helper_free_value(req_stop);
+    lsb_meta_helper_free_value(shld_start);
+    lsb_meta_helper_free_value(shld_stop);
+    lsb_meta_helper_free_value(dflt_start);
+    lsb_meta_helper_free_value(dflt_stop);
+
+    crm_trace("Created fake metadata: %llu",
+              (unsigned long long) strlen(*output));
+    return pcmk_ok;
+}
+
+GList *
+services__list_lsb_agents(void)
+{
+    return services_os_get_directory_list(LSB_ROOT_DIR, TRUE, TRUE);
+}
+
+/* The remaining functions below are not used by the Pacemaker code base, and
+ * are provided for API compatibility only.
+ *
+ * @TODO They should be removed or renamed.
+ */
+
+svc_action_t *
+services_action_create(const char *name, const char *action,
+                       guint interval_ms, int timeout)
+{
+    return resources_action_create(name, PCMK_RESOURCE_CLASS_LSB, NULL, name,
+                                   action, interval_ms, timeout, NULL, 0);
+}
+
+GList *
+services_list(void)
+{
+    return resources_list_agents(PCMK_RESOURCE_CLASS_LSB, NULL);
+}
+
Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_lsb.h
===================================================================
--- /dev/null
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_lsb.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2010-2018 Andrew Beekhof <andrew@beekhof.net>
+ *
+ * This source code is licensed under the GNU Lesser General Public License
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
+ */
+
+#ifndef SERVICES_LSB__H
+#  define SERVICES_LSB__H
+
+G_GNUC_INTERNAL int services__get_lsb_metadata(const char *type, char **output);
+G_GNUC_INTERNAL GList *services__list_lsb_agents(void);
+
+#endif
Index: pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_private.h
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/services/services_private.h
+++ pacemaker-1.1.18+20180430.b12c320f5/lib/services/services_private.h
@@ -1,19 +1,8 @@
 /*
- * Copyright (C) 2010 - 2011, Red Hat, Inc.
+ * Copyright 2010-2018 Red Hat, Inc.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This source code is licensed under the GNU Lesser General Public License
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
  */
 
 #ifndef SERVICES_PRIVATE__H
@@ -55,9 +44,6 @@ G_GNUC_INTERNAL
 gboolean services_os_action_execute(svc_action_t * op);
 
 G_GNUC_INTERNAL
-GList *resources_os_list_lsb_agents(void);
-
-G_GNUC_INTERNAL
 GList *resources_os_list_ocf_providers(void);
 
 G_GNUC_INTERNAL
openSUSE Build Service is sponsored by