Commit 23e0448c authored by Maiken's avatar Maiken

Merge branch 'fix-systemd-units-hardcode' into 'next'

Fix systemd units hardcode

See merge request nordugrid/arc!769
parents cebf89c5 4de99f58
Pipeline #5462 passed with stage
in 32 minutes and 50 seconds
......@@ -2350,6 +2350,8 @@ AC_CONFIG_FILES([Makefile
src/services/ldap-infosys/create-bdii-config
src/services/ldap-infosys/create-slapd-config
src/services/ldap-infosys/arc-infosys-ldap
src/services/ldap-infosys/arc-infosys-ldap.service
src/services/ldap-infosys/arc-infosys-ldap-slapd.service
src/services/monitor/Makefile
src/services/monitor/monitor
src/services/monitor/README
......
......@@ -27,6 +27,17 @@ add_library_path() {
prog=arched
RUN=yes
send_systemd_notify() {
# return if no systemd-notify found
type systemd-notify >/dev/null 2>&1 || return
systemd-notify "$@"
}
log_failure_msg() {
send_systemd_notify --status "Error: $@"
echo $@
}
# sysconfig files
if [ -r /etc/sysconfig/nordugrid ]; then
. /etc/sysconfig/nordugrid
......@@ -43,7 +54,7 @@ fi
GLOBUS_LOCATION=${GLOBUS_LOCATION:-@DEFAULT_GLOBUS_LOCATION@}
if [ -n "$GLOBUS_LOCATION" ]; then
if [ ! -d "$GLOBUS_LOCATION" ]; then
echo "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
log_failure_msg "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
exit 1
fi
export GLOBUS_LOCATION
......@@ -52,7 +63,7 @@ fi
# ARC_LOCATION
ARC_LOCATION=${ARC_LOCATION:-@prefix@}
if [ ! -d "$ARC_LOCATION" ]; then
echo "ARC_LOCATION ($ARC_LOCATION) not found"
log_failure_msg "ARC_LOCATION ($ARC_LOCATION) not found"
exit 1
fi
export ARC_LOCATION
......@@ -129,7 +140,7 @@ fi
PID_FILE=`readorigconfigvar "$ARC_CONFIG" pidfile arex`
if [ "x$PID_FILE" = "x" ]; then
# Missing default value for pidfile means no service block is present
echo "ARC configuration is missing [arex] block"
log_failure_msg "ARC configuration is missing [arex] block"
exit 1
fi
ARC_RUNTIME_CONFIG=
......@@ -142,19 +153,19 @@ prepare() {
CMD="$ARC_LOCATION/sbin/$prog"
if [ ! -x "$CMD" ]; then
echo "Missing executable"
log_failure_msg "Missing $CMD executable"
exit 1
fi
if [ ! -r "$ARC_CONFIG" ]; then
echo "ARC configuration not found (usually /etc/arc.conf)"
log_failure_msg "ARC configuration not found (usually /etc/arc.conf)"
exit 1
fi
# Pre-process configuration
$ARC_LOCATION/@pkglibexecsubdir@/arcconfig-parser --config "$ARC_CONFIG" --runconfig "$ARC_RUNTIME_CONFIG" --save 2>/dev/null
if [ ! "$?" = '0' ] ; then
echo "ARC configuration processing failed"
log_failure_msg "ARC configuration processing failed"
exit 1
fi
......@@ -232,7 +243,7 @@ prepare() {
arex_port="80"
fi
else
echo "Unsupported protocol '$arex_proto' for WS interface"
log_failure_msg "Unsupported protocol '$arex_proto' for WS interface URL"
exit 1
fi
arex_endpoint="<arex:endpoint>$arex_mount_point</arex:endpoint>"
......@@ -244,11 +255,11 @@ prepare() {
fi
if [ "$arex_present" = 'true' ] ; then
if [ "$ws_present" != 'true' ] ; then
echo "WS interface must be turned on to use A-REX/EMIES WS service"
log_failure_msg "WS interface must be turned on to use A-REX/EMIES WS service"
exit 1
else
if [ "$mapping_present" != 'true' ] ; then
echo "For A-REX/EMIES WS interface to work mapping must be enabled"
log_failure_msg "For A-REX/EMIES WS interface to work mapping must be enabled"
exit 1
fi
fi
......@@ -262,8 +273,7 @@ prepare() {
if [ ! -z "$arguspep_endpoint" ]; then
argus_plugin="${argus_plugin}<Plugins><Name>arguspepclient</Name></Plugins>"
if [ ! -f "$ARC_LOCATION/lib/arc/libarguspepclient.so" ] && [ ! -f "$ARC_LOCATION/lib64/arc/libarguspepclient.so" ]; then
echo "Plugin arguspepclient(libarguspepclient.so) not found"
echo "You may need to install corresponding package"
log_failure_msg "Plugin arguspepclient(libarguspepclient.so) not found. You may need to install corresponding package"
exit 1
fi
arguspep_profile=`readconfigvar "$ARC_RUNTIME_CONFIG" arguspep_profile arex/ws/argus`
......@@ -274,7 +284,7 @@ prepare() {
if [ "$arguspep_usermap" = "no" ]; then arguspep_usermap="false"; fi
if [ "$mapping_present" != 'true' ]; then
if [ "$arguspep_usermap" = 'true' ]; then
echo "Can't map user identity through Argus PEP because mapping is disabled for the service."
log_failure_msg "Can't map user identity through Argus PEP because mapping is disabled for the service."
exit 1
fi
fi
......@@ -294,8 +304,7 @@ prepare() {
if [ ! -z "$arguspdp_endpoint" ]; then
argus_plugin="${argus_plugin}<Plugins><Name>arguspdpclient</Name></Plugins>"
if [ ! -f "$ARC_LOCATION/lib/arc/libarguspdpclient.so" ] && [ ! -f "$ARC_LOCATION/lib64/arc/libarguspdpclient.so" ]; then
echo "Plugin arguspdpclient(libarguspdpclient.so) not found"
echo "You may need to install corresponding package"
log_failure_msg "Plugin arguspdpclient(libarguspdpclient.so) not found. You may need to install corresponding package"
exit 1
fi
arguspdp_profile=`readconfigvar "$ARC_RUNTIME_CONFIG" arguspdp_profile arex/ws/argus`
......@@ -306,7 +315,7 @@ prepare() {
if [ "$arguspdp_usermap" = "no" ]; then arguspdp_usermap="false"; fi
if [ "$mapping_present" != 'true' ]; then
if [ "$arguspdp_usermap" = 'true' ]; then
echo "Can't map user identity through Argus PDP because mapping is disabled for the service."
log_failure_msg "Can't map user identity through Argus PDP because mapping is disabled for the service."
exit 1
fi
fi
......@@ -333,7 +342,7 @@ prepare() {
use_candypond=`testconfigblock "$ARC_RUNTIME_CONFIG" arex/ws/candypond`
if [ "$use_candypond" = "true" ]; then
if [ "$ws_present" != 'true' ] ; then
echo "WS interface must be turned on to use candypond"
log_failure_msg "WS interface must be turned on to use candypond"
exit 1
fi
candypond_plexer="<next id=\"candypond\">^$arex_path/candypond</next>"
......@@ -376,7 +385,7 @@ prepare() {
AREX_CONFIG=`mktemp -t arex.xml.XXXXXX`
if [ -z "$AREX_CONFIG" ] ; then
echo "Failed to create temporary file"
log_failure_msg "Failed to create temporary file"
exit 1
fi
......@@ -614,7 +623,7 @@ prepare() {
validate() {
CHECK_CMD=$ARC_LOCATION/@pkglibexecsubdir@/arc-config-check
if [ ! -x $CHECK_CMD ]; then
echo "Could not find or execute arc-config-check tool"
log_failure_msg "Could not find or execute arc-config-check tool"
return 1
fi
eval "$CHECK_CMD --config $ARC_CONFIG $@"
......@@ -634,10 +643,10 @@ echo "Validating A-REX setup..." >> "$LOGFILE"
validate >> "$LOGFILE" 2>&1
RETVAL=$?
if [ $RETVAL != 0 ]; then
# Run validator again to print errors to screen
# Run validator again to print errors to stdout
validate --skip-warnings
echo "Configuration validation failed"
log_failure_msg "Configuration validation failed"
exit 1
fi
exec $CMD
exec $CMD "$@"
[Unit]
Description=ARC grid manager
Description=ARC Remote EXecution service
After=local_fs.target remote_fs.target
[Service]
Type=forking
PIDFile=/var/run/arched-arex.pid
ExecStart=/usr/share/arc/arc-arex-start
ExecStart=@prefix@/@pkgdatasubdir@/arc-arex-start -f
NotifyAccess=all
[Install]
WantedBy=multi-user.target
......@@ -27,6 +27,17 @@ add_library_path() {
prog=arched
RUN=yes
send_systemd_notify() {
# return if no systemd-notify found
type systemd-notify >/dev/null 2>&1 || return
systemd-notify "$@"
}
log_failure_msg() {
send_systemd_notify --status "Error: $@"
echo $@
}
# sysconfig files
if [ -r /etc/sysconfig/nordugrid ]; then
. /etc/sysconfig/nordugrid
......@@ -42,7 +53,7 @@ fi
# GLOBUS_LOCATION
GLOBUS_LOCATION=${GLOBUS_LOCATION:-@DEFAULT_GLOBUS_LOCATION@}
if [ ! -d "$GLOBUS_LOCATION" ]; then
echo "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
log_failure_msg "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
exit 1
fi
export GLOBUS_LOCATION
......@@ -50,7 +61,7 @@ export GLOBUS_LOCATION
# ARC_LOCATION
ARC_LOCATION=${ARC_LOCATION:-@prefix@}
if [ ! -d "$ARC_LOCATION" ]; then
echo "ARC_LOCATION ($ARC_LOCATION) not found"
log_failure_msg "ARC_LOCATION ($ARC_LOCATION) not found"
exit 1
fi
export ARC_LOCATION
......@@ -94,12 +105,12 @@ prepare() {
CMD="$ARC_LOCATION/sbin/$prog"
if [ ! -x "$CMD" ]; then
echo "Missing executable"
log_failure_msg "Missing $CMD executable"
exit 1
fi
if [ ! -r "$ARC_CONFIG" ]; then
echo "ARC configuration not found (usually /etc/arc.conf)"
log_failure_msg "ARC configuration not found (usually /etc/arc.conf)"
exit 1
fi
......@@ -108,7 +119,7 @@ prepare() {
ALLOWEDDN=`readorigconfigvar "$ARC_CONFIG" datadelivery-service allowed_dn`
if [ "$SECURE" = "no" ]; then
if [ "x$ALLOWEDDN" != "x" ]; then
echo "allowed_dn cannot be used with secure=no"
log_failure_msg "allowed_dn cannot be used with secure=no"
exit 1
fi
fi
......@@ -135,4 +146,4 @@ fi
prepare
exec $CMD
exec $CMD "$@"
......@@ -3,9 +3,8 @@ Description=A-REX datadelivery service
After=local_fs.target remote_fs.target
[Service]
Type=forking
PIDFile=/var/run/arched-datadelivery-service.pid
ExecStart=/usr/share/arc/arc-datadelivery-service-start
ExecStart=@prefix@/@pkgdatasubdir@/arc-datadelivery-service-start -f
NotifyAccess=all
[Install]
WantedBy=multi-user.target
......@@ -27,6 +27,17 @@ add_library_path() {
prog=gridftpd
RUN=yes
send_systemd_notify() {
# return if no systemd-notify found
type systemd-notify >/dev/null 2>&1 || return
systemd-notify "$@"
}
log_failure_msg() {
send_systemd_notify --status "Error: $@"
echo $@
}
# sysconfig files
if [ -r /etc/sysconfig/nordugrid ]; then
. /etc/sysconfig/nordugrid
......@@ -48,7 +59,7 @@ fi
# GLOBUS_LOCATION
GLOBUS_LOCATION=${GLOBUS_LOCATION:-@DEFAULT_GLOBUS_LOCATION@}
if [ ! -d "$GLOBUS_LOCATION" ]; then
echo "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
log_failure_msg "GLOBUS_LOCATION ($GLOBUS_LOCATION) not found"
exit 1
fi
export GLOBUS_LOCATION
......@@ -56,7 +67,7 @@ export GLOBUS_LOCATION
# ARC_LOCATION
ARC_LOCATION=${ARC_LOCATION:-@prefix@}
if [ ! -d "$ARC_LOCATION" ]; then
echo "ARC_LOCATION ($ARC_LOCATION) not found"
log_failure_msg "ARC_LOCATION ($ARC_LOCATION) not found"
exit 1
fi
export ARC_LOCATION
......@@ -92,17 +103,17 @@ check_cert() {
X509_USER_CERT=`readconfigvar "$ARC_RUNTIME_CONFIG" x509_host_cert gridftpd common`
X509_USER_KEY=`readconfigvar "$ARC_RUNTIME_CONFIG" x509_host_key gridftpd common`
if [ ! -f "$X509_USER_CERT" ] ; then
echo "Host certificate not found"
log_failure_msg "Host certificate $X509_USER_CERT is not found"
exit 1
fi
if [ ! -f "$X509_USER_KEY" ] ; then
echo "Host key not found"
log_failure_msg "Host key $X509_USER_KEY is not found"
exit 1
fi
# check permissions on key
perms=`stat -L -c %a "$X509_USER_KEY"`
if [ "$perms" != "600" ] && [ "$perms" != "400" ] ; then
echo "Host key must be readable only by user"
log_failure_msg "Host key must be readable only by user"
exit 1
fi
}
......@@ -117,7 +128,7 @@ if [ "x$ARC_CONFIG" = "x" ]; then
fi
if [ ! -r "$ARC_CONFIG" ]; then
echo "ARC configuration not found (usually /etc/arc.conf)"
log_failure_msg "ARC configuration not found (usually /etc/arc.conf)"
exit 1
fi
......@@ -145,7 +156,7 @@ export PYTHONPATH
PID_FILE=`readorigconfigvar "$ARC_CONFIG" pidfile gridftpd`
if [ "x$PID_FILE" = "x" ]; then
# Missing default value for pidfile means no service block is present
echo "ARC configuration is missing [gridftpd] block"
log_failure_msg "ARC configuration is missing [gridftpd] block"
exit 1
fi
ARC_RUNTIME_CONFIG=
......@@ -155,14 +166,14 @@ ARC_RUNTIME_CONFIG="${ARC_RUNTIME_CONFIG}.cfg"
CMD="$ARC_LOCATION/sbin/$prog"
if [ ! -x "$CMD" ]; then
echo "Missing executable"
log_failure_msg "Missing $CMD executable"
exit 1
fi
# Pre-process configuration
$ARC_LOCATION/@pkglibexecsubdir@/arcconfig-parser --config "$ARC_CONFIG" --runconfig "$ARC_RUNTIME_CONFIG" --save 2>/dev/null
if [ ! "$?" = '0' ] ; then
echo "ARC configuration processing failed"
log_failure_msg "ARC configuration processing failed"
exit 1
fi
......@@ -176,4 +187,4 @@ fi
check_cert
exec $CMD
exec $CMD "$@"
......@@ -4,9 +4,9 @@ Documentation=man:gridftpd(8)
After=local_fs.target remote_fs.target
[Service]
Type=forking
PIDFile=/var/run/gridftpd.pid
ExecStart=/usr/share/arc/arc-gridftpd-start
ExecStart=@prefix@/@pkgdatasubdir@/arc-gridftpd-start -F
SuccessExitStatus=255
NotifyAccess=all
[Install]
WantedBy=multi-user.target
......@@ -5,9 +5,9 @@ PartOf=arc-infosys-ldap.service
[Service]
Type=forking
PIDFile=/var/run/arc/bdii/db/slapd.pid
ExecStartPre=/usr/share/arc/create-slapd-config
ExecStartPre=@prefix@/@pkgdatasubdir@/create-slapd-config
ExecStart=/bin/sh /var/run/arc/infosys/bdii-slapd.cmd
NotifyAccess=all
[Install]
WantedBy=multi-user.target
......@@ -132,20 +132,6 @@ if [ -z "$bdii_user" ]; then
fi
fi
# Use this command to change user
if [ -x /sbin/runuser ]; then
RUNUSER=runuser
else
RUNUSER=su
fi
# If missing, we have a problem
USERSHELL=${USERSHELL:-"/bin/sh"}
if [ ! -x ${USERSHELL} ]; then
log_failure_msg "Could not find ${USERSHELL}"
exit 1
fi
bdii_location=${CONFIG_bdii_location:-/usr}
bdii_update_cmd=${CONFIG_bdii_update_cmd:-${bdii_location}/sbin/bdii-update}
if [ ! -x $bdii_update_cmd ]; then
......@@ -200,7 +186,8 @@ start () {
exit 1
fi
/bin/sh ${infosys_ldap_run_dir}/bdii-slapd.cmd
# path to generated helper scripts is hardcoded (in both systemd unit and sysV scripts)
/bin/sh /var/run/arc/infosys/bdii-slapd.cmd
touch ${slapd_lock_file}
iterlimit=30
......@@ -216,11 +203,7 @@ start () {
return ${RETVAL}
fi
if [ `id -u` = 0 ]; then
$RUNUSER -s "$USERSHELL" -c "${bdii_update_cmd} -c ${BDII_CONF} -d" ${bdii_user}
else
${bdii_update_cmd} -c ${BDII_CONF} -d
fi
/bin/sh /var/run/arc/infosys/bdii-update.cmd
touch ${update_lock_file}
iterlimit=30
......
......@@ -6,11 +6,9 @@ BindsTo=arc-infosys-ldap-slapd.service
[Service]
Type=forking
PIDFile=/var/run/arc/bdii/bdii-update.pid
User=ldap
PermissionsStartOnly=true
ExecStartPre=/usr/share/arc/create-bdii-config
ExecStart=/usr/sbin/bdii-update -c /var/run/arc/infosys/bdii.conf -d
ExecStartPre=@prefix@/@pkgdatasubdir@/create-bdii-config
ExecStart=/bin/sh /var/run/arc/infosys/bdii-update.cmd
NotifyAccess=all
[Install]
WantedBy=multi-user.target
#!/bin/bash
# Define logging functions
send_systemd_notify() {
# return if no systemd-notify found
type systemd-notify >/dev/null 2>&1 || return
systemd-notify "$@"
}
log_failure_msg() {
send_systemd_notify --status "Error: $@"
echo $@
}
# Create bdii config for the NorduGrid/ARC information system
ARC_LOCATION=${ARC_LOCATION:-@prefix@}
if [ ! -d "$ARC_LOCATION" ]; then
echo "ARC_LOCATION ($ARC_LOCATION) not found"
log_failure_msg "ARC_LOCATION ($ARC_LOCATION) not found"
exit 1
fi
......@@ -39,13 +51,13 @@ ${arcconfig_parser} -c ${ARC_CONFIG} --save -r ${ARC_RUNCONFIG}
# Check for infosys block
if ! ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys; then
echo "Missing [infosys] configuration block"
log_failure_msg "Missing [infosys] configuration block"
exit 1
fi
# Check for infosys/ldap block
if ! ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/ldap; then
echo "Missing [infosys/ldap] configuration block"
log_failure_msg "Missing [infosys/ldap] configuration block"
exit 1
fi
......@@ -68,7 +80,7 @@ providerlog=${CONFIG_logfile:-/var/log/arc/infoprovider.log}
bdii_location=${CONFIG_bdii_location:-/usr}
bdii_update_cmd=${CONFIG_bdii_update_cmd:-${bdii_location}/sbin/bdii-update}
if [ ! -x $bdii_update_cmd ]; then
echo "Can not find bdii-update command at: $bdii_update_cmd."
log_failure_msg "Can not find bdii-update command at: $bdii_update_cmd."
echo "Please set bdii_update_cmd in arc.conf"
exit 1
fi
......@@ -77,6 +89,11 @@ infosys_ldap_run_dir=${CONFIG_infosys_ldap_run_dir:-/var/run/arc/infosys}
mkdir -p ${infosys_ldap_run_dir}
chown ${bdii_user}: ${infosys_ldap_run_dir}
# Put BDII update start helper into hardcoded path
mkdir -p /var/run/arc/infosys
bdii_update_helper_cmd=/var/run/arc/infosys/bdii-update.cmd
rm -f $bdii_update_helper_cmd
bdii_debug_level=${CONFIG_bdii_debug_level:-WARNING}
bdii_tmp_dir=${CONFIG_bdii_tmp_dir:-/var/tmp/arc/bdii}
......@@ -139,7 +156,7 @@ if ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/nordugrid || \
${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/glue1 || \
${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/glue2/ldap; then
if [ ! -f "$ARC_LOCATION/@pkgdatasubdir@/InfosysHelper.pm" ]; then
echo "InfosysHelper.pm not found. Is A-REX installed?"
log_failure_msg "InfosysHelper.pm not found. Is A-REX installed?"
echo "For operation without A-REX, disable publishing of cluster information"
echo "([infosys/nordugrid], [infosys/glue1] and [infosys/glue2/ldap])"
exit 1
......@@ -175,50 +192,50 @@ if ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/glue1; then
fi
if [ "x$resource_location" = "x" ]; then
echo "If [infosys/glue1] is enabled, then resource_location must be set."
log_failure_msg "If [infosys/glue1] is enabled, then resource_location must be set."
echo "It should be set to a free-form string describing the location,"
echo "for example: 'Kastrup, Denmark'"
exit 1
fi
if [[ "x$resource_location" =~ "/" ]]; then
echo "WARNING: wrong location format. Please do NOT use slashes / ."
log_failure_msg "Wrong location format. Please do NOT use slashes / ."
echo "It should be set to a free-form string describing the location,"
echo "for example: 'Kastrup, Denmark'"
exit 1
fi
if [ "x$resource_latitude" = "x" ]; then
echo "If [infosys/glue1] is enabled, then resource_latitude must be set."
log_failure_msg "If [infosys/glue1] is enabled, then resource_latitude must be set."
echo "It should be set to the latitude for the location,"
echo "for example: '55.75000'"
exit 1
fi
if [ "x$resource_longitude" = "x" ]; then
echo "If [infosys/glue1] is enabled, then resource_longitude must be set."
log_failure_msg "If [infosys/glue1] is enabled, then resource_longitude must be set."
echo "It should be set to the longitude for the location,"
echo "for example: '12.41670'"
exit 1
fi
if [ "x$cpuscalingreferencesi00" = "x" ]; then
echo "If [infosys/glue1] is enabled, then cpu_scaling_reference_si00 must be set."
log_failure_msg "If [infosys/glue1] is enabled, then cpu_scaling_reference_si00 must be set."
echo "It should be set to the SI00 value,"
echo "for example: '2400'"
exit 1
fi
if [ "x$processorotherdescription" = "x" ]; then
echo "If [infosys/glue1] is enabled, then processor_other_description must be set."
log_failure_msg "If [infosys/glue1] is enabled, then processor_other_description must be set."
echo "It should be set to a value like in the example,where cores is the average number"
echo "of cores in the machine"
echo "for example: 'Cores=3,Benchmark=9.8-HEP-SPEC06'"
exit 1
fi
if [ "x$gluesiteweb" = "x" ]; then
echo "If [infosys/glue1] is enabled, then glue_site_web must be set."
log_failure_msg "If [infosys/glue1] is enabled, then glue_site_web must be set."
echo "It should be set to a url for the website belonging to the institution holding the resource,"
echo "for example: 'http://www.ndgf.org'"
exit 1
fi
if [ "x$gluesiteuniqueid" = "x" ]; then
echo "If [infosys/glue1] is enabled, then glue_site_unique_id must be set."
log_failure_msg "If [infosys/glue1] is enabled, then glue_site_unique_id must be set."
echo "It should be set to a unique id to the resource, this should be entered into the GocDb"
echo "for example: 'NDGF-T1'"
exit 1
......@@ -366,7 +383,7 @@ if [ "x$provide_glue_site_info" == "xtrue" ]; then
unique_id=${CONFIG_unique_id}
url=${CONFIG_url}
if [ -z "$unique_id" -o -z "$url" ]; then
echo "Mandaroty options 'unique_id' and 'url' should be configured for Site-BDII."
log_failure_msg "Mandaroty options 'unique_id' and 'url' should be configured for Site-BDII."
exit 1
fi
site_config="${bdii_tmp_dir}/${unique_id}.conf"
......@@ -380,3 +397,23 @@ if [ "x$provide_glue_site_info" == "xtrue" ]; then
EOF
chmod +x $site_provider
fi
# Helper script to start BDII Update switching to BDII user
if [ -x /sbin/runuser ]; then
RUNUSER=runuser
else
RUNUSER=su
fi
USERSHELL=${USERSHELL:-"/bin/sh"}
if [ ! -x ${USERSHELL} ]; then
log_failure_msg "Could not find ${USERSHELL}"
exit 1
fi
cat <<-EOF > ${bdii_update_helper_cmd}
if [ \$( id -u ) = 0 ]; then
exec $RUNUSER -s "$USERSHELL" -c "${bdii_update_cmd} -c ${BDII_CONF} -d" ${bdii_user}
else
exec ${bdii_update_cmd} -c ${BDII_CONF} -d
fi
EOF
#!/bin/bash
# Define logging functions
send_systemd_notify() {
# return if no systemd-notify found
type systemd-notify >/dev/null 2>&1 || return
systemd-notify "$@"
}
log_failure_msg() {
send_systemd_notify --status "Error: $@"
echo $@
}
# Create slapd config for the NorduGrid/ARC information system
ARC_LOCATION=${ARC_LOCATION:-@prefix@}
if [ ! -d "$ARC_LOCATION" ]; then
echo "ARC_LOCATION ($ARC_LOCATION) not found"
log_failure_msg "ARC_LOCATION ($ARC_LOCATION) not found"
exit 1
fi
......@@ -39,13 +51,13 @@ ${arcconfig_parser} -c ${ARC_CONFIG} --save -r ${ARC_RUNCONFIG}
# Check for infosys block
if ! ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys; then
echo "Missing [infosys] configuration block"
log_failure_msg "Missing [infosys] configuration block"
exit 1
fi
# Check for infosys/ldap block
if ! ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/ldap; then
echo "Missing [infosys/ldap] configuration block"
log_failure_msg "Missing [infosys/ldap] configuration block"
exit 1
fi
......@@ -86,7 +98,7 @@ bdii_database=${CONFIG_bdii_database:-"hdb"}
coreschema=$(find /etc/openldap /etc/ldap ${ldap_schema_dir} -name core.schema \
-printf "%h/%f\n" 2>/dev/null)
if [ "x" = "x$coreschema" ]; then
echo "Could not find ldap core schema file"
log_failure_msg "Could not find ldap core schema file"
exit 1
fi
......@@ -94,7 +106,7 @@ fi
glueschemadir=$(find /etc/openldap /etc/ldap ${ldap_schema_dir} -name Glue-CORE.schema \
-printf "%h\n" 2>/dev/null)
if [ "x" = "x$glueschemadir" ]; then
echo "Error, could not find glue schema directory under /etc"
log_failure_msg "Could not find glue schema directory under /etc"
exit 1
fi
......@@ -115,7 +127,7 @@ else
fi
if [ -z "$slapd_cmd" ] || [ ! -x "$slapd_cmd" ]; then
echo "Could not find ldap server binary, usually /usr/sbin/slapd"
log_failure_msg "Could not find ldap server binary, usually /usr/sbin/slapd"
exit 1
fi
......@@ -159,7 +171,7 @@ ldapdirs=
database=${bdii_database}
find_ldap_database_module
if [ -z "${database}" ]; then
echo "Could not find ldap ${bdii_database} database module"
log_failure_msg "Could not find ldap ${bdii_database} database module"
exit 1
fi
moduleload_bdii="${ldapmodule}"
......@@ -182,8 +194,8 @@ if ${arcconfig_parser} --load -r ${ARC_RUNCONFIG} -b infosys/index; then
database=shell
find_ldap_database_module
if [ -z "${database}" ]; then
echo "Could not find ldap shell database module"
exit 1
log_failure_msg "Could not find ldap shell database module"
exit 1
fi
moduleload_shell="${ldapmodule}"
else
......@@ -207,7 +219,10 @@ done