void CopyVariables(VariableDictionary copyFrom, CalamariVariableDictionary copyTo) { foreach (var variable in copyFrom) { copyTo.Add(variable.Key, variable.Value); } }
public override int Execute(string[] commandLineArguments) { Options.Parse(commandLineArguments); var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); var variables = new CalamariVariableDictionary(variablesFile, sensitiveVariablesFile, sensitiveVariablesPassword); if (!string.IsNullOrEmpty(packageFile)) { if (!fileSystem.FileExists(packageFile)) { throw new CommandException("Could not find package file: " + packageFile); } } fileSystem.FreeDiskSpaceOverrideInMegaBytes = variables.GetInt32(SpecialVariables.FreeDiskSpaceOverrideInMegaBytes); fileSystem.SkipFreeDiskSpaceCheck = variables.GetFlag(SpecialVariables.SkipFreeDiskSpaceCheck); var substituter = new FileSubstituter(fileSystem); var packageExtractor = new GenericPackageExtractorFactory().createStandardGenericPackageExtractor(); var additionalFileSubstitution = variables.Get(TerraformSpecialVariables.Action.Terraform.FileSubstitution); var runAutomaticFileSubstitution = variables.GetFlag(TerraformSpecialVariables.Action.Terraform.RunAutomaticFileSubstitution, true); var enableNoMatchWarning = variables.Get(SpecialVariables.Package.EnableNoMatchWarning); variables.Add(SpecialVariables.Package.EnableNoMatchWarning, !String.IsNullOrEmpty(enableNoMatchWarning) ? enableNoMatchWarning : (!String.IsNullOrEmpty(additionalFileSubstitution)).ToString()); var conventions = new List <IConvention> { new ContributeEnvironmentVariablesConvention(), new LogVariablesConvention(), new ExtractPackageToStagingDirectoryConvention(packageExtractor, fileSystem).When(_ => packageFile != null), new SubstituteInFilesConvention(fileSystem, substituter, _ => true, _ => FileTargetFactory(runAutomaticFileSubstitution ? DefaultTerraformFileSubstitution : string.Empty, additionalFileSubstitution)), step(fileSystem) }; var deployment = new RunningDeployment(packageFile, variables); var conventionRunner = new ConventionProcessor(deployment, conventions); conventionRunner.RunConventions(); return(0); }