public override int Execute(string[] commandLineArguments) { Options.Parse(commandLineArguments); var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); var variables = new CalamariVariableDictionary(variablesFile, sensitiveVariablesFile, sensitiveVariablesPassword); var packageFile = variables.GetEvironmentExpandedPath(SpecialVariables.Tentacle.CurrentDeployment.PackageFilePath); if (string.IsNullOrEmpty(packageFile)) { throw new CommandException($"No package file was specified. Please provide `{SpecialVariables.Tentacle.CurrentDeployment.PackageFilePath}` variable"); } 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 commandLineRunner = new CommandLineRunner(new SplitCommandOutput(new ConsoleCommandOutput(), new ServiceMessageCommandOutput(variables))); var journal = new DeploymentJournal(fileSystem, SemaphoreFactory.Get(), variables); var conventions = new List <IConvention> { new ContributeEnvironmentVariablesConvention(), new ContributePreviousInstallationConvention(journal), new ContributePreviousSuccessfulInstallationConvention(journal), new LogVariablesConvention(), new AlreadyInstalledConvention(journal), new TransferPackageConvention(fileSystem), new RollbackScriptConvention(DeploymentStages.DeployFailed, fileSystem, new CombinedScriptEngine(), commandLineRunner), }; var deployment = new RunningDeployment(packageFile, variables); var conventionRunner = new ConventionProcessor(deployment, conventions); try { conventionRunner.RunConventions(); if (!deployment.SkipJournal) { journal.AddJournalEntry(new JournalEntry(deployment, true)); } } catch (Exception) { if (!deployment.SkipJournal) { journal.AddJournalEntry(new JournalEntry(deployment, false)); } throw; } return(0); }