install

package
v0.29.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 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.",
	Run: func(cmd *cobra.Command, args []string) {
		ic := types.InstallerContext{
			AssumeYes:          assumeYes,
			LocalRecipes:       localRecipes,
			RecipeNames:        recipeNames,
			RecipePaths:        recipePaths,
			SkipIntegrations:   skipIntegrations,
			SkipLoggingInstall: skipLoggingInstall,
			SkipApm:            skipApm,
			SkipInfraInstall:   skipInfra,
		}

		config.InitFileLogger()

		client.WithClientAndProfile(func(nrClient *newrelic.NewRelic, profile *credentials.Profile) {
			if trace {
				log.SetLevel(log.TraceLevel)
				nrClient.SetLogLevel("trace")
			} else if debug {
				log.SetLevel(log.DebugLevel)
				nrClient.SetLogLevel("debug")
			}

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

			i := NewRecipeInstaller(ic, nrClient)

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

				log.Fatalf("We encountered an error during the installation: %s. If this problem persists please visit the documentation and support page for additional help here: https://one.newrelic.com/-/06vjAeZLKjP", err)
			}
		})
	},
}

Command represents the install command.

View Source
var TestCommand = &cobra.Command{
	Use:    "installTest",
	Short:  "Run a UX test of the install command.",
	Hidden: true,
	Run: func(cmd *cobra.Command, args []string) {
		ic := types.InstallerContext{
			RecipePaths:        recipePaths,
			RecipeNames:        recipeNames,
			SkipIntegrations:   skipIntegrations,
			SkipLoggingInstall: skipLoggingInstall,
			SkipApm:            skipApm,
			AssumeYes:          assumeYes,
		}

		b := NewScenarioBuilder(ic)
		i := b.BuildScenario(TestScenario(testScenario))

		if i == nil {
			log.Fatalf("Scenario %s is not valid.  Valid values are %s", testScenario, strings.Join(TestScenarioValues(), ","))
		}

		if trace {
			log.SetLevel(log.TraceLevel)
		} else if debug {
			log.SetLevel(log.DebugLevel)
		}

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

			log.Fatalf("test failed: %s", err)
		}
	},
}

TestCommand represents the test command for the install command.

View Source
var (
	TestScenarios = []TestScenario{
		Basic,
		Fail,
	}
)

Functions

func TestScenarioValues

func TestScenarioValues() []string

Types

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 informataion about the host system.

type FileFilterer added in v0.28.0

type FileFilterer interface {
	Filter(context.Context, []types.OpenInstallationRecipe) ([]types.OpenInstallationLogMatch, error)
}

FileFilterer determines the existence of files on the underlying filesystem.

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 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 PacksFetcher added in v0.29.0

type PacksFetcher interface {
	FetchPacks(context.Context, []types.OpenInstallationRecipe) ([]types.OpenInstallationObservabilityPack, error)
}

type PacksInstaller added in v0.29.0

type PacksInstaller interface {
	Install(ctx context.Context, packs []types.OpenInstallationObservabilityPack) error
}

type Prompter added in v0.28.0

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

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 RecipeInstallFunc added in v0.28.0

type RecipeInstaller

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

func NewRecipeInstaller

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

func (*RecipeInstaller) Install

func (i *RecipeInstaller) Install() error

type RecipeRepository added in v0.28.0

type RecipeRepository interface {
	FindAll(m types.DiscoveryManifest) []types.OpenInstallationRecipe
}

type RecipeValidator added in v0.28.0

type RecipeValidator interface {
	ValidateRecipe(context.Context, types.DiscoveryManifest, types.OpenInstallationRecipe) (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 ScenarioBuilder

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

func NewScenarioBuilder

func NewScenarioBuilder(ic types.InstallerContext) *ScenarioBuilder

func (*ScenarioBuilder) Basic

func (b *ScenarioBuilder) Basic() *RecipeInstaller

func (*ScenarioBuilder) BuildScenario

func (b *ScenarioBuilder) BuildScenario(s TestScenario) *RecipeInstaller

func (*ScenarioBuilder) ExecDiscovery added in v0.28.0

func (b *ScenarioBuilder) ExecDiscovery() *RecipeInstaller

func (*ScenarioBuilder) Fail added in v0.18.11

func (b *ScenarioBuilder) Fail() *RecipeInstaller

type ServiceLicenseKeyFetcher added in v0.20.6

type ServiceLicenseKeyFetcher struct {
	// 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 TestScenario

type TestScenario string
const (
	Basic         TestScenario = "BASIC"
	Fail          TestScenario = "FAIL"
	ExecDiscovery TestScenario = "EXEC_DISCOVERY"
)

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