From: Ovidiu Mircescu Date: Thu, 7 Jun 2018 14:10:11 +0000 (+0200) Subject: Some parameters of the localhost resource can be changed. X-Git-Tag: SHAPER_V9_1_0RC1~15^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c82520d70c2917d4242c40fde70ef7f1db00b40;p=modules%2Fkernel.git Some parameters of the localhost resource can be changed. --- diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index 0603eb51d..b2ed58fa5 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -327,8 +327,21 @@ void ResourcesManager_cpp::AddResourceInCatalog(const ParserResourcesType & new_resource) { if (new_resource.Name == DEFAULT_RESOURCE_NAME){ - std::string error("Cannot modify default local resource \"" + DEFAULT_RESOURCE_NAME + "\""); - throw ResourcesException(error); + ParserResourcesType default_resource = _resourcesList[DEFAULT_RESOURCE_NAME]; + // some of the properties of the default resource shouldn't be modified + std::string check; + if( default_resource.HostName != new_resource.HostName) + check += "The Hostname property of the default resource can not be modified.\n"; + if( default_resource.AppliPath != new_resource.AppliPath) + check += "The Applipath property of the default resource can not be modified.\n"; + if( !new_resource.can_run_containers) + check += "The default resource should be able to run containers.\n"; + if( !new_resource.can_launch_batch_jobs) + check += "The default resource should be able to launch batch jobs.\n"; + if( default_resource.Protocol != new_resource.Protocol) + check += "The Protocol property of the default resource can not be modified.\n"; + if(!check.empty()) + throw ResourcesException(check); } // TODO - Add minimal check _resourcesList[new_resource.Name] = new_resource; @@ -364,12 +377,9 @@ void ResourcesManager_cpp::WriteInXmlFile(std::string xml_file) RES_MESSAGE("WriteInXmlFile : start"); MapOfParserResourcesType resourceListToSave(_resourcesList); - // We do not save default local resource because it is automatically created at startup - resourceListToSave.erase(DEFAULT_RESOURCE_NAME); if (resourceListToSave.empty()) { - RES_MESSAGE("WriteInXmlFile: nothing to do, no resource except default \"" << - DEFAULT_RESOURCE_NAME << "\""); + RES_MESSAGE("WriteInXmlFile: nothing to do, no resource to save!"); return; }