@Override public String valueOf(EnvType envType) { return envType.getName(); } })
@Override protected String getRestrictedValue(Environment env) { return env.getName(); } }
@Override public String valueOf(EnvType envType) { return envType.getName(); } })
@Override public Object valueOf(E e) { return e.getName(); } }, "Invalid configuration from " + sourcePath + "; not expecting duplicate env names");
@Override protected String getRestrictedValue(Environment env) { return env.getName(); } }
@Override public Object valueOf(E e) { return e.getName(); } }, "Invalid configuration from " + sourcePath + "; not expecting duplicate env names");
public String getDisplayString() { return "Environment [" + this.getName() + "]"; }
public String getDisplayString() { return "Environment [" + this.getName() + "]"; }
private void checkIfCleanBuildShouldProceed(Environment env, boolean noPrompt) { LOG.info("Request was made to clean the environment..."); Validate.isTrue(env.isCleanBuildAllowed(), "Clean build not allowed for this environment [" + env.getName() + "] ! Exiting..."); if (!noPrompt) { LOG.info("WARNING - This will wipe the whole environment!!! Are you sure you want to proceed? (Y/N)"); String input = this.userInputReader.readLine(null); Validate.isTrue(input.trim().equalsIgnoreCase("Y"), "User did not enter Y. Hence, we will exit from here."); } } }
private DeployerAppContext createRuntimeContext(EnvType env, DeployerArgs args) { final File workDir; if (args.getWorkDir() == null) { workDir = FileUtilsCobra.createTempDir("deploy-" + env.getName()); } else { workDir = args.getWorkDir(); } LOG.info("Using working directory for env {} as: {}", env.getName(), workDir); Credential credential = this.credentialReader.getCredential(args.getDeployUserId(), args.getPassword(), args.isUseKerberosAuth(), args.getKeytabPath(), env.getDefaultUserId(), env.getDefaultPassword()); LOG.info("Running deployment as user {}", credential.getUsername()); return createRuntimeContext(env, workDir, credential); }
private DeployerAppContext createRuntimeContext(EnvType env, DeployerArgs args) { final File workDir; if (args.getWorkDir() == null) { workDir = FileUtilsCobra.createTempDir("deploy-" + env.getName()); } else { workDir = args.getWorkDir(); } LOG.info("Using working directory for env {} as: {}", env.getName(), workDir); Credential credential = this.credentialReader.getCredential(args.getDeployUserId(), args.getPassword(), args.isUseKerberosAuth(), args.getKeytabPath(), env.getDefaultUserId(), env.getDefaultPassword()); LOG.info("Running deployment as user {}", credential.getUsername()); return createRuntimeContext(env, workDir, credential); }
private RichIterable<EnvType> getRequestedEnvironments(String sourcePath, String... envNames) { MutableCollection<EnvType> environments = getRequestedSystem(sourcePath); MutableList<EnvType> requestedEnvs = Lists.mutable.empty(); if (envNames == null || envNames.length == 0) { requestedEnvs.add(readSingleEnvironment(environments, sourcePath)); } else { for (EnvType sysEnv : environments) { for (String envPattern : envNames) { if (Pattern.compile(RegexUtil.convertWildcardPatternToRegex(envPattern)) .matcher(sysEnv.getName()) .matches()) { requestedEnvs.add(sysEnv); } } } } if (requestedEnvs.isEmpty()) { throw new IllegalArgumentException("No environment with name/s " + Lists.mutable.with(envNames).makeString("(", ",", ")") + " found"); } return requestedEnvs; }
private RichIterable<EnvType> getRequestedEnvironments(String sourcePath, String... envNames) { MutableCollection<EnvType> environments = getRequestedSystem(sourcePath); MutableList<EnvType> requestedEnvs = Lists.mutable.empty(); if (envNames == null || envNames.length == 0) { requestedEnvs.add(readSingleEnvironment(environments, sourcePath)); } else { for (EnvType sysEnv : environments) { for (String envPattern : envNames) { if (Pattern.compile(RegexUtil.convertWildcardPatternToRegex(envPattern)) .matcher(sysEnv.getName()) .matches()) { requestedEnvs.add(sysEnv); } } } } if (requestedEnvs.isEmpty()) { throw new IllegalArgumentException("No environment with name/s " + Lists.mutable.with(envNames).makeString("(", ",", ")") + " found"); } return requestedEnvs; }
public <E extends Environment> ImmutableCollection<E> readFromSourcePath(String sourcePath, String... envNames) { EnvironmentLocator dbEnvironmentLocator = new EnvironmentLocator(); ImmutableCollection<E> environments = dbEnvironmentLocator.readSystem(sourcePath); MutableList<E> requestedEnvs = Lists.mutable.empty(); for (E env : environments) { if (envNames == null || envNames.length == 0) { requestedEnvs.add(env); } else { for (String envPattern : envNames) { if (Pattern.compile(RegexUtil.convertWildcardPatternToRegex(envPattern)) .matcher(env.getName()) .matches()) { requestedEnvs.add(env); } } } } if (requestedEnvs.isEmpty()) { throw new IllegalArgumentException("No environment with name/s " + Lists.mutable.with(envNames).makeString("(", ",", ")") + " found"); } return requestedEnvs.toImmutable(); }
public <E extends Environment> ImmutableCollection<E> readFromSourcePath(String sourcePath, String... envNames) { EnvironmentLocator dbEnvironmentLocator = new EnvironmentLocator(); ImmutableCollection<E> environments = dbEnvironmentLocator.readSystem(sourcePath); MutableList<E> requestedEnvs = Lists.mutable.empty(); for (E env : environments) { if (envNames == null || envNames.length == 0) { requestedEnvs.add(env); } else { for (String envPattern : envNames) { if (Pattern.compile(RegexUtil.convertWildcardPatternToRegex(envPattern)) .matcher(env.getName()) .matches()) { requestedEnvs.add(env); } } } } if (requestedEnvs.isEmpty()) { throw new IllegalArgumentException("No environment with name/s " + Lists.mutable.with(envNames).makeString("(", ",", ")") + " found"); } return requestedEnvs.toImmutable(); }
public void start(DeployerAppContext ctxt, DeployerArgs args) { Environment env = ctxt.getEnvironment(); LOG.info("Setting up the the environment infrastructure for {}; will {} on setup exception", env.getName(), args.isStrictSetupEnvInfra() ? "fail" : "warn"); if (args.getForceEnvSetup() != null && args.getForceEnvSetup().booleanValue()) { ctxt.setupEnvInfra(args.isStrictSetupEnvInfra(), args.getForceEnvSetup().booleanValue()); LOG.info("Now cleaning the environment " + env.getName() + ", as specified at the command line"); ctxt.cleanEnvironment();
throw new IllegalArgumentException("Environment " + dbEnv.getName() + " has includeSchemas [" + schemasToInclude + "] and excludeSchemas [" + schemasToExclude + "] defined; please only specify one of them"); } else { throw new IllegalArgumentException("Schema override definition value " + schema + " is not defined in the schema list " + schemaNames + " for environment " + dbEnv.getName());
throw new IllegalArgumentException("Environment " + dbEnv.getName() + " has includeSchemas [" + schemasToInclude + "] and excludeSchemas [" + schemasToExclude + "] defined; please only specify one of them"); } else { throw new IllegalArgumentException("Schema override definition value " + schema + " is not defined in the schema list " + schemaNames + " for environment " + dbEnv.getName());