private void updateAgentProperties()

in src/jetbrains/buildServer/clouds/local/LocalCloudInstance.java [253:279]


    private void updateAgentProperties(@NotNull final CloudInstanceUserData data) throws IOException {
      File inConfigFile = new File(new File(myBaseDir, "conf"), "buildAgent.properties"), outConfigFile = inConfigFile;
      if (!inConfigFile.isFile()) {
        inConfigFile = new File(new File(myBaseDir, "conf"), "buildAgent.dist.properties");
        if (!inConfigFile.isFile()) {
          inConfigFile = null;
        }
      }
      final Properties config = PropertiesUtil.loadProperties(inConfigFile);

      config.put("serverUrl", data.getServerAddress());
      config.put("workDir", "../work");
      config.put("tempDir", "../temp");
      config.put("systemDir", "../system");

      //agent name and auth-token must be patched only once
      if (!myIsConfigPatched.getAndSet(true)) {
        config.put("name", data.getAgentName());
        config.put("authorizationToken", data.getAuthToken());
      }
      for (final Map.Entry<String, String> param : data.getCustomAgentConfigurationParameters().entrySet()) {
        config.put(param.getKey(), param.getValue());
      }
      config.put(IMAGE_ID_PARAM_NAME, getImageId());
      config.put(INSTANCE_ID_PARAM_NAME, myId);
      PropertiesUtil.storeProperties(config, outConfigFile, null);
    }