install

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 21 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 := InstallerContext{
			AssumeYes:          assumeYes,
			LocalRecipes:       localRecipes,
			RecipeNames:        recipeNames,
			RecipePaths:        recipePaths,
			SkipDiscovery:      skipDiscovery,
			SkipIntegrations:   skipIntegrations,
			SkipLoggingInstall: skipLoggingInstall,
			SkipApm:            skipApm,
			SkipInfra:          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.nr/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 := InstallerContext{
			RecipePaths:        recipePaths,
			RecipeNames:        recipeNames,
			SkipDiscovery:      skipDiscovery,
			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.

Functions

func TestScenarioValues

func TestScenarioValues() []string

Types

type InstallerContext

type InstallerContext struct {
	AssumeYes   bool
	RecipeNames []string
	RecipePaths []string
	// LocalRecipes is the path to a local recipe directory from which to load recipes.
	LocalRecipes       string
	SkipDiscovery      bool
	SkipIntegrations   bool
	SkipLoggingInstall bool
	SkipApm            bool
	SkipInfra          bool
}

nolint: maligned

func (*InstallerContext) RecipeNamesProvided

func (i *InstallerContext) RecipeNamesProvided() bool

func (*InstallerContext) RecipePathsProvided

func (i *InstallerContext) RecipePathsProvided() bool

func (*InstallerContext) RecipesProvided

func (i *InstallerContext) RecipesProvided() bool

func (*InstallerContext) ShouldInstallApm added in v0.22.0

func (i *InstallerContext) ShouldInstallApm() bool

func (*InstallerContext) ShouldInstallInfraAgent

func (i *InstallerContext) ShouldInstallInfraAgent() bool

func (*InstallerContext) ShouldInstallIntegrations

func (i *InstallerContext) ShouldInstallIntegrations() bool

func (*InstallerContext) ShouldInstallLogging

func (i *InstallerContext) ShouldInstallLogging() bool

func (*InstallerContext) ShouldRunDiscovery

func (i *InstallerContext) ShouldRunDiscovery() bool

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 RecipeInstaller

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

func NewRecipeInstaller

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

func (*RecipeInstaller) Install

func (i *RecipeInstaller) Install() error

type ScenarioBuilder

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

func NewScenarioBuilder

func NewScenarioBuilder(ic InstallerContext) *ScenarioBuilder

func (*ScenarioBuilder) Basic

func (b *ScenarioBuilder) Basic() *RecipeInstaller

func (*ScenarioBuilder) BuildScenario

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

func (*ScenarioBuilder) CanceledInstall added in v0.19.2

func (b *ScenarioBuilder) CanceledInstall() *RecipeInstaller
func (b *ScenarioBuilder) DisplayExplorerLink() *RecipeInstaller

func (*ScenarioBuilder) Fail added in v0.18.11

func (b *ScenarioBuilder) Fail() *RecipeInstaller

func (*ScenarioBuilder) LogMatches added in v0.8.12

func (b *ScenarioBuilder) LogMatches() *RecipeInstaller

func (*ScenarioBuilder) StitchedPath added in v0.18.27

func (b *ScenarioBuilder) StitchedPath() *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"
	LogMatches          TestScenario = "LOG_MATCHES"
	Fail                TestScenario = "FAIL"
	StitchedPath        TestScenario = "STITCHED_PATH"
	Canceled            TestScenario = "CANCELED"
	DisplayExplorerLink TestScenario = "DISPLAY_EXPLORER_LINK"
)

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