protected function _saveAnsibleHosts(Project $project)
{
if (!$project->ansible) {
// 未开启ansible, 不用保存
return true;
}
$filePath = Project::getAnsibleHostsFile($project->id);
$ret = @file_put_contents($filePath, $project->hosts);
if (!$ret) {
throw new \Exception(yii::t('conf', 'ansible hosts save error', ['path' => $filePath]));
}
return true;
}