Skip to content

Commit f404d73

Browse files
committed
fix: return non 0 with unsuported recipe
1 parent 16bdb66 commit f404d73

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

internal/install/command.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,19 @@ var Command = &cobra.Command{
108108
return nil
109109
}
110110

111-
if e, ok := err.(*nrErrors.PaymentRequiredError); ok {
112-
return e
111+
if err, ok := err.(*nrErrors.PaymentRequiredError); ok {
112+
return err
113113
}
114114

115115
if errors.Is(err, types.ErrAgentControl) {
116116
return err
117117
}
118118

119+
// For targeted installs, return the error to ensure non-zero exit code
120+
if len(extractedRecipeNames) > 0 {
121+
return err
122+
}
123+
119124
if i.shouldInstallCore() {
120125
fallbackErrorMsg := fmt.Sprintf("\nWe encountered an issue during the installation: %s.", err)
121126
fallbackHelpMsg := "If this problem persists, visit the documentation and support page for additional help here at https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/get-started/requirements-infrastructure-agent/"

0 commit comments

Comments
 (0)