platform

package
v0.0.0-...-bba7bac Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArpIterations          = 20
	ArpIterationDelay      = 5 * time.Second
	ArpInterfaceCheckDelay = 100 * time.Millisecond
)
View Source
const CredentialFileName = "password"
View Source
const EtcHostsFileName = "etc_hosts"
View Source
const EtcHostsTemplate = `` /* 247-byte string literal not displayed */
View Source
const (
	SigarStatsCollectionInterval = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewMonitRetryable

func NewMonitRetryable(cmdRunner boshsys.CmdRunner) boshretry.Retryable

Types

type AuditLogger

type AuditLogger interface {
	Debug(string)
	Err(string)
	StartLogging()
}

type AuditLoggerProvider

type AuditLoggerProvider interface {
	ProvideDebugLogger() (*log.Logger, error)
	ProvideErrorLogger() (*log.Logger, error)
}

func NewAuditLoggerProvider

func NewAuditLoggerProvider() AuditLoggerProvider

type BootstrapState

type BootstrapState struct {
	Linux LinuxState
	// contains filtered or unexported fields
}

func NewBootstrapState

func NewBootstrapState(fs boshsys.FileSystem, path string) (*BootstrapState, error)

func (*BootstrapState) SaveState

func (s *BootstrapState) SaveState() (err error)

type DelayedAuditLogger

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

func NewDelayedAuditLogger

func NewDelayedAuditLogger(auditLoggerProvider AuditLoggerProvider, logger boshlog.Logger) *DelayedAuditLogger

func (*DelayedAuditLogger) Debug

func (l *DelayedAuditLogger) Debug(msg string)

func (*DelayedAuditLogger) Err

func (l *DelayedAuditLogger) Err(msg string)

func (*DelayedAuditLogger) StartLogging

func (l *DelayedAuditLogger) StartLogging()

type LinuxOptions

type LinuxOptions struct {
	// When set to true loop back device
	// is not going to be overlayed over /tmp to limit /tmp dir size
	UseDefaultTmpDir bool

	// When set to true the agent will scrub ephemeral disk if agent version is
	// different with stemcell version
	ScrubEphemeralDisk bool

	// When set to true persistent disk will be assumed to be pre-formatted;
	// otherwise agent will partition and format it right before mounting
	UsePreformattedPersistentDisk bool

	// When set to true persistent disk will be mounted as a bind-mount
	BindMountPersistentDisk bool

	// When set to true and no ephemeral disk is mounted, the agent will create
	// a partition on the same device as the root partition to use as the
	// ephemeral disk
	CreatePartitionIfNoEphemeralDisk bool

	// When set to true the agent will skip both root and ephemeral disk partitioning
	SkipDiskSetup bool

	// Strategy for resolving device paths;
	// possible values: virtio, scsi, ""
	DevicePathResolutionType string

	// Strategy for resolving ephemeral & persistent disk partitioners;
	// possible values: parted, "" (default is sfdisk if disk < 2TB, parted otherwise)
	PartitionerType string
}

type LinuxState

type LinuxState struct {
	HostsConfigured bool `json:"hosts_configured"`
}

type Options

type Options struct {
	Linux LinuxOptions
}

type Platform

type Platform interface {
	GetFs() boshsys.FileSystem
	GetRunner() boshsys.CmdRunner
	GetCompressor() boshcmd.Compressor
	GetCopier() boshcmd.Copier
	GetDirProvider() boshdir.Provider
	GetVitalsService() boshvitals.Service
	GetAuditLogger() AuditLogger
	GetDevicePathResolver() (devicePathResolver boshdpresolv.DevicePathResolver)

	// User management
	CreateUser(username, basePath string) (err error)
	AddUserToGroups(username string, groups []string) (err error)
	DeleteEphemeralUsersMatching(regex string) (err error)

	// Bootstrap functionality
	SetupRootDisk(ephemeralDiskPath string) (err error)
	SetupSSH(publicKey []string, username string) (err error)
	SetUserPassword(user, encryptedPwd string) (err error)
	SetupHostname(hostname string) (err error)
	SetupNetworking(networks boshsettings.Networks) (err error)
	SetupLogrotate(groupName, basePath, size string) (err error)
	SetTimeWithNtpServers(servers []string) (err error)
	SetupEphemeralDiskWithPath(devicePath string, desiredSwapSizeInBytes *uint64) (err error)
	SetupRawEphemeralDisks(devices []boshsettings.DiskSettings) (err error)
	SetupDataDir() (err error)
	SetupTmpDir() (err error)
	SetupHomeDir() (err error)
	SetupBlobsDir() (err error)
	SetupMonitUser() (err error)
	StartMonit() (err error)
	SetupRuntimeConfiguration() (err error)
	SetupLogDir() (err error)
	SetupLoggingAndAuditing() (err error)

	// Disk management
	MountPersistentDisk(diskSettings boshsettings.DiskSettings, mountPoint string) error
	UnmountPersistentDisk(diskSettings boshsettings.DiskSettings) (didUnmount bool, err error)
	MigratePersistentDisk(fromMountPoint, toMountPoint string) (err error)
	GetEphemeralDiskPath(diskSettings boshsettings.DiskSettings) string
	IsMountPoint(path string) (partitionPath string, result bool, err error)
	IsPersistentDiskMounted(diskSettings boshsettings.DiskSettings) (result bool, err error)
	IsPersistentDiskMountable(diskSettings boshsettings.DiskSettings) (bool, error)
	AssociateDisk(name string, settings boshsettings.DiskSettings) error

	GetFileContentsFromCDROM(filePath string) (contents []byte, err error)
	GetFilesContentsFromDisk(diskPath string, fileNames []string) (contents [][]byte, err error)

	// Network misc
	GetDefaultNetwork() (boshsettings.Network, error)
	GetConfiguredNetworkInterfaces() ([]string, error)
	PrepareForNetworkingChange() error
	DeleteARPEntryWithIP(ip string) error
	SaveDNSRecords(dnsRecords boshsettings.DNSRecords, hostname string) error

	// Additional monit management
	GetMonitCredentials() (username, password string, err error)

	GetCertManager() cert.Manager

	GetHostPublicKey() (string, error)

	RemoveDevTools(packageFileListPath string) error
}

func NewDummyPlatform

func NewDummyPlatform(
	collector boshstats.Collector,
	fs boshsys.FileSystem,
	cmdRunner boshsys.CmdRunner,
	dirProvider boshdirs.Provider,
	devicePathResolver boshdpresolv.DevicePathResolver,
	logger boshlog.Logger,
	auditLogger AuditLogger,
) Platform

func NewLinuxPlatform

func NewLinuxPlatform(
	fs boshsys.FileSystem,
	cmdRunner boshsys.CmdRunner,
	collector boshstats.Collector,
	compressor boshcmd.Compressor,
	copier boshcmd.Copier,
	dirProvider boshdirs.Provider,
	vitalsService boshvitals.Service,
	cdutil boshdevutil.DeviceUtil,
	diskManager boshdisk.Manager,
	netManager boshnet.Manager,
	certManager boshcert.Manager,
	monitRetryStrategy boshretry.RetryStrategy,
	devicePathResolver boshdpresolv.DevicePathResolver,
	state *BootstrapState,
	options LinuxOptions,
	logger boshlog.Logger,
	defaultNetworkResolver boshsettings.DefaultNetworkResolver,
	uuidGenerator boshuuid.Generator,
	auditLogger AuditLogger,
) Platform

func NewWindowsPlatform

func NewWindowsPlatform(
	collector boshstats.Collector,
	fs boshsys.FileSystem,
	cmdRunner boshsys.CmdRunner,
	dirProvider boshdirs.Provider,
	netManager boshnet.Manager,
	certManager boshcert.Manager,
	devicePathResolver boshdpresolv.DevicePathResolver,
	logger boshlog.Logger,
	defaultNetworkResolver boshsettings.DefaultNetworkResolver,
	auditLogger AuditLogger,
) Platform

type Provider

type Provider interface {
	Get(name string) (Platform, error)
}

func NewProvider

func NewProvider(logger boshlog.Logger, dirProvider boshdirs.Provider, statsCollector boshstats.Collector, fs boshsys.FileSystem, options Options, bootstrapState *BootstrapState, clock clock.Clock, auditLogger AuditLogger) Provider

type WindowsPlatform

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

func (WindowsPlatform) AddUserToGroups

func (p WindowsPlatform) AddUserToGroups(username string, groups []string) (err error)

func (WindowsPlatform) AssociateDisk

func (p WindowsPlatform) AssociateDisk(name string, settings boshsettings.DiskSettings) error

func (WindowsPlatform) CleanIPMacAddressCache

func (p WindowsPlatform) CleanIPMacAddressCache(ip string) error

func (WindowsPlatform) CreateUser

func (p WindowsPlatform) CreateUser(username, basePath string) (err error)

func (WindowsPlatform) DeleteARPEntryWithIP

func (p WindowsPlatform) DeleteARPEntryWithIP(ip string) error

func (WindowsPlatform) DeleteEphemeralUsersMatching

func (p WindowsPlatform) DeleteEphemeralUsersMatching(regex string) (err error)

func (WindowsPlatform) GetAuditLogger

func (p WindowsPlatform) GetAuditLogger() AuditLogger

func (WindowsPlatform) GetCertManager

func (p WindowsPlatform) GetCertManager() (certManager boshcert.Manager)

func (WindowsPlatform) GetCompressor

func (p WindowsPlatform) GetCompressor() (compressor boshcmd.Compressor)

func (WindowsPlatform) GetConfiguredNetworkInterfaces

func (p WindowsPlatform) GetConfiguredNetworkInterfaces() (interfaces []string, err error)

func (WindowsPlatform) GetCopier

func (p WindowsPlatform) GetCopier() (copier boshcmd.Copier)

func (WindowsPlatform) GetDefaultNetwork

func (p WindowsPlatform) GetDefaultNetwork() (boshsettings.Network, error)

func (WindowsPlatform) GetDevicePathResolver

func (p WindowsPlatform) GetDevicePathResolver() (devicePathResolver boshdpresolv.DevicePathResolver)

func (WindowsPlatform) GetDirProvider

func (p WindowsPlatform) GetDirProvider() (dirProvider boshdir.Provider)

func (WindowsPlatform) GetEphemeralDiskPath

func (p WindowsPlatform) GetEphemeralDiskPath(diskSettings boshsettings.DiskSettings) string

func (WindowsPlatform) GetFileContentsFromCDROM

func (p WindowsPlatform) GetFileContentsFromCDROM(filePath string) (contents []byte, err error)

func (WindowsPlatform) GetFilesContentsFromDisk

func (p WindowsPlatform) GetFilesContentsFromDisk(diskPath string, fileNames []string) (contents [][]byte, err error)

func (WindowsPlatform) GetFs

func (p WindowsPlatform) GetFs() (fs boshsys.FileSystem)

func (WindowsPlatform) GetHostPublicKey

func (p WindowsPlatform) GetHostPublicKey() (string, error)

func (WindowsPlatform) GetMonitCredentials

func (p WindowsPlatform) GetMonitCredentials() (username, password string, err error)

func (WindowsPlatform) GetRunner

func (p WindowsPlatform) GetRunner() (runner boshsys.CmdRunner)

func (WindowsPlatform) GetVitalsService

func (p WindowsPlatform) GetVitalsService() (service boshvitals.Service)

func (WindowsPlatform) IsMountPoint

func (p WindowsPlatform) IsMountPoint(path string) (string, bool, error)

func (WindowsPlatform) IsPersistentDiskMountable

func (p WindowsPlatform) IsPersistentDiskMountable(diskSettings boshsettings.DiskSettings) (bool, error)

func (WindowsPlatform) IsPersistentDiskMounted

func (p WindowsPlatform) IsPersistentDiskMounted(diskSettings boshsettings.DiskSettings) (bool, error)

func (WindowsPlatform) MigratePersistentDisk

func (p WindowsPlatform) MigratePersistentDisk(fromMountPoint, toMountPoint string) (err error)

func (WindowsPlatform) MountPersistentDisk

func (p WindowsPlatform) MountPersistentDisk(diskSettings boshsettings.DiskSettings, mountPoint string) (err error)

func (WindowsPlatform) PrepareForNetworkingChange

func (p WindowsPlatform) PrepareForNetworkingChange() error

func (WindowsPlatform) RemoveDevTools

func (p WindowsPlatform) RemoveDevTools(packageFileListPath string) error

func (WindowsPlatform) SaveDNSRecords

func (p WindowsPlatform) SaveDNSRecords(dnsRecords boshsettings.DNSRecords, hostname string) (err error)

func (WindowsPlatform) SetTimeWithNtpServers

func (p WindowsPlatform) SetTimeWithNtpServers(servers []string) (err error)

func (WindowsPlatform) SetUserPassword

func (p WindowsPlatform) SetUserPassword(user, encryptedPwd string) (err error)

func (WindowsPlatform) SetupBlobsDir

func (p WindowsPlatform) SetupBlobsDir() error

func (WindowsPlatform) SetupDataDir

func (p WindowsPlatform) SetupDataDir() error

func (WindowsPlatform) SetupEphemeralDiskWithPath

func (p WindowsPlatform) SetupEphemeralDiskWithPath(devicePath string, desiredSwapSizeInBytes *uint64) (err error)

func (WindowsPlatform) SetupHomeDir

func (p WindowsPlatform) SetupHomeDir() error

func (WindowsPlatform) SetupHostname

func (p WindowsPlatform) SetupHostname(hostname string) (err error)

func (WindowsPlatform) SetupLogDir

func (p WindowsPlatform) SetupLogDir() error

func (WindowsPlatform) SetupLoggingAndAuditing

func (p WindowsPlatform) SetupLoggingAndAuditing() error

func (WindowsPlatform) SetupLogrotate

func (p WindowsPlatform) SetupLogrotate(groupName, basePath, size string) (err error)

func (WindowsPlatform) SetupMonitUser

func (p WindowsPlatform) SetupMonitUser() (err error)

func (WindowsPlatform) SetupNetworking

func (p WindowsPlatform) SetupNetworking(networks boshsettings.Networks) (err error)

func (WindowsPlatform) SetupRawEphemeralDisks

func (p WindowsPlatform) SetupRawEphemeralDisks(devices []boshsettings.DiskSettings) (err error)

func (WindowsPlatform) SetupRootDisk

func (p WindowsPlatform) SetupRootDisk(ephemeralDiskPath string) (err error)

func (WindowsPlatform) SetupRuntimeConfiguration

func (p WindowsPlatform) SetupRuntimeConfiguration() (err error)

func (WindowsPlatform) SetupSSH

func (p WindowsPlatform) SetupSSH(publicKey []string, username string) (err error)

func (WindowsPlatform) SetupTmpDir

func (p WindowsPlatform) SetupTmpDir() error

func (WindowsPlatform) StartMonit

func (p WindowsPlatform) StartMonit() (err error)

func (WindowsPlatform) UnmountPersistentDisk

func (p WindowsPlatform) UnmountPersistentDisk(diskSettings boshsettings.DiskSettings) (didUnmount bool, err error)

Directories

Path Synopsis
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
net
arp
ip
ntp

Jump to

Keyboard shortcuts

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