Ejemplo n.º 1
0
 public function copy_common_stage()
 {
     $viewData = new ViewData();
     $deployment = $this->getDeployment('host_group_error');
     $hostGrpName = $this->getParam('hostName');
     if ($hostGrpName === false) {
         $viewData->header = $this->getErrorHeader('host_group_error');
         $viewData->error = 'Unable to detect host specified in post params';
         $this->sendError('generic_error', $viewData);
     }
     $commonRepo = RevDeploy::getDeploymentCommonRepo($deployment);
     $commonrevision = RevDeploy::getDeploymentRev($commonRepo);
     $viewData->hostGrpInfo = RevDeploy::getDeploymentHostGroup($commonRepo, $hostGrpName, $commonrevision);
     $viewData->deployment = $deployment;
     $viewData->action = 'copy_write';
     $this->sendResponse('host_group_action_stage', $viewData);
 }
Ejemplo n.º 2
0
                $results[$hgtemp] = RevDeploy::getDeploymentHostGroup($deployment, $hgtemp, $deployRev);
            }
        }
        if (empty($results)) {
            $apiResponse = new APIViewData(1, $deployment, "Unable to detect host groups specified: {$hostgroup}");
            $app->halt(404, $apiResponse->returnJson());
        } else {
            $apiResponse = new APIViewData(0, $deployment, false);
            $apiResponse->setExtraResponseData('host_groups', $results);
        }
    } else {
        if (RevDeploy::existsDeploymentHostGroup($deployment, $hostgroup, $deployRev) === false) {
            $apiResponse = new APIViewData(1, $deployment, "Unable to detect host groups specified: {$hostgroup}");
            $app->halt(404, $apiResponse->returnJson());
        } else {
            $hostGroupsInfo = RevDeploy::getDeploymentHostGroup($deployment, $hostgroup, $deployRev);
            $apiResponse = new APIViewData(0, $deployment, false);
            $apiResponse->setExtraResponseData('host_group', $hostGroupsInfo);
        }
    }
    $apiResponse->printJson();
})->name('saigon-api-get-host-groups');
$app->post('/sapi/hostgroup/:deployment', function ($deployment) use($app) {
    check_deployment_exists($app, $deployment);
    check_auth($app, $deployment);
    check_revision_status($deployment);
    $request = $app->request();
    $contentType = $request->headers('Content-Type');
    if ($contentType == 'application/json') {
        $hostGroupsInfo = $request->getBody();
        $hostGroupsInfo = json_decode($hostGroupsInfo, true);