Commit 88f29835 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #2228 creating FAI branch when saving repository

parent 950bed7b
......@@ -120,6 +120,41 @@ class serviceDebianRepository extends simpleService
$this->attributesAccess['FAIrepository']->setLinearRendering(FALSE);
}
function ldap_save($clean = TRUE)
{
parent::ldap_save($clean);
// Check if FAI branch is here
$fai = get_ou('faiBaseRDN').$this->config->current['BASE'];
$ldap = $this->config->get_ldap_link();
$ldap->cat($fai, array('dn'));
if (!$ldap->count()) {
$ldap->cd($this->config->current['BASE']);
$ldap->create_missing_trees($fai);
if (!$ldap->success()) {
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $fai, LDAP_ADD, get_class()));
}
}
$repos = $this->attributesAccess['FAIrepository']->getArrayValues();
$done = array();
foreach ($repos as $repo) {
$release = $repo[2];
if (($repo[4] == 'install') && (!isset($done[$release])) {
$dn = "ou=$release,$fai";
$ldap->cat($dn, array('dn'));
if (!$ldap->count()) {
$ldap->cd ($dn);
$ldap->add(array('objectClass' => array('organizationalUnit','FAIbranch'), 'ou' => $release));
if (!$ldap->success()) {
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_ADD, get_class()));
}
}
$done[$release] = TRUE;
}
}
}
function getReleaseList ()
{
$ldap = $this->config->get_ldap_link();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment