protected override void ProcessRecord() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => Assembly.Load(AssemblyResolver.ResolveAssembly(args)); ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); // ChefConfig.apiLog = false; // Default -Version to _latest if (Version == null) { Version = "_latest"; } Cookbook cookbook = new Cookbook(); ReturnType rt = cookbook.Download(Name, Version); if (rt.Result == 0) { Logger.log("ok", "Added cookbook: " + Name + "[" + Version + "] to cookbook path."); } else { Logger.log("error", rt.Message); Logger.log("error", "There is an error adding cookbook: " + Name + "[" + Version + "]."); Terminate(rt.Message); } }
public static void ConfigureApiClient() { ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); Logger.log("ok", "API Client is configured."); }
protected override void ProcessRecord() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => Assembly.Load(AssemblyResolver.ResolveAssembly(args)); ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); // Disable API log to console ChefConfig.ApiLog = false; // Start Sprint ExecuteSprint(); }
/// <summary> /// Main Processing function of the CmdLet /// </summary> protected override void ProcessRecord() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => Assembly.Load(AssemblyResolver.ResolveAssembly(args)); ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); // 01. Testing BuildRunList method // BuildRunList(); // 02. Testing Compilation TestCompile(); }
/// <summary> /// Loads configuration from HKLM\Software\Blu\Config /// Updates settings tab with this data /// </summary> private void LoadConfig() { ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); txtClientName.Text = ChefConfig.ClientName; txtClientPath.Text = ChefConfig.ClientPath; txtClientPem.Text = ChefConfig.ClientPem; txtNodeName.Text = ChefConfig.NodeName; txtOrganization.Text = ChefConfig.Organization; txtOrganizationUri.Text = ChefConfig.OrganizationUri.ToString(); txtValidationKey.Text = ChefConfig.ValidationKey; txtValidator.Text = ChefConfig.Validator; }
/// <summary> /// Main Processing function of the CmdLet /// </summary> protected override void ProcessRecord() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => Assembly.Load(AssemblyResolver.ResolveAssembly(args)); ChefConfigurator chefConfigurator = new ChefConfigurator(); ReturnType rt = chefConfigurator.LoadConfig(); if (rt.Result == 0) { // Configuration is loaded from registry, try to connect Connect(); } else { ProcessConfiguration(); } }
protected override void ProcessRecord() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => Assembly.Load(AssemblyResolver.ResolveAssembly(args)); ChefConfigurator chefConfigurator = new ChefConfigurator(); chefConfigurator.LoadConfig(); // Disable API log to console // ChefConfig.apiLog = false; // Default values for Node, Path and Format parameters if (Select == null) { if (string.IsNullOrEmpty(ChefConfig.NodeName)) { Select = "nodes/" + ChefConfig.NodeName; } else { Select = "nodes"; } } else { // Trim the first / from -Endpoint Select = Select.TrimStart('/'); } if (Format == null) { Format = "DICTIONARY"; } if (Path == null) { Path = "/"; } ReturnType rt = ChefEndpoint.Get(Select, Path); if (rt.Result == 0) { // Determine if data is encrypted string key = String.Empty; if (Secret != null) { Format = "SECRET"; key = Secret; } else if (SecretFile != null) { Format = "SECRET"; key = File.ReadAllText(ChefConfig.Root + "\\" + SecretFile); } switch (Format.ToUpper()) { case "JSON": WriteObject(rt.Data); break; case "DICTIONARY": WriteObject(rt.Object); break; default: Logger.log("error", "Output format is not recognized. Accepted values are 'Json', 'Dictionary'"); Terminate("Unrecognized Format"); break; } } else { Terminate(rt.Message); } }