Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-1758

Class FileModuleShardConfigProvider does not load configurations from classpath properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • None
    • None
    • mdsal
    • None
    • Operating System: All
      Platform: All

    • 9056

      Loading configurations from classpath in class FileModuleShardConfigProvider [1] does not work properly, because it tries to read from file name instead of file path.

      This is code that read configs:

      Config moduleShardsConfig = null;
      if (moduleShardsFile.exists())

      { LOG.info("module shards config file exists - reading config from it"); moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile); } else { LOG.warn("module shards configuration read from resource"); moduleShardsConfig = ConfigFactory.load(moduleShardsFile.getName()); // <------------------- }

      Config modulesConfig = null;
      if (modulesFile.exists()) { LOG.info("modules config file exists - reading config from it"); modulesConfig = ConfigFactory.parseFile(modulesFile); } else { LOG.warn("modules configuration read from resource"); modulesConfig = ConfigFactory.load(modulesFile.getName()); // <------------------- }

      And it should look something like this:

      Config moduleShardsConfig = null;
      if (moduleShardsFile.exists()) { LOG.info("module shards config file exists - reading config from it"); moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile); }

      else

      { LOG.warn("module shards configuration read from resource"); final String path = moduleShardsFile.getPath().replace("\\", "/"); // in case of windows OS moduleShardsConfig = ConfigFactory.load(path); }

      Config modulesConfig = null;
      if (modulesFile.exists())

      { LOG.info("modules config file exists - reading config from it"); modulesConfig = ConfigFactory.parseFile(modulesFile); }

      else

      { LOG.warn("modules configuration read from resource"); final String path = modulesFile.getPath().replace("\\", "/"); // in case of windows OS modulesConfig = ConfigFactory.load(path); }

      [1] - org.opendaylight.controller.cluster.datastore.config.FileModuleShardConfigProvider

            jakubtoth-0 Jakub Toth
            samuel.kontris Samuel Kontris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: