Skip to content

Commit

Permalink
slurm::repo
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Varrette <Sebastien.Varrette@uni.lu>
  • Loading branch information
Sebastien Varrette authored and Sebastien Varrette committed Sep 5, 2017
1 parent 504974b commit 2d9b106
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
31 changes: 27 additions & 4 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Time-stamp: <Tue 2017-09-05 16:47 svarrette>
# Time-stamp: <Tue 2017-09-05 17:09 svarrette>
#
# File:: <tt>repo.pp</tt>
# Author:: UL HPC Team (hpc-sysadmins@uni.lu)
Expand Down Expand Up @@ -63,7 +63,7 @@
String $provider = 'git',
String $basedir = $slurm::params::repo_basedir,
String $path = '',
String $user = $slurm::params::username,
String $user = '',
$source = undef,
String $branch = 'HEAD',
String $syncscript = ''
Expand All @@ -84,17 +84,40 @@
'' => "${basedir}/${institute}/${reponame}",
default => $path,
}
$real_user = empty($user) ? {
true => defined(Class[::slurm]) ? {
true => $slurm::username,
default => 'root',
},
default => $user,
}

if $ensure == 'present' {
exec { "mkdir -p ${real_path}":
path => '/sbin:/usr/bin:/usr/sbin:/bin',
unless => "test -d ${real_path}",
before => Vcsrepo[$real_path],
user => $real_user,
}
}
else {
file { $real_path:
ensure => $ensure,
force => true,
}
}

# notice($source)
# notice($real_path)

vcsrepo { $real_path:
ensure => $ensure,
provider => $provider,
source => $source,
user => $user,
user => $real_user,
revision => $branch,
}



}
}
3 changes: 2 additions & 1 deletion tests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

class { '::slurm::repo':
ensure => 'present',
source => 'ssh://git@github.com/ULHPC/slurm-control.git',
source => 'https://github.com/SchedMD/slurm.git',
#'ssh://git@github.com/ULHPC/slurm-control.git',
}

}

0 comments on commit 2d9b106

Please sign in to comment.