install

package
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:    "install",
	Short:  "Install New Relic.",
	PreRun: client.RequireClient,
	RunE: func(cmd *cobra.Command, args []string) error {
		ic := types.InstallerContext{
			AssumeYes:    assumeYes,
			LocalRecipes: localRecipes,
			RecipeNames:  recipeNames,
			RecipePaths:  recipePaths,
		}

		logLevel := configAPI.GetLogLevel()
		config.InitFileLogger(logLevel)

		err := assertProfileIsValid()
		if err != nil {
			log.Fatal(err)
			return nil
		}

		i := NewRecipeInstaller(ic, client.NRClient)

		if err := i.Install(); err != nil {
			if err == types.ErrInterrupt {
				return nil
			}

			if _, ok := err.(*types.UpdateRequiredError); ok {
				return nil
			}

			if e, ok := err.(*nrErrors.PaymentRequiredError); ok {
				return e
			}

			fallbackErrorMsg := fmt.Sprintf("\nWe encountered an issue during the installation: %s.", err)
			fallbackHelpMsg := "If this problem persists, visit the documentation and support page for additional help here at https://one.newrelic.com/-/06vjAeZLKjP."

			fmt.Println(fallbackErrorMsg)
			fmt.Println(fallbackHelpMsg)
			fmt.Print("\n\n")

			log.Debug(fallbackErrorMsg)
		}

		return nil
	},
}

Command represents the install command.

Functions

func NewPrompter added in v0.43.0

func NewPrompter() *ux.PromptUIPrompter

Types

type AgentValidator added in v0.43.0

type AgentValidator interface {
	Validate(ctx context.Context, url string) (string, error)
}

type BundleInstaller added in v0.43.0

type BundleInstaller struct {
	// contains filtered or unexported fields
}

func NewBundleInstaller added in v0.43.0

func NewBundleInstaller(ctx context.Context, manifest *types.DiscoveryManifest, recipeInstallerInterface RecipeInstaller, statusReporter StatusReporter) *BundleInstaller

func (*BundleInstaller) InstallBundleRecipe added in v0.43.0

func (bi *BundleInstaller) InstallBundleRecipe(bundleRecipe *recipes.BundleRecipe, assumeYes bool) error

func (*BundleInstaller) InstallContinueOnError added in v0.43.0

func (bi *BundleInstaller) InstallContinueOnError(bundle *recipes.Bundle, assumeYes bool)

func (*BundleInstaller) InstallStopOnError added in v0.43.0

func (bi *BundleInstaller) InstallStopOnError(bundle *recipes.Bundle, assumeYes bool) error

func (*BundleInstaller) InstalledRecipesCount added in v0.43.0

func (bi *BundleInstaller) InstalledRecipesCount() int

type BundlerBuilder added in v0.43.0

type BundlerBuilder struct {
	// contains filtered or unexported fields
}

func NewBundlerBuilder added in v0.43.0

func NewBundlerBuilder() *BundlerBuilder

func (*BundlerBuilder) Build added in v0.43.0

func (bb *BundlerBuilder) Build() RecipeBundler

func (*BundlerBuilder) WithAdditionalRecipe added in v0.43.0

func (bb *BundlerBuilder) WithAdditionalRecipe(name string) *BundlerBuilder

func (*BundlerBuilder) WithCoreRecipe added in v0.43.0

func (bb *BundlerBuilder) WithCoreRecipe(name string) *BundlerBuilder

type ConfigValidator added in v0.28.0

type ConfigValidator interface {
	Validate(ctx context.Context) error
}

type Discoverer added in v0.28.0

type Discoverer interface {
	Discover(context.Context) (*types.DiscoveryManifest, error)
}

Discoverer is responsible for discovering information about the host system.

type LicenseKeyFetcher added in v0.20.6

type LicenseKeyFetcher interface {
	FetchLicenseKey(context.Context) (string, error)
}

func NewServiceLicenseKeyFetcher added in v0.20.6

func NewServiceLicenseKeyFetcher(client recipes.NerdGraphClient) LicenseKeyFetcher

type MockBundleInstaller added in v0.43.0

