@@ -81,65 +81,63 @@ func (r TerminalStatusReporter) InstallStarted(status *InstallStatus) error {
8181}
8282
8383func (r TerminalStatusReporter ) InstallComplete (status * InstallStatus ) error {
84- hasStatuses := len (status .Statuses ) > 0
85- if hasStatuses {
86- hasInstalledRecipes := status . hasAnyRecipeStatus ( RecipeStatusTypes . INSTALLED )
84+ if len (status .Statuses ) == 0 {
85+ return nil
86+ }
8787
88- if hasInstalledRecipes {
89- fmt .Print ("\n New Relic installation complete \n \n " )
90- }
88+ hasInstalled := status .hasAnyRecipeStatus (RecipeStatusTypes .INSTALLED )
89+ hasFailures := status .hasAnyRecipeStatus (RecipeStatusTypes .FAILED ) || status .hasAnyRecipeStatus (RecipeStatusTypes .UNSUPPORTED )
90+ isAgentControl := r .isAgentControlInstalled (status )
91+ isAgentControlAttempt := r .isOnlyAgentControlAttempt (status )
9192
92- fmt .Println (" --------------------" )
93- fmt .Println (" Installation Summary" )
94- fmt .Println ("" )
95- r .printInstallationSummary (os .Stdout , status )
96-
97- // Check if only agent-control recipes were installed (successfully)
98- isOnlyAgentControl := r .isOnlyAgentControlInstallation (status )
99- // Check if all recipes attempted (regardless of status) are agent-control
100- isOnlyAgentControlAttempt := r .isOnlyAgentControlAttempt (status )
101-
102- msg := "View your data at the link below:\n "
103- followInstructionsMsg := "Follow the instructions at the URL below to complete the installation process."
104- if hasInstalledRecipes && (status .hasAnyRecipeStatus (RecipeStatusTypes .FAILED ) || status .hasAnyRecipeStatus (RecipeStatusTypes .UNSUPPORTED )) {
105- msg = fmt .Sprintf ("Installation was successful overall, however, one or more installations could not be completed.\n %s \n \n " , followInstructionsMsg )
106- } else if ! hasInstalledRecipes {
107- msg = fmt .Sprintf ("Installation incomplete. %s \n \n " , followInstructionsMsg )
108- }
93+ if hasInstalled {
94+ fmt .Print ("\n New Relic installation complete \n \n " )
95+ }
96+
97+ fmt .Println (" --------------------" )
98+ fmt .Println (" What's next?" )
99+ r .printInstallationSummary (os .Stdout , status )
109100
110- // Generate redirect link only when needed (not for agent-control only installations)
111- linkToData := ""
112- if status .PlatformLinkGenerator != nil && ! isOnlyAgentControl && ! isOnlyAgentControlAttempt {
113- linkToData = status .PlatformLinkGenerator .GenerateRedirectURL (* status )
101+ var msg , link string
102+ dataLink := ""
103+ if status .PlatformLinkGenerator != nil && ! isAgentControl && ! isAgentControlAttempt {
104+ dataLink = status .PlatformLinkGenerator .GenerateRedirectURL (* status )
105+ }
106+
107+ switch {
108+ case isAgentControl :
109+ msg = "Learn about configuring your agent and fleet:"
110+ if status .PlatformLinkGenerator != nil {
111+ link = status .PlatformLinkGenerator .GenerateFleetConfigurationDocLink ()
114112 }
115113
116- // For incomplete installations: show message with appropriate link
117- if ! hasInstalledRecipes {
118- if isOnlyAgentControlAttempt && status .PlatformLinkGenerator != nil {
119- // Agent-control incomplete installation: use documentation link
120- agentControlDocLink := status .PlatformLinkGenerator .GenerateGuidedInstallDocLink ()
121- fmt .Printf ("\n %s" , msg )
122- fmt .Printf (" %s %s" , color .GreenString (ux .IconArrowRight ), agentControlDocLink )
123- } else if linkToData != "" {
124- // Non-agent-control incomplete installation: use regular link
125- fmt .Printf ("\n %s" , msg )
126- fmt .Printf (" %s %s" , color .GreenString (ux .IconArrowRight ), linkToData )
127- }
128- } else if linkToData != "" && ! isOnlyAgentControl {
129- // Successful installation (not agent-control only): show "View your data" link
130- fmt .Printf ("\n %s" , msg )
131- fmt .Printf (" %s %s" , color .GreenString (ux .IconArrowRight ), linkToData )
114+ case ! hasInstalled :
115+ msg = "The installation is incomplete. Follow the instructions at the URL below to complete the installation process."
116+ if isAgentControlAttempt && status .PlatformLinkGenerator != nil {
117+ link = status .PlatformLinkGenerator .GenerateGuidedInstallDocLink ()
118+ } else {
119+ link = dataLink
132120 }
133121
134- r .printLoggingLink (status )
122+ case hasFailures :
123+ msg = "Installation was successful overall, however, one or more installations could not be completed.\n Follow the instructions at the URL below to complete the installation process."
124+ link = dataLink
135125
136- r .printFleetLink (status )
126+ default :
127+ msg = "View your data at the link below:"
128+ link = dataLink
129+ }
137130
138- fmt . Println ()
139- fmt .Println ("\n --------------------" )
140- fmt .Println ( )
131+ if link != "" {
132+ fmt .Printf ("\n %s \n " , msg )
133+ fmt .Printf ( " %s %s \n " , color . GreenString ( ux . IconArrowRight ), link )
141134 }
142135
136+ r .printLoggingLink (status )
137+ r .printFleetLink (status )
138+
139+ fmt .Printf ("\n --------------------\n \n " )
140+
143141 return nil
144142}
145143
@@ -167,11 +165,11 @@ func (r TerminalStatusReporter) UpdateRequired(status *InstallStatus) error {
167165
168166func (r TerminalStatusReporter ) printFleetLink (status * InstallStatus ) {
169167 linkToFleet := ""
170- fleetMsg := "View your fleet at the link below :\n "
168+ fleetMsg := "Check out your agent in our Fleet Control UI :\n "
171169 statuses := r .getRecipesStatusesForInstallationSummary (status )
172170
173171 for _ , s := range statuses {
174- isAgentControlRecipe := s .Name == types .AgentControlRecipeName || s . Name == types . LoggingAgentControlRecipeName
172+ isAgentControlRecipe := s .Name == types .AgentControlRecipeName
175173
176174 if s .Status == RecipeStatusTypes .INSTALLED && isAgentControlRecipe {
177175 // Use NR_CLI_FLEET_ID environment variable if available, otherwise fall back to entity GUID
@@ -197,22 +195,20 @@ func (r TerminalStatusReporter) printFleetLink(status *InstallStatus) {
197195 }
198196}
199197
200- func (r TerminalStatusReporter ) isOnlyAgentControlInstallation (status * InstallStatus ) bool {
198+ func (r TerminalStatusReporter ) isAgentControlInstalled (status * InstallStatus ) bool {
201199 statuses := r .getRecipesStatusesForInstallationSummary (status )
202- hasInstalledRecipes := false
203- hasNonAgentControlRecipes := false
200+ isAgentControlRecipeInstalled := false
204201
205202 for _ , s := range statuses {
206203 if s .Status == RecipeStatusTypes .INSTALLED {
207- hasInstalledRecipes = true
208- isAgentControlRecipe := s .Name == types .AgentControlRecipeName || s .Name == types .LoggingAgentControlRecipeName
209- if ! isAgentControlRecipe {
210- hasNonAgentControlRecipes = true
204+ isAgentControlRecipe := s .Name == types .AgentControlRecipeName
205+ if isAgentControlRecipe {
206+ isAgentControlRecipeInstalled = true
211207 break
212208 }
213209 }
214210 }
215- return hasInstalledRecipes && ! hasNonAgentControlRecipes
211+ return isAgentControlRecipeInstalled
216212}
217213
218214func (r TerminalStatusReporter ) isOnlyAgentControlAttempt (status * InstallStatus ) bool {
@@ -222,7 +218,7 @@ func (r TerminalStatusReporter) isOnlyAgentControlAttempt(status *InstallStatus)
222218 }
223219
224220 for _ , s := range statuses {
225- isAgentControlRecipe := s .Name == types .AgentControlRecipeName || s . Name == types . LoggingAgentControlRecipeName
221+ isAgentControlRecipe := s .Name == types .AgentControlRecipeName
226222 if ! isAgentControlRecipe {
227223 return false
228224 }
0 commit comments