Skip to content

Commit

Permalink
synchronise with local version
Browse files Browse the repository at this point in the history
  • Loading branch information
schwicke committed Apr 17, 2013
1 parent 70ec7af commit 55425bc
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 124 deletions.
13 changes: 13 additions & 0 deletions files/clean-grid-env-funcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# YAIM function
# This function unsets the variables used by grid-env-funcs.sh
#
unset myvar
unset myvalue
unset myfieldsep
unset mytmp
unset -f gridpath_prepend
unset -f gridpath_append
unset -f gridpath_delete
unset -f gridenv_set
unset -f gridenv_setind
47 changes: 0 additions & 47 deletions files/getuid.rb

This file was deleted.

116 changes: 116 additions & 0 deletions files/grid-env-funcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Functions for manipulating the grid environment
#
# gridpath_prepend - prepend a value to a path-like environmnet variable
# - puts a ':' to the end end the beginning of the variable
# - removes the value from the string and removes duplicate '::'
# - prepend the value to the beginning of the variable
# - removes duplicate '::' and removes ':' from the beginning and the end variable
# - MANPATH has to be treated specially since, :: has a meaning -> don't get removed
# - Simple : could have a meaning so if it was there in the end or the begining we should not remove it.
# - export the variable, or echos the csh syntax
#
# gridpath_append - the same as prepend but it appends the value to the end of the variable
# gridpath_delete - delete a value from an environment variable. if the value becomes null string then it unsets the environment variable
# gridemv_set - sets an environment variable
# gridemv_unset - unsets an environment variable
# gridenv_setind - sets an environment variable if it is not already defined


function gridpath_prepend() {
myvar="$1"
myvalue="$2"
myfieldsep=":"
mytmp="`eval echo \\$$myvar`"

if [ "x$mytmp" = "x$myvalue" ] || [ "x$mytmp" = "x$myfieldsep$myvalue" ] || [ "x$mytmp" = "x$myvalue$myfieldsep" ] ; then
mytmp="${mytmp//$myvalue/}"
else
mytmp="${mytmp//$myfieldsep$myvalue$myfieldsep/$myfieldsep}" #remove if in the middle
mytmp="${mytmp#$myvalue$myfieldsep}" #remove if in the begining
mytmp="${mytmp%$myfieldsep$myvalue}" #remove if at the end
fi

if [ "x$mytmp" = "x" ]; then
mytmp="$myvalue"
else
mytmp="$myvalue$myfieldsep$mytmp"
fi

mytmp="${mytmp//$myfieldsep$myfieldsep$myfieldsep/$myfieldsep$myfieldsep}"

if [ "x$myvar" = "xMANPATH" ] ; then
mytmp="${mytmp}::"
fi
if [ "x$ISCSHELL" = "xyes" ]; then
echo "setenv $myvar \"$mytmp\""
fi
eval export ${myvar}=\""$mytmp"\"
}

function gridpath_append() {
myvar="$1"
myvalue="$2"
myfieldsep=":"
mytmp="`eval echo \\$$myvar`"

if [ "x$mytmp" = "x$myvalue" ] || [ "x$mytmp" = "x$myfieldsep$myvalue" ] || [ "x$mytmp" = "x$myvalue$myfieldsep" ] ; then
mytmp="${mytmp//$myvalue/}"
else
mytmp="${mytmp//$myfieldsep$myvalue$myfieldsep/$myfieldsep}" #remove if in the middle
mytmp="${mytmp#$myvalue$myfieldsep}" #remove if in the begining
mytmp="${mytmp%$myfieldsep$myvalue}" #remove if at the end
fi

if [ "x$mytmp" = "x" ]; then
mytmp="$myvalue"
else
mytmp="$mytmp$myfieldsep$myvalue"
fi

mytmp="${mytmp//$myfieldsep$myfieldsep$myfieldsep/$myfieldsep$myfieldsep}"

if [ "x$myvar" = "xMANPATH" ] ; then
mytmp="${mytmp}::"
fi
if [ "x$ISCSHELL" = "xyes" ]; then
echo "setenv $myvar \"$mytmp\""
fi
eval export ${myvar}=\""$mytmp"\"
}