type MockBundleInstaller struct {
	Error error
	// contains filtered or unexported fields
}

func NewMockBundleInstaller added in v0.43.0

func NewMockBundleInstaller() *MockBundleInstaller

func (*MockBundleInstaller) InstallContinueOnError added in v0.43.0

func (mbi *MockBundleInstaller) InstallContinueOnError(bundle *recipes.Bundle, assumeYes bool)

func (*MockBundleInstaller) InstallStopOnError added in v0.43.0

func (mbi *MockBundleInstaller) InstallStopOnError(bundle *recipes.Bundle, assumeYes bool) error

func (*MockBundleInstaller) InstalledRecipesCount added in v0.43.0

func (mbi *MockBundleInstaller) InstalledRecipesCount() int

type MockBundler added in v0.43.0

type MockBundler struct {
	// contains filtered or unexported fields
}

func (*MockBundler) CreateAdditionalGuidedBundle added in v0.43.0

func (mb *MockBundler) CreateAdditionalGuidedBundle() *recipes.Bundle

func (*MockBundler) CreateAdditionalTargetedBundle added in v0.43.0

func (mb *MockBundler) CreateAdditionalTargetedBundle(names []string) *recipes.Bundle

func (*MockBundler) CreateCoreBundle added in v0.43.0

func (mb *MockBundler) CreateCoreBundle() *recipes.Bundle

type MockContext added in v0.43.0

type MockContext struct {
}

func (MockContext) Deadline added in v0.43.0

func (m MockContext) Deadline() (deadline time.Time, ok bool)

func (MockContext) Done added in v0.43.0

func (m MockContext) Done() <-chan struct{}

func (MockContext) Err added in v0.43.0

func (m MockContext) Err() error

func (MockContext) Value added in v0.43.0

func (m MockContext) Value(key interface{}) interface{}

type MockLicenseKeyFetcher added in v0.20.6

type MockLicenseKeyFetcher struct {
	FetchLicenseKeyFunc func(ctx context.Context) (string, error)
}

func NewMockLicenseKeyFetcher added in v0.20.6

func NewMockLicenseKeyFetcher() *MockLicenseKeyFetcher

func (*MockLicenseKeyFetcher) FetchLicenseKey added in v0.20.6

func (f *MockLicenseKeyFetcher) FetchLicenseKey(ctx context.Context) (string, error)

type Prompter added in v0.28.0

type Prompter interface {
	PromptYesNo(msg string) (bool, error)
	MultiSelect(msg string, options []string) ([]string, error)
}

type RecipeBundleInstaller added in v0.43.0

type RecipeBundleInstaller interface {
	InstallStopOnError(bundle *recipes.Bundle, assumeYes bool) error
	InstallContinueOnError(bundle *recipes.Bundle, assumeYes bool)
	InstalledRecipesCount() int
}

type RecipeBundler added in v0.43.0

type RecipeBundler interface {
	CreateCoreBundle() *recipes.Bundle
	CreateAdditionalTargetedBundle(names []string) *recipes.Bundle
	CreateAdditionalGuidedBundle() *recipes.Bundle
}

type RecipeFileFetcher added in v0.28.0

type RecipeFileFetcher interface {
	FetchRecipeFile(recipeURL *url.URL) (*types.OpenInstallationRecipe, error)
	LoadRecipeFile(filename string) (*types.OpenInstallationRecipe, error)
}

type RecipeFilterRunner added in v0.28.0

type RecipeFilterRunner interface {
	RunFilterAll(ctx context.Context, r []types.OpenInstallationRecipe, m *types.DiscoveryManifest) []types.OpenInstallationRecipe
	EnsureDoesNotFilter(ctx context.Context, r []types.OpenInstallationRecipe, m *types.DiscoveryManifest) error
}

type RecipeInstall added in v0.43.0

type RecipeInstall struct {
	types.InstallerContext
	// contains filtered or unexported fields
}

func NewRecipeInstaller

func NewRecipeInstaller(ic types.InstallerContext, nrClient *newrelic.NewRelic) *RecipeInstall

func (*RecipeInstall) Install added in v0.43.0

func (i *RecipeInstall) Install() error

type RecipeInstallBuilder added in v0.43.0

