public string Run()
        {
            var factory = ClientEntraceFactory.GetClientEntrance(new RPCClientTokenProvider());

            LogLevelService.SetVerboseOn();

            IFsRPCBase fsDemoRPC = factory.GetRPCClient("itest");
            var        result    = fsDemoRPC.RunOnNode("rwsam16", "time=11111", 3);

            if (this.Update)
            {
                fsDemoRPC.UpdateServiceCred(this.Node);
                fsDemoRPC.UpdateServiceBinary(this.Node);
                return("Update Completes");
            }
            else
            {
                //example for reboot continue, just an example, you should build your own criteria for reboot-continue
                if (this.ConfigFile.Contains("12345"))
                {
                    result = fsDemoRPC.RunAfterRebootOnNode(this.Node, File.ReadAllText(this.ConfigFile));
                    return(result.output);
                }
                else
                {
                    result = fsDemoRPC.RunOnNode(this.Node, File.ReadAllText(this.ConfigFile));
                    return(result.output);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //ParserResult<EntraceOption> item = Parser.Default.ParseArguments<EntraceOption>(args);
            //item.WithParsed<EntraceOption>(opts => ProcessOption(opts, args));
            var factory = ClientEntraceFactory.GetClientEntrance(new RPCClientTokenProvider());

            LogLevelService.SetVerboseOn();

            IFsRPCBase fsDemoRPC = factory.GetRPCClient("itest");
            var        result    = fsDemoRPC.RunOnNode("rwsam16", "time=11111", 3);

            Console.WriteLine(result);
            Console.ReadLine();
        }
Exemplo n.º 3
0
 public FileProcessingHost(RPCServerRegistry serviceDescriptors)
 {
     builder = new HostBuilder();
     this.builder.UseServiceProviderFactory <IServiceCollection>(new LamarServiceProviderFactory())
     .ConfigureHostConfiguration((IConfigurationBuilder configHost) =>
     {
         configHost.SetBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
         configHost.AddJsonFile("HostConfig.json", false, true);//set the HostingEnvironment using JsonFile will read any value provided in json
     })
     .ConfigureContainer((HostBuilderContext hostContext, ServiceRegistry services) =>
     {
         OrchConfig config = hostContext.Configuration.GetSection("OrchConfig").Get <OrchConfig>();
         if (!string.IsNullOrEmpty(config.LogLevel) && config.LogLevel.Equals("debug"))
         {
             LogLevelService.SetVerboseOn();
         }
         services.AddRange(serviceDescriptors);
     })
     .ConfigureServices((HostBuilderContext hostContext, IServiceCollection configSvc) =>
     {
         //if (hostContext.HostingEnvironment.IsDevelopment())
         //{
         //    Console.WriteLine("Development mode");
         //}
         //else
         //{
         //    Console.WriteLine("Production mode");
         //}
         configSvc.AddLogging();
         configSvc.AddHostedService <FsBaseGenericHost>();
     });
     //.ConfigureAppConfiguration((HostBuilderContext hostContext, IConfigurationBuilder configApp) =>
     //{
     //    configApp.SetBasePath(Path.Combine(hostBaseDir, "config"));
     //    configApp.AddJsonFile($@"fs.{hostContext.HostingEnvironment.EnvironmentName}.json".ToLower(), false, true);
     //})
 }