From dc8113061d41751578e6b5abcda33073e9081a53 Mon Sep 17 00:00:00 2001 From: Justin Eveland Date: Fri, 19 Feb 2021 12:47:44 -0500 Subject: [PATCH 1/5] chore: move location of start indicator to be earlier in flow --- internal/install/recipe_installer.go | 5 +++-- internal/install/ux/plain_progress_indicator.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/install/recipe_installer.go b/internal/install/recipe_installer.go index 3fee39ce7..846eda482 100644 --- a/internal/install/recipe_installer.go +++ b/internal/install/recipe_installer.go @@ -507,6 +507,9 @@ func (i *RecipeInstaller) executeAndValidate(m *types.DiscoveryManifest, r *type } func (i *RecipeInstaller) executeAndValidateWithProgress(m *types.DiscoveryManifest, r *types.Recipe) (string, error) { + i.progressIndicator.Start(fmt.Sprintf("Installing %s", r.Name)) + defer func() { i.progressIndicator.Stop() }() + if r.PreInstallMessage() != "" { fmt.Println(r.PreInstallMessage()) } @@ -516,8 +519,6 @@ func (i *RecipeInstaller) executeAndValidateWithProgress(m *types.DiscoveryManif return "", err } - i.progressIndicator.Start(fmt.Sprintf("Installing %s", r.Name)) - defer func() { i.progressIndicator.Stop() }() i.status.RecipeInstalling(execution.RecipeStatusEvent{Recipe: *r}) entityGUID, err := i.executeAndValidate(m, r, vars) diff --git a/internal/install/ux/plain_progress_indicator.go b/internal/install/ux/plain_progress_indicator.go index 7e0b7118f..96f9a74b5 100644 --- a/internal/install/ux/plain_progress_indicator.go +++ b/internal/install/ux/plain_progress_indicator.go @@ -22,7 +22,7 @@ func (p *PlainProgress) Start(msg string) { x := color.New(color.Bold) x.Printf(" %s", msg) - fmt.Printf("... ") + fmt.Printf("...\n") } func (p *PlainProgress) Success() { From f2631cadac5079988e14b747cca9312cec111d0a Mon Sep 17 00:00:00 2001 From: Justin Eveland Date: Fri, 19 Feb 2021 12:50:00 -0500 Subject: [PATCH 2/5] fix: add PreInstall to the output Recipe --- internal/install/recipes/service_recipe_fetcher.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/install/recipes/service_recipe_fetcher.go b/internal/install/recipes/service_recipe_fetcher.go index 0cbb39c1d..38844ddaf 100644 --- a/internal/install/recipes/service_recipe_fetcher.go +++ b/internal/install/recipes/service_recipe_fetcher.go @@ -249,6 +249,7 @@ func createRecipe(result types.OpenInstallationRecipe) types.Recipe { ProcessMatch: result.ProcessMatch, Repository: result.Repository, ValidationNRQL: string(result.ValidationNRQL), + PreInstall: result.PreInstall, } } From 439644832058cd559522d195b63f5d5839878864 Mon Sep 17 00:00:00 2001 From: Justin Eveland Date: Fri, 19 Feb 2021 14:53:43 -0500 Subject: [PATCH 3/5] fix: simplify to use OpenInstallationPreInstallConfiguration from types package --- internal/install/recipes/recipe_file.go | 59 +++++++++---------------- internal/install/scenario_builder.go | 2 +- internal/install/types/recipe.go | 43 ++++++------------ 3 files changed, 36 insertions(+), 68 deletions(-) diff --git a/internal/install/recipes/recipe_file.go b/internal/install/recipes/recipe_file.go index 2b5454b33..a94dde51a 100644 --- a/internal/install/recipes/recipe_file.go +++ b/internal/install/recipes/recipe_file.go @@ -12,29 +12,19 @@ import ( // RecipeFile represents a recipe file as defined in the Open Installation Library. type RecipeFile struct { - Description string `yaml:"description"` - InputVars []VariableConfig `yaml:"inputVars"` - Install map[string]interface{} `yaml:"install"` - InstallTargets []RecipeInstallTarget `yaml:"installTargets"` - Keywords []string `yaml:"keywords"` - LogMatch []types.LogMatch `yaml:"logMatch"` - Name string `yaml:"name"` - DisplayName string `yaml:"displayName"` - PreInstall RecipePreInstall `yaml:"preInstall"` - PostInstall RecipePostInstall `yaml:"postInstall"` - ProcessMatch []string `yaml:"processMatch"` - Repository string `yaml:"repository"` - ValidationNRQL string `yaml:"validationNrql"` -} - -type RecipePreInstall struct { - Info string `yaml:"info"` - Prompt string `yaml:"prompt"` -} - -type RecipePostInstall struct { - Info string `yaml:"info"` - Prompt string `yaml:"prompt"` + Description string `yaml:"description"` + InputVars []VariableConfig `yaml:"inputVars"` + Install map[string]interface{} `yaml:"install"` + InstallTargets []RecipeInstallTarget `yaml:"installTargets"` + Keywords []string `yaml:"keywords"` + LogMatch []types.LogMatch `yaml:"logMatch"` + Name string `yaml:"name"` + DisplayName string `yaml:"displayName"` + PreInstall types.OpenInstallationPreInstallConfiguration `yaml:"preInstall"` + PostInstall types.RecipePostInstall `yaml:"postInstall"` + ProcessMatch []string `yaml:"processMatch"` + Repository string `yaml:"repository"` + ValidationNRQL string `yaml:"validationNrql"` } type VariableConfig struct { @@ -128,22 +118,15 @@ func (f *RecipeFile) ToRecipe() (*types.Recipe, error) { if err != nil { return nil, err } - r := types.Recipe{ - File: fileStr, - Name: f.Name, - DisplayName: f.DisplayName, - Description: f.Description, - Repository: f.Repository, - Keywords: f.Keywords, - PreInstall: types.RecipePreInstall{ - Info: f.PreInstall.Info, - Prompt: f.PreInstall.Prompt, - }, - PostInstall: types.RecipePostInstall{ - Info: f.PostInstall.Info, - Prompt: f.PostInstall.Prompt, - }, + File: fileStr, + Name: f.Name, + DisplayName: f.DisplayName, + Description: f.Description, + Repository: f.Repository, + Keywords: f.Keywords, + PreInstall: f.PreInstall, + PostInstall: f.PostInstall, ProcessMatch: f.ProcessMatch, LogMatch: f.LogMatch, ValidationNRQL: f.ValidationNRQL, diff --git a/internal/install/scenario_builder.go b/internal/install/scenario_builder.go index ff325fe3a..78c921cf9 100644 --- a/internal/install/scenario_builder.go +++ b/internal/install/scenario_builder.go @@ -179,7 +179,7 @@ func setupRecipeFetcher() recipes.RecipeFetcher { f.FetchRecipeVals = []types.Recipe{ { Name: "Infrastructure Agent Installer", - PreInstall: types.RecipePreInstall{ + PreInstall: types.OpenInstallationPreInstallConfiguration{ Info: ` This is the Infrastructure Agent Installer preinstall message. It is made up of a multi line string. diff --git a/internal/install/types/recipe.go b/internal/install/types/recipe.go index 4e33fb09d..ccdab978f 100644 --- a/internal/install/types/recipe.go +++ b/internal/install/types/recipe.go @@ -1,32 +1,25 @@ package types type Recipe struct { - ID string `json:"id"` - Description string `json:"description"` - DisplayName string `json:"displayName"` - File string `json:"file"` - InstallTargets []OpenInstallationRecipeInstallTarget `json:"installTargets"` - Keywords []string `json:"keywords"` - LogMatch []LogMatch `json:"logMatch"` - Name string `json:"name"` - PreInstall RecipePreInstall `json:"preInstall"` - PostInstall RecipePostInstall `json:"postInstall"` - ProcessMatch []string `json:"processMatch"` - Repository string `json:"repository"` - ValidationNRQL string `json:"validationNrql"` + ID string `json:"id"` + Description string `json:"description"` + DisplayName string `json:"displayName"` + File string `json:"file"` + InstallTargets []OpenInstallationRecipeInstallTarget `json:"installTargets"` + Keywords []string `json:"keywords"` + LogMatch []LogMatch `json:"logMatch"` + Name string `json:"name"` + PreInstall OpenInstallationPreInstallConfiguration `json:"preInstall"` + PostInstall RecipePostInstall `json:"postInstall"` + ProcessMatch []string `json:"processMatch"` + Repository string `json:"repository"` + ValidationNRQL string `json:"validationNrql"` Vars map[string]interface{} } -// RecipePreInstall represents the information used prior to recipe execution. -type RecipePreInstall struct { - Info string `yaml:"info"` - Prompt string `yaml:"prompt"` -} - // RecipePostInstall represents the information used after recipe execution has completed. type RecipePostInstall struct { - Info string `yaml:"info"` - Prompt string `yaml:"prompt"` + Info string `yaml:"info"` } func (r *Recipe) PostInstallMessage() string { @@ -34,10 +27,6 @@ func (r *Recipe) PostInstallMessage() string { return r.PostInstall.Info } - if r.PostInstall.Prompt != "" { - return r.PostInstall.Prompt - } - return "" } @@ -46,10 +35,6 @@ func (r *Recipe) PreInstallMessage() string { return r.PreInstall.Info } - if r.PreInstall.Prompt != "" { - return r.PreInstall.Prompt - } - return "" } From 1d30331c4a0529cb667414e67dcd850005862836 Mon Sep 17 00:00:00 2001 From: Justin Eveland Date: Fri, 19 Feb 2021 14:55:01 -0500 Subject: [PATCH 4/5] chore: update to match latest from NerdGraph --- internal/install/types/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/install/types/types.go b/internal/install/types/types.go index a623c6a12..6b28b99e4 100644 --- a/internal/install/types/types.go +++ b/internal/install/types/types.go @@ -125,6 +125,8 @@ type OpenInstallationLogMatch struct { type OpenInstallationPreInstallConfiguration struct { // Message/Docs notice displayed to user prior to running recipe Prompt string `json:"prompt,omitempty"` + // Message/Docs notice displayed to user prior to running recipe + Info string `json:"info,omitempty"` } // OpenInstallationRecipe - Installation instructions and definition of an instrumentation integration From 83ea4f3d9cd97c253b8ce9922736af70ace3a27b Mon Sep 17 00:00:00 2001 From: Justin Eveland Date: Fri, 19 Feb 2021 15:02:15 -0500 Subject: [PATCH 5/5] fix: update mock names --- internal/install/scenario_builder.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/install/scenario_builder.go b/internal/install/scenario_builder.go index 843f5f330..b9a8c7e74 100644 --- a/internal/install/scenario_builder.go +++ b/internal/install/scenario_builder.go @@ -217,7 +217,8 @@ func setupRecipeFetcherGuidedInstall() recipes.RecipeFetcher { f := recipes.NewMockRecipeFetcher() f.FetchRecipeVals = []types.Recipe{ { - Name: "Infrastructure Agent Installer", + Name: "infrastructure-agent-installer", + DisplayName: "Infrastructure Agent", PreInstall: types.OpenInstallationPreInstallConfiguration{ Info: ` This is the Infrastructure Agent Installer preinstall message.