Example #1
0
 public ConfigSaveState updateServerConfig(
     final MailHost mailHost,
     final LdapConfig ldapConfig,
     final PasswordFileConfig passwordFileConfig,
     final boolean shouldAllowAutoLogin,
     final String md5,
     final String artifactsDir,
     final Double purgeStart,
     final Double purgeUpto,
     final String jobTimeout,
     final String siteUrl,
     final String secureSiteUrl,
     final String taskRepositoryLocation) {
   final List<ConfigSaveState> result = new ArrayList<>();
   result.add(
       updateConfig(
           new GoConfigDao.NoOverwriteCompositeConfigCommand(
               md5,
               goConfigDao.mailHostUpdater(mailHost),
               securityUpdater(ldapConfig, passwordFileConfig, shouldAllowAutoLogin),
               serverConfigUpdater(
                   artifactsDir,
                   purgeStart,
                   purgeUpto,
                   jobTimeout,
                   siteUrl,
                   secureSiteUrl,
                   taskRepositoryLocation))));
   // should not reach here with empty result
   return result.get(0);
 }
Example #2
0
 public List<CaseInsensitiveString> pipelines(String group) {
   PipelineConfigs configs = getCurrentConfig().pipelines(group);
   List<CaseInsensitiveString> pipelines = new ArrayList<>();
   for (PipelineConfig config : configs) {
     pipelines.add(config.name());
   }
   return pipelines;
 }
Example #3
0
 private PipelineConfigDependencyGraph findUpstream(PipelineConfig currentPipeline) {
   List<PipelineConfigDependencyGraph> graphs = new ArrayList<>();
   for (CaseInsensitiveString name : currentPipeline.upstreamPipelines()) {
     PipelineConfig pipelineConfig = getCurrentConfig().pipelineConfigByName(name);
     graphs.add(findUpstream(pipelineConfig));
   }
   return new PipelineConfigDependencyGraph(
       currentPipeline, graphs.toArray(new PipelineConfigDependencyGraph[0]));
 }
Example #4
0
 public List<PipelineConfig> downstreamPipelinesOf(String pipelineName) {
   List<PipelineConfig> dependencies = new ArrayList<>();
   for (PipelineConfig config : getAllPipelineConfigs()) {
     if (config.dependsOn(new CaseInsensitiveString(pipelineName))) {
       dependencies.add(config);
     }
   }
   return dependencies;
 }
Example #5
0
 private List<String> invertSelections(List<String> selectedPipelines) {
   List<String> unselectedPipelines = new ArrayList<>();
   List<PipelineConfig> pipelineConfigList = cruiseConfig().getAllPipelineConfigs();
   for (PipelineConfig pipelineConfig : pipelineConfigList) {
     String pipelineName = CaseInsensitiveString.str(pipelineConfig.name());
     if (!selectedPipelines.contains(pipelineName)) {
       unselectedPipelines.add(pipelineName);
     }
   }
   return unselectedPipelines;
 }
Example #6
0
    protected ConfigSaveState updatePartial(String xmlPartial, final String md5) throws Exception {
      LOGGER.debug("[Config Save] Updating partial");
      org.dom4j.Document document = documentRoot();
      Element root = document.getRootElement();

      Element configElement = ((Element) root.selectSingleNode(getXpath()));
      List nodes = configElement.getParent().content();
      int index = nodes.indexOf(configElement);

      LOGGER.debug("[Config Save] Converting to object");
      Element newConfigElement = reader.read(new StringReader(xmlPartial)).getRootElement();
      nodes.set(index, newConfigElement);

      return saveConfig(document.asXML(), md5);
    }
Example #7
0
 private void addRoleUsers(
     List<CaseInsensitiveString> users, final CaseInsensitiveString roleName) {
   Role role = security().getRoles().findByName(roleName);
   if (role != null) {
     for (RoleUser roleUser : role.getUsers()) {
       users.add(roleUser.getName());
     }
   }
 }