当前位置: 首页>>代码示例>>PHP>>正文


PHP DBServer::getScalarizrRepository方法代码示例

本文整理汇总了PHP中DBServer::getScalarizrRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP DBServer::getScalarizrRepository方法的具体用法?PHP DBServer::getScalarizrRepository怎么用?PHP DBServer::getScalarizrRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBServer的用法示例。


在下文中一共展示了DBServer::getScalarizrRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setupScalrAgent

 public static function setupScalrAgent(\DBServer $dbServer)
 {
     $baseurl = \Scalr::config('scalr.endpoint.scheme') . "://" . \Scalr::config('scalr.endpoint.host');
     $env = $dbServer->GetEnvironmentObject();
     $azure = $env->azure();
     $branch = $dbServer->getScalarizrRepository()['repository'];
     $develRepos = \Scalr::getContainer()->config->get('scalr.scalarizr_update.devel_repos');
     $scmBranch = $dbServer->GetFarmRoleObject()->GetSetting('user-data.scm_branch');
     if ($scmBranch != '' && $develRepos) {
         $branch = $dbServer->GetFarmRoleObject()->GetSetting('base.devel_repository');
         $scmBranch = "{$scmBranch}/";
     } else {
         $scmBranch = '';
     }
     if ($dbServer->osType == 'linux') {
         $extensionProperties = new ResourceExtensionProperties('Microsoft.OSTCExtensions', 'CustomScriptForLinux', '1.2');
         $extensionProperties->setSettings(['commandToExecute' => "bash -c 'curl -k -L \"{$baseurl}/public/linux/{$branch}/azure/{$scmBranch}install_scalarizr.sh\" | bash && service scalr-upd-client start'"]);
     } else {
         $extensionProperties = new ResourceExtensionProperties('Microsoft.Compute', 'CustomScriptExtension', '1.4');
         $extensionProperties->setSettings(["commandToExecute" => "powershell -NoProfile -ExecutionPolicy Bypass -Command \"iex ((new-object net.webclient).DownloadString('{$baseurl}/public/windows/{$branch}/{$scmBranch}install_scalarizr.ps1')); start-service ScalrUpdClient\""]);
     }
     $createExtension = new CreateResourceExtension('scalarizr', $dbServer->cloudLocation, $extensionProperties);
     try {
         $response = $azure->compute->resourceExtension->create($env->keychain(SERVER_PLATFORMS::AZURE)->properties[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID], $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::RESOURCE_GROUP), $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::SERVER_NAME), $createExtension);
         \Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->info(new \FarmLogMessage($dbServer, sprintf(_("Created azure resource extension to install and launch scalr agent"))));
         $dbServer->SetProperty(\AZURE_SERVER_PROPERTIES::SZR_EXTENSION_DEPLOYED, 1);
     } catch (\Exception $e) {
         \Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->fatal(new \FarmLogMessage($dbServer, sprintf(_("Unable to create azure resource extension to install and launch scalr agent: %s"), $e->getMessage())));
     }
 }
开发者ID:scalr,项目名称:scalr,代码行数:30,代码来源:AzureHelper.php

示例2: getBaseConfiguration

 public function getBaseConfiguration(DBServer $dbServer, $isHostInit = false)
 {
     $configuration = new stdClass();
     $dbFarmRole = $dbServer->GetFarmRoleObject();
     //Storage
     try {
         if ($dbFarmRole) {
             $storage = new FarmRoleStorage($dbFarmRole);
             $volumes = $storage->getVolumesConfigs($dbServer->index, $isHostInit);
             if (!empty($volumes)) {
                 $configuration->volumes = $volumes;
             }
         }
     } catch (Exception $e) {
         $this->logger->error(new FarmLogMessage($dbServer->farmId, "Cannot init storage: {$e->getMessage()}"));
     }
     // Base
     try {
         if ($dbFarmRole) {
             $scriptingLogTimeout = $dbFarmRole->GetSetting(self::ROLE_BASE_KEEP_SCRIPTING_LOGS_TIME);
             if (!$scriptingLogTimeout) {
                 $scriptingLogTimeout = 3600;
             }
             $configuration->base = new stdClass();
             $configuration->base->keepScriptingLogsTime = $scriptingLogTimeout;
             $configuration->base->resumeStrategy = PlatformFactory::NewPlatform($dbFarmRole->Platform)->getResumeStrategy();
             $governance = new Scalr_Governance($dbFarmRole->GetFarmObject()->EnvID);
             if ($governance->isEnabled(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_HOSTNAME_FORMAT)) {
                 $hostNameFormat = $governance->getValue(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_HOSTNAME_FORMAT);
             } else {
                 $hostNameFormat = $dbFarmRole->GetSetting(self::ROLE_BASE_HOSTNAME_FORMAT);
             }
             $configuration->base->hostname = !empty($hostNameFormat) ? $dbServer->applyGlobalVarsToValue($hostNameFormat) : '';
             $apiPort = $dbFarmRole->GetSetting(self::ROLE_BASE_API_PORT);
             $messagingPort = $dbFarmRole->GetSetting(self::ROLE_BASE_MESSAGING_PORT);
             $configuration->base->apiPort = $apiPort ? $apiPort : 8010;
             $configuration->base->messagingPort = $messagingPort ? $messagingPort : 8013;
         }
         //Update settings
         $updateSettings = $dbServer->getScalarizrRepository();
         $configuration->base->update = new stdClass();
         foreach ($updateSettings as $k => $v) {
             $configuration->base->update->{$k} = $v;
         }
     } catch (Exception $e) {
     }
     return $configuration;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:48,代码来源:Behavior.php


注:本文中的DBServer::getScalarizrRepository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。