install

package
v0.60.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 26 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,
		}
		ic.SetTags(tags)

		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://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/get-started/requirements-infrastructure-agent/"

			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 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 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 MockRecipeDetector added in v0.49.11

type MockRecipeDetector struct {
	Err error
	// contains filtered or unexported fields
}

func (*MockRecipeDetector) AddRecipeDetectionResult added in v0.49.11

func (mrd *MockRecipeDetector) AddRecipeDetectionResult(detectionResult *recipes.RecipeDetectionResult)

func (*MockRecipeDetector) GetDetectedRecipes added in v0.49.11

type ProcessEvaluator added in v0.51.0

type ProcessEvaluator interface {
	GetOrLoadProcesses(ctx context.Context) []types.GenericProcess
	DetectionStatus(ctx context.Context, r *types.OpenInstallationRecipe) execution.RecipeStatusType
}

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 RecipeDetectionResult added in v0.49.11

type RecipeDetectionResult struct {
	Recipe     *types.OpenInstallationRecipe
	Status     execution.RecipeStatusType
	DurationMs int64
}

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) 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) WithRecipeDetectionResult added in v0.49.11

func (rib *RecipeInstallBuilder) WithRecipeDetectionResult(detectionResult *recipes.RecipeDetectionResult) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithRecipeExecutionError added in v0.49.11

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

func (*RecipeInstallBuilder) WithRecipeLogForwarder added in v0.58.0

func (rib *RecipeInstallBuilder) WithRecipeLogForwarder(optIn bool) *RecipeInstallBuilder

func (*RecipeInstallBuilder) WithRecipeOutput added in v0.57.0

func (rib *RecipeInstallBuilder) WithRecipeOutput(value []string) *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) WithRunningProcess added in v0.51.0

func (rib *RecipeInstallBuilder) WithRunningProcess(cmd string, name string) *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 RecipeStatusDetector added in v0.49.11

type RecipeStatusDetector interface {
	GetDetectedRecipes() (recipes.RecipeDetectionResults, recipes.RecipeDetectionResults, error)
}

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