type RecipeInstallBuilder struct {
	// contains filtered or unexported fields
}

func NewRecipeInstallBuilder added in v0.43.0

func NewRecipeInstallBuilder() *RecipeInstallBuilder

func (*RecipeInstallBuilder) Build added in v0.43.0

func (rib *RecipeInstallBuilder) Build() *RecipeInstall

func (*RecipeInstallBuilder) WithAgentValidationError added in v0.43.0

func (rib *RecipeInstallBuilder) WithAgentValidationError(e error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithBundleInstaller added in v0.43.0

func (rib *RecipeInstallBuilder) WithBundleInstaller(bundlerInstaller RecipeBundleInstaller) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithBundler added in v0.43.0

func (rib *RecipeInstallBuilder) WithBundler(bundler RecipeBundler) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithConfigValidatorError added in v0.43.0

func (rib *RecipeInstallBuilder) WithConfigValidatorError(err error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithDiscovererError added in v0.43.0

func (rib *RecipeInstallBuilder) WithDiscovererError(err error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithDiscovererValidatorError added in v0.43.0

func (rib *RecipeInstallBuilder) WithDiscovererValidatorError(err error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithFetchRecipesVal added in v0.49.0

func (rib *RecipeInstallBuilder) WithFetchRecipesVal(fetchRecipesVal []*types.OpenInstallationRecipe) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithLibraryVersion added in v0.43.0

func (rib *RecipeInstallBuilder) WithLibraryVersion(libraryVersion string) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithLicenseKeyFetchResult added in v0.43.0

func (rib *RecipeInstallBuilder) WithLicenseKeyFetchResult(result error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithOutput added in v0.47.0

func (rib *RecipeInstallBuilder) WithOutput(value string) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithProgressIndicator added in v0.43.0

func (rib *RecipeInstallBuilder) WithProgressIndicator(i *ux.SpinnerProgressIndicator) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithRecipeExecutionResult added in v0.43.0

func (rib *RecipeInstallBuilder) WithRecipeExecutionResult(err error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithRecipeValidationError added in v0.43.0

func (rib *RecipeInstallBuilder) WithRecipeValidationError(e error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithRecipeVarValues added in v0.43.0

func (rib *RecipeInstallBuilder) WithRecipeVarValues(vars map[string]string, err error) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithStatusReporter added in v0.43.0

func (rib *RecipeInstallBuilder) WithStatusReporter(statusReporter *execution.MockStatusSubscriber) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithTargetRecipeName added in v0.43.0

func (rib *RecipeInstallBuilder) WithTargetRecipeName(name string) *RecipeInstallBuilder

type RecipeInstallFunc added in v0.28.0

type RecipeInstaller

type RecipeInstaller interface {
	Install() error
	// contains filtered or unexported methods
}

RecipeInstaller wrapper responsible for performing recipe validation, installation, and reporting install status

type RecipeValidator added in v0.28.0

type RecipeValidator interface {
	ValidateRecipe(context.Context, types.DiscoveryManifest, types.OpenInstallationRecipe, types.RecipeVars) (entityGUID string, err error)
}

RecipeValidator validates installation of a recipe.

type RecipeVarPreparer added in v0.28.0

type RecipeVarPreparer interface {
	Prepare(m types.DiscoveryManifest, r types.OpenInstallationRecipe, assumeYes bool, licenseKey string) (types.RecipeVars, error)
}

type ServiceLicenseKeyFetcher added in v0.20.6

type ServiceLicenseKeyFetcher struct {
	LicenseKey string
	// contains filtered or unexported fields
}

relies on the Nerdgraph service

func (*ServiceLicenseKeyFetcher) FetchLicenseKey added in v0.20.6

func (f *ServiceLicenseKeyFetcher) FetchLicenseKey(ctx context.Context) (string, error)

type StatusReporter added in v0.43.0

type StatusReporter interface {
	ReportStatus(status execution.RecipeStatusType, event execution.RecipeStatusEvent)
}

Directories

Path Synopsis
Code generated by tutone: DO NOT EDIT
Code generated by tutone: DO NOT EDIT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL