From 61a1f509d66643aefc3f8832dd813435a2f76b34 Mon Sep 17 00:00:00 2001 From: Maria Alandes Pradillo Date: Tue, 12 Feb 2008 09:31:37 +0000 Subject: [PATCH] Fix for patch #1682: new function config_info_service_px and modified config_gip_px. --- .../config/functions/config_gip_px | 67 +++------------- .../config/functions/config_info_service_px | 92 ++++++++++++++++++++++ 2 files changed, 103 insertions(+), 56 deletions(-) create mode 100644 org.glite.yaim.myproxy/config/functions/config_info_service_px diff --git a/org.glite.yaim.myproxy/config/functions/config_gip_px b/org.glite.yaim.myproxy/config/functions/config_gip_px index 94e81ae..e7f49e8 100755 --- a/org.glite.yaim.myproxy/config/functions/config_gip_px +++ b/org.glite.yaim.myproxy/config/functions/config_gip_px @@ -23,75 +23,30 @@ # # AUTHORS : Shu-Ting.Liao@cern.ch # -# NOTES : The config_gip_ functions are part of the glite 3.1 -# information system configuration +# NOTES : The config_gip_ function creates the ldif file. +# This is currently done by the function config_info_service_. +# This function is still included in the function list for cleaning tasks. +# # # YAIM MODULE: glite-yaim-myproxy # ############################################################################## config_gip_px_check () { - requires $1 GRID_TRUSTED_BROKERS SITE_EMAIL SITE_NAME INSTALL_ROOT + yaimlog DEBUG "This function currently doesn't set any environment variables." } config_gip_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." + yaimlog DEBUG "This function currently doesn't set any environment variables." } config_gip_px () { - ### Auxiliary parameters - STATIC_CREATE="${INSTALL_ROOT}/glite/sbin/glite-info-static-create" - TEMPLATE_DIR="${INSTALL_ROOT}/glite/etc" - CONF_DIR="$INSTALL_ROOT/glite/var/tmp/gip" - LDIF_DIR="${INSTALL_ROOT}/glite/etc/gip/ldif" - -until [ "$GIP_RESPONSE" -ge 0 ]; do - echo "ERROR: bad GIP_RESPONSE: $GIP_RESPONSE" - exit 1 -done - - -#### Define output file - -if ( echo "${NODE_TYPE_LIST}" | grep -w PX > /dev/null ); then - -outfile=${CONF_DIR}/glite-info-static-px.conf - - cat << EOF > $outfile - -dn: GlueServiceUniqueID=${PX_HOST}:7512 -GlueServiceName: ${SITE_NAME}-myproxy -GlueServiceType: MyProxy -GlueServiceVersion: 1.1.0 -GlueServiceEndpoint: ${PX_HOST}:7512 -GlueServiceURI: unset -GlueServiceAccessPointURL: myproxy://${PX_HOST} -GlueServiceStatus: OK -GlueServiceStatusInfo: No Problems -GlueServiceWSDL: unset -GlueServiceSemantics: unset -GlueServiceStartTime: 1970-01-01T00:00:00Z -GlueServiceOwner: LCG -GlueForeignKey: GlueSiteUniqueID=${SITE_NAME} -EOF - - split_quoted_variable $GRID_TRUSTED_BROKERS | while read x; do - echo "GlueServiceAccessControlRule: $x" >> $outfile - done - - ### Create static information file - ldif_file="${LDIF_DIR}/static-file-PX.ldif" - ${STATIC_CREATE} -c $outfile -t ${TEMPLATE_DIR}/GlueService.template > ${ldif_file} - -fi - - if [ $? -ne 0 ] ; then - yaimlog WARNING "${STATIC_CREATE} returned an error code!" - fi -###### - - ### Exit with success +CONF_DIR="$INSTALL_ROOT/glite/var/tmp/gip" +LDIF_DIR="${INSTALL_ROOT}/glite/etc/gip/ldif" +rm -rf ${CONF_DIR}/glite-info-static-px.conf +rm -rf ${LDIF_DIR}/static-file-PX.ldif return 0 + } diff --git a/org.glite.yaim.myproxy/config/functions/config_info_service_px b/org.glite.yaim.myproxy/config/functions/config_info_service_px new file mode 100644 index 0000000..4165984 --- /dev/null +++ b/org.glite.yaim.myproxy/config/functions/config_info_service_px @@ -0,0 +1,92 @@ +############################################################################## +# Copyright (c) Members of the EGEE Collaboration. 2004. +# See http://www.eu-egee.org/partners/ for details on the copyright +# holders. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +# +# NAME : config_info_service_px +# +# DESCRIPTION : This function configures the dynamic service publisher +# for MyProxy (PX) node. +# +# AUTHORS : Maria.Alandes.Pradillo@cern.ch +# +# NOTES : +# +# YAIM MODULE: glite-yaim-myproxy +# +############################################################################## + +config_info_service_px_check () { + requires $1 GRID_TRUSTED_BROKERS SITE_NAME INSTALL_ROOT +} + +config_info_service_px_setenv () { + yaimlog DEBUG "This function currently doesn't set any environment variables." +} + +config_info_service_px () { + +INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec} +INFO_SERVICE_CONFIG=${INFO_SERVICE_CONFIG:-${INSTALL_ROOT}/glite/etc} +INFO_PROVIDER_PATH=${INFO_PROVIDER_PATH:-${INSTALL_ROOT}/glite/etc/gip/provider} +SERVICE=myproxy + +if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf.template ]; then + yaimlog ERROR "The template file for glite-info-service-${SERVICE}.conf.template was not found in ${INFO_SERVICE_CONFIG}." + exit 1 +fi + +if [ ! -f ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then + yaimlog ERROR "The script file for glite-info-service was not found in ${INFO_SERVICE_SCRIPT}." + exit 1 +fi + +rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf + +grid_trusted_brokers="" +while read x; do + grid_trusted_brokers="${x}\\\n${grid_trusted_brokers}" +done < <(split_quoted_variable $GRID_TRUSTED_BROKERS) + +cat ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf.template | sed \ + -e "s#^get_acbr =.*#get_acbr = echo -e \"${grid_trusted_brokers}\"#" \ +> ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf + +grep -q glite-info-service-${SERVICE}.conf ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper >> /dev/null +res=$? +if [ -f ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper ]; then + if [ $res -eq 1 ]; then + cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper +#!/bin/sh +export PATH=$PATH:${INFO_SERVICE_SCRIPT} +${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf $SITE_NAME +EOF + chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper + fi +else + cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper +#!/bin/sh +export PATH=$PATH:${INFO_SERVICE_SCRIPT} +${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf $SITE_NAME +EOF + chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper +fi + + +# Exit with success +return 0 + +} -- 1.8.2.3