Esempio n. 1
0
 /**
  * buildDiffRevisions - build the revisions of the deployment and store them for diffing
  * 
  * @param mixed $deployment    deployment we are building revisions for
  * @param mixed $subdeployment deployment we are building revisions for
  * @param mixed $fromrev       from revision we are building
  * @param mixed $torev         to revision we are building
  * @param mixed $shardposition shard position we may be using
  *
  * @static
  * @access public
  * @return void
  */
 public static function buildDiffRevisions($deployment, $subdeployment, $fromrev, $torev, $shardposition)
 {
     self::$_results = array();
     self::$_output = "";
     NagRedis::init(true);
     $lockReturn = NagTester::setDeploymentBuildLock($deployment, $subdeployment, $fromrev);
     if ($lockReturn === false) {
         self::$_output = "Unable to acquire build lock for Deployment/Revision: {$deployment}/{$fromrev}";
         return false;
     }
     NagCreate::resetLocalCache();
     /* Get Current Nagios Configs */
     NagCreate::buildDeployment($deployment, $fromrev, true, true, $shardposition);
     $fromconfs = NagCreate::returnDeploymentConfigs($deployment);
     $fromconfs['nrpe.cfg'] = self::_getNRPECfg($deployment, $fromrev);
     $fromconfs['supplemental-nrpe.cfg'] = self::_getSupNRPECfg($deployment, $fromrev);
     NagTester::deleteDeploymentBuildLock($deployment, $subdeployment, $fromrev);
     $lockReturn = NagTester::setDeploymentBuildLock($deployment, $subdeployment, $torev);
     if ($lockReturn === false) {
         self::$_output = "Unable to acquire build lock for Deployment/Revision: {$deployment}/{$torev}";
         return false;
     }
     /* Get Future Revision Configs */
     NagCreate::buildDeployment($deployment, $torev, true, true, $shardposition);
     $toconfs = NagCreate::returnDeploymentConfigs($deployment);
     $toconfs['nrpe.cfg'] = self::_getNRPECfg($deployment, $torev);
     $toconfs['supplemental-nrpe.cfg'] = self::_getSupNRPECfg($deployment, $torev);
     NagTester::deleteDeploymentBuildLock($deployment, $subdeployment, $torev);
     /* Get Plugin Information */
     $fnagplugins = RevDeploy::getDeploymentNagiosPlugins($deployment, $fromrev);
     $tnagplugins = RevDeploy::getDeploymentNagiosPlugins($deployment, $torev);
     $nagplugins = array_merge($fnagplugins, $tnagplugins);
     $fromnagiosplugins = self::_getPlugins('nagios', $deployment, $fromrev, $nagplugins);
     $tonagiosplugins = self::_getPlugins('nagios', $deployment, $torev, $nagplugins);
     $fplugins = RevDeploy::getDeploymentNRPEPlugins($deployment, $fromrev);
     $tplugins = RevDeploy::getDeploymentNRPEPlugins($deployment, $torev);
     $plugins = array_merge($fplugins, $tplugins);
     $fromnrpecoreplugins = self::_getPlugins('nrpe-core', $deployment, $fromrev, $plugins);
     $tonrpecoreplugins = self::_getPlugins('nrpe-core', $deployment, $torev, $plugins);
     $fsplugins = RevDeploy::getDeploymentSupNRPEPlugins($deployment, $fromrev);
     $tsplugins = RevDeploy::getDeploymentSupNRPEPlugins($deployment, $torev);
     $supplugins = array_merge($fsplugins, $tsplugins);
     $fromsupnrpeplugins = self::_getPlugins('nrpe-sup', $deployment, $fromrev, $supplugins);
     $tosupnrpeplugins = self::_getPlugins('nrpe-sup', $deployment, $torev, $supplugins);
     /* Ok lets diff the results and send it out */
     $results = array();
     $results['nagiosconfs']['from'] = $fromconfs;
     $results['nagiosconfs']['to'] = $toconfs;
     $results['plugins']['nagios']['from'] = $fromnagiosplugins;
     $results['plugins']['nagios']['to'] = $tonagiosplugins;
     $results['plugins']['nrpe']['core']['from'] = $fromnrpecoreplugins;
     $results['plugins']['nrpe']['core']['to'] = $tonrpecoreplugins;
     $results['plugins']['nrpe']['sup']['from'] = $fromsupnrpeplugins;
     $results['plugins']['nrpe']['sup']['to'] = $tosupnrpeplugins;
     self::$_results = $results;
     unset($fromconfs, $toconfs, $results);
     unset($fnagplugins, $tnagplugins, $nagplugins, $fromnagiosplugins, $tonagiosplugins);
     unset($fplugins, $tplugins, $plugins, $fromnrpecoreplugins, $tonrpecoreplugins);
     unset($fsplugins, $tsplugins, $supplugins, $fromsupnrpeplugins, $tosupnrpeplugins);
     return true;
 }
Esempio n. 2
0
 public static function moveDeployment($deployment, $verbose = false)
 {
     self::checkProdPerms();
     self::$deployment = $deployment;
     $moveReturn = array();
     foreach (self::$deployFiles as $file) {
         $moveReturn[$file] = self::moveDeployFile($file, $verbose);
     }
     foreach (self::$coreFiles as $file) {
         $moveReturn[$file] = self::moveCoreFile($file, $verbose);
     }
     /* modgearman has its own perl consumer, only preventing moving, build still
            happens so it can be displayed in UI
        foreach (self::$modgearmanFiles as $file) {
            $moveReturn[$file] = self::moveModgearmanFile($file, $verbose);
        }
        */
     $results = array();
     foreach ($moveReturn as $file => $return) {
         if ($return === false) {
             continue;
         }
         array_push($results, $file);
     }
     return $results;
 }