Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow chef to be installed in nonstandard location #10

Merged
merged 1 commit into from
Mar 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cafe/Chef/ChefInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ public class ProductInstaller : IProductInstaller
private readonly IFileSystem _fileSystem;
private readonly IFileSystemCommands _commands;
private readonly string _prefix;
private readonly string _installLocation;
private readonly ProcessExecutor _processExecutor;

public ProductInstaller(IFileSystem fileSystem, ProcessExecutor processExecutor, IFileSystemCommands commands, string prefix)
public ProductInstaller(IFileSystem fileSystem, ProcessExecutor processExecutor, IFileSystemCommands commands, string prefix, string installLocation)
{
_fileSystem = fileSystem;
_processExecutor = processExecutor;
_commands = commands;
_prefix = prefix;
_installLocation = installLocation;
}

public Result Uninstall(string productCode)
Expand All @@ -47,7 +49,7 @@ public Result Install(string version)
}
Logger.Debug($"Installing installer {fullPathToStagedInstaller}");
var msiexec = FindFullPathToMsiExec();
var result = _processExecutor.ExecuteAndWaitForExit(msiexec, $"/qn /L*V \"logs/installation.log\" /i \"{fullPathToStagedInstaller}\"",
var result = _processExecutor.ExecuteAndWaitForExit(msiexec, $"/qn /L*V \"logs/installation.log\" /i \"{fullPathToStagedInstaller}\" INSTALLLOCATION={_installLocation}",
LogInformation, LogError);
Logger.Debug($"Result of installing {fullPathToStagedInstaller} is {result}");
return result;
Expand Down
2 changes: 1 addition & 1 deletion src/cafe/Server/Controllers/InspecController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static InspecJobRunner CreateJobRunner()
public static InstallJob CreateInstallJob(string product, FileSystem fileSystem, FileSystemCommandsBoundary commands, string prefix, Func<ProductInstallationMetaData, bool> productMatcher)
{
var chefProduct = new ChefProduct(product, new InstalledProductsFinder(),
new ProductInstaller(fileSystem, new ProcessExecutor(() => new ProcessBoundary()), commands, prefix),
new ProductInstaller(fileSystem, new ProcessExecutor(() => new ProcessBoundary()), commands, prefix, $@"{ServerSettings.Instance.InstallRoot}\opscode"),
productMatcher);
return new InstallJob(chefProduct, SystemClock.Instance);
}
Expand Down
1 change: 1 addition & 0 deletions src/cafe/ServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class ServerSettings
{
public int ChefInterval { get; set; }
public int Port { get; set; } = DefaultPort;
public string InstallRoot { get; set; } = @"C:";

public const int DefaultPort = 59320;

Expand Down
3 changes: 2 additions & 1 deletion src/cafe/server.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ChefInterval": 0,
"Port": 59320
"Port": 59320,
"InstallRoot": "C:"
}