Exemple #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);
 }
Exemple #2
0
 public Collection<String> allRoleNames(CruiseConfig cruiseConfig) {
   List<String> roles = new ArrayList<String>();
   for (Role role : allRoles(cruiseConfig)) {
     roles.add(CaseInsensitiveString.str(role.getName()));
   }
   return roles;
 }
Exemple #3
0
 private List<String> toUserNames(List<User> enabledUsers) {
   List<String> enabledUserNames = new ArrayList<String>();
   for (User enabledUser : enabledUsers) {
     enabledUserNames.add(enabledUser.getName());
   }
   return enabledUserNames;
 }
Exemple #4
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;
 }
Exemple #5
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]));
 }
Exemple #6
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;
 }
Exemple #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());
     }
   }
 }
Exemple #8
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;
 }