private void updateAgentPermissions()

in src/jetbrains/buildServer/clouds/local/LocalCloudInstance.java [281:307]


    private void updateAgentPermissions() {
      if (SystemInfo.isWindows) return;
      if (!myIsAgentPermissionsUpdated.compareAndSet(false, true)) return;

      for (String dir : new String[]{"bin", "launcher/bin"}) {
        final File basePath = new File(myImage.getAgentHomeDir(), dir);
        final File[] files = basePath.listFiles(new FilenameFilter() {
          @Override
          public boolean accept(File dir, String name) {
            return name.endsWith(".sh");
          }
        });

        if (files == null) {
          LOG.warn("Failed to list files under " + basePath);
          continue;
        }

        for (File file : files) {
          try {
            FileUtil.setExectuableAttribute(file.getAbsolutePath(), true);
          } catch (IOException e) {
            LOG.warn("Failed to set writable permission for " + file + ". " + e.getMessage());
          }
        }
      }
    }