57 lines
991 B
CFEngine3
57 lines
991 B
CFEngine3
#
|
|
#
|
|
#
|
|
bundle agent git
|
|
{
|
|
vars:
|
|
freebsd::
|
|
"pkgs" slist => { "git" };
|
|
"exe" string => "/usr/local/bin/git";
|
|
|
|
debian::
|
|
"pkgs" slist => { "git" };
|
|
"exe" string => "/usr/bin/git";
|
|
}
|
|
|
|
bundle agent install_git
|
|
{
|
|
methods:
|
|
"any" usebundle => wmde_install_packages(@(git.pkgs),"git");
|
|
}
|
|
|
|
|
|
body contain gitcmd(execuser,execgroup)
|
|
{
|
|
exec_owner => "$(execuser)";
|
|
exec_group => "$(execgroup)";
|
|
}
|
|
|
|
|
|
bundle agent git_repo(repo)
|
|
{
|
|
classes:
|
|
"repo_exists" expression => fileexists("$(repo[path])/.git");
|
|
|
|
files:
|
|
"$(repo[path])/."
|
|
create=>"true",
|
|
perms=>mog("$(repo[perm])","$(repo[user])","$(repo[group])"),
|
|
handle=>"git_repo_$(repo[path])_created";
|
|
|
|
commands:
|
|
!repo_exists::
|
|
"$(git.exe)"
|
|
args=>"clone --branch $(repo[branch]) $(repo[source]) $(repo[path])",
|
|
depends_on => {"git_repo_$(repo[path])_created"},
|
|
contain => gitcmd("$(repo[user])","$(repo[group])");
|
|
reports:
|
|
# "PATH $(repo[path])/.git";
|
|
# repo_exists::
|
|
# "REPO EXISTS";
|
|
# !repo_exists::
|
|
# "REPO iDOES NOT EXISTS";
|
|
|
|
}
|
|
|
|
|