function gridenv_set() {
myvar="$1"
myvalue="$2"
myfieldsep=":"

if [ "x$ISCSHELL" = "xyes" ]; then
echo "setenv $myvar \"$myvalue\""
fi
eval export ${myvar}="\"${myvalue}\""
}

function gridenv_setind() {
myvar="$1"
myvalue="$2"
if [ "x$ISCSHELL" = "xyes" ]; then
echo 'if ( ${?'$myvar'} == 0 ) setenv '$myvar \'"$myvalue"\'
fi
eval "export $myvar=\${$myvar:-\$myvalue}"
}

function gridenv_unset() {
myvar="$1"
eval unset \""$myvar"\"
}

function gridpath_delete() {
myvar="${!1}"
myvalue="$2"
declare myvar=$(echo $myvar | sed -e "s;\(^$myvalue:\|:$myvalue$\|:$myvalue\(:\)\|^$myvalue$\);\2;g")

if [ "x$ISCSHELL" = "xyes" ]; then
echo "setenv $1 \"$myvar\""
fi
eval export $1=\""$myvar"\"
}

71 changes: 0 additions & 71 deletions lib/puppet/parser/functions/getuid.cron

This file was deleted.

2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/uidfilterbygid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Puppet::Parser::Functions
if thisgid == gid.to_s
filtered["uid"][key] = value
# to be removed later once the additional defaultgid parameter works
filtered["gid"][key] = gid
# filtered["gid"][key] = gid
end
}
return filtered
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/provider/poolhome/poolhome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def getUID(name)
def getGID(name)
poolUidGids = resource[:uidmap]
lookup = poolUidGids["gid"][name]
if (lookup != "")
if (lookup && lookup.to_i > 0)
gid = lookup.to_i()
else
if (resource[:defaultgid])
gid = resource[:defaultgid]
if (resource[:defaultgid] && resource[:defaultgid].to_i > 0 )
gid = resource[:defaultgid].to_i
else
gid = 0
end
Expand Down
15 changes: 15 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@

include concat::setup

file {"grid-env-funcs.sh":
path => '/usr/libexec/grid-env-funcs.sh',
source => 'puppet:///modules/vosupport/grid-env-funcs.sh',
owner => "root",
group => "root",
mode => 0644,
}
file {"clean-grid-env-funcs.sh":
path => '/usr/libexec/clean-grid-env-funcs.sh',
source => 'puppet:///modules/vosupport/grid-env-funcs.sh',
owner => "root",
group => "root",
mode => 0644,
}

#
# overall process:
#
Expand Down
4 changes: 2 additions & 2 deletions manifests/setuphome.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
{
if ($prefix){
if ($vosupport::uidmap::vo2gidmap){
if ($vosupport::uidmap::vo2gidmap[$voname]){
$gid = $vosupport::uidmap::vo2gidmap[$voname]
poolhome {$prefix:
ensure => present,
Expand All @@ -17,7 +17,7 @@
digits => $digits,
homeroot => $homeroot,
uidmap => uidfilterbygid($vosupport::uidmap::uidmap,$gid),
# defaultgid => $gid,
defaultgid => $gid,
require => File[$homeroot],
}
}
Expand Down
7 changes: 7 additions & 0 deletions manifests/vos/atlas.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class vosupport::vos::atlas()
{
vosupport::enable_vo {
'atlas':
enable_mappings_for_service => "ARGUS"
}
}
8 changes: 8 additions & 0 deletions manifests/vos/dteam.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class vosupport::vos::dteam()
{
vosupport::enable_vo {
'dteam':
enable_mappings_for_service => "ARGUS"
}

}

0 comments on commit 55425bc

Please sign in to comment.