示例#1
0
        public static InspecJobRunner CreateJobRunner()
        {
            var          commands   = new FileSystemCommandsBoundary();
            var          fileSystem = new FileSystem(new EnvironmentBoundary(), commands);
            const string prefix     = "inspec";
            var          product    = prefix;

            return(new InspecJobRunner(StructureMapResolver.Container.GetInstance <JobRunner>(),
                                       CreateDownloadJob(fileSystem, product, prefix, "2012"),
                                       CreateInstallJob(product, fileSystem, commands, prefix, InstalledProductsFinder.IsInspec)));
        }
示例#2
0
        public static InstallJob CreateInstallJob(string product, FileSystem fileSystem,
                                                  FileSystemCommandsBoundary commands, Func <ProductInstallationMetaData, bool> productMatcher,
                                                  IDownloadUrlResolver downloadUrlResolver)
        {
            var chefProduct = new ChefProduct(product, new InstalledProductsFinder(),
                                              new ProductInstaller(fileSystem, new ProcessExecutor(() => new ProcessBoundary()), commands,
                                                                   $@"{ServerSettings.Instance.InstallRoot}\opscode", downloadUrlResolver),
                                              productMatcher);

            return(CreateInstallJob(chefProduct));
        }
示例#3
0
        private static GenericProductJobRunner CreateJobRunner()
        {
            const string product       = "cafe";
            var          commands      = new FileSystemCommandsBoundary();
            var          fileSystem    = new FileSystem(new EnvironmentBoundary(), commands);
            var          resolver      = new CafeDownloadUrlResolver(FindRuntimeIdentifier(commands));
            var          cafeInstaller = new CafeInstaller(commands, resolver, ServerSettings.Instance.UpdaterDirectory);

            return(new GenericProductJobRunner(StructureMapResolver.Container.GetInstance <JobRunner>(),
                                               InspecController.CreateDownloadJob(fileSystem, product, resolver),
                                               InspecController.CreateInstallJob(cafeInstaller)));
        }
示例#4
0
        private static ChefJobRunner CreateChefJobRunner()
        {
            var          commands   = new FileSystemCommandsBoundary();
            var          fileSystem = new FileSystem(new EnvironmentBoundary(), commands);
            const string prefix     = "chef-client";
            var          product    = "chef";

            return(new ChefJobRunner(StructureMapResolver.Container.GetInstance <JobRunner>(),
                                     InspecController.CreateDownloadJob(fileSystem, product, prefix, "2012r2"),
                                     InspecController.CreateInstallJob(product, fileSystem, commands, prefix, InstalledProductsFinder.IsChefClient),
                                     StructureMapResolver.Container.GetInstance <RunChefJob>()));
        }
示例#5
0
        private static GenericProductJobRunner CreateJobRunner()
        {
            const string prefix = "inspec";
            var          downloadUrlResolver = new ChefDownloadUrlResolver(prefix, prefix, "2012");
            var          productName         = prefix;

            var commands   = new FileSystemCommandsBoundary();
            var fileSystem = new FileSystem(new EnvironmentBoundary(), commands);

            return(new GenericProductJobRunner(StructureMapResolver.Container.GetInstance <JobRunner>(),
                                               CreateDownloadJob(fileSystem, productName, downloadUrlResolver),
                                               CreateInstallJob(productName, fileSystem, commands, InstalledProductsFinder.IsInspec,
                                                                downloadUrlResolver)));
        }
示例#6
0
        private static OptionGroup CreateRunner(IClientFactory clientFactory)
        {
            var schedulerWaiter = new SchedulerWaiter(clientFactory.RestClientForJobServer,
                                                      new AutoResetEventBoundary(), new TimerFactory(),
                                                      new JobRunStatusPresenter(new PresenterMessagePresenter()));
            var processExecutor     = new ProcessExecutor(() => new ProcessBoundary());
            var environment         = new EnvironmentBoundary();
            var fileSystemCommands  = new FileSystemCommandsBoundary();
            var fileSystem          = new FileSystem(environment, fileSystemCommands);
            var serviceStatusWaiter = new ServiceStatusWaiter("waiting for service status",
                                                              new AutoResetEventBoundary(), new TimerFactory(),
                                                              new ServiceStatusProvider(processExecutor, fileSystem));
            // all options available

            var root = CreateRootGroup(clientFactory, schedulerWaiter, fileSystemCommands, processExecutor, fileSystem,
                                       serviceStatusWaiter, environment);

            Logger.Debug("Running application");
            return(root);
        }