+ Moved the ApplyFaclsTask

This commit is contained in:
Cedric Le Varlet 2015-10-15 15:40:53 +02:00
parent 36c95fcf3c
commit aaab59911e
2 changed files with 13 additions and 6 deletions

View file

@ -196,7 +196,7 @@ abstract class AbstractTask
// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
$needs_tty = ($this->getConfig()->general('ssh_needs_tty', false) ? '-t' : '');
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
$localCommand = 'ssh -A ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. $this->getConfig()->getConnectTimeoutOption()
. ($this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '')

View file

@ -5,6 +5,11 @@ use Mage\Task\AbstractTask;
use Mage\Task\SkipException;
use Mage\Task\Releases\IsReleaseAware;
/**
* Applies Facls to defined directories with the provided flags
* Class ApplyFaclsTask
* @package Mage\Task\BuiltIn\Filesystem
*/
class ApplyFaclsTask extends AbstractTask implements IsReleaseAware
{
/**
@ -13,7 +18,7 @@ class ApplyFaclsTask extends AbstractTask implements IsReleaseAware
*/
public function getName()
{
return 'Set file ACLs on remote system [built-in]';
return 'Set file ACLs on remote system [newcraft]';
}
/**
@ -27,6 +32,7 @@ class ApplyFaclsTask extends AbstractTask implements IsReleaseAware
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$currentCopy = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
$flags = ' -'.$this->getParameter('flags', false).' ';
$aclParam = $this->getParameter('acl_param', '');
if (empty($aclParam)) {
@ -34,12 +40,13 @@ class ApplyFaclsTask extends AbstractTask implements IsReleaseAware
}
$folders = $this->getParameter('folders', []);
$recursive = $this->getParameter('recursive', false) ? ' -R ' : ' ';
$return = true;
foreach ($folders as $folder) {
$this->runCommandRemote("setfacl$recursive-m $aclParam $currentCopy/$folder", $output);
$execute = $this->runCommandRemote("setfacl$flags $aclParam $currentCopy/$folder", $output);
if(!$execute) $return = false;
}
return true;
return $return;
}
}
}