本文整理匯總了Golang中github.com/cloudfoundry/bosh-agent/platform.Platform.GetFs方法的典型用法代碼示例。如果您正苦於以下問題:Golang Platform.GetFs方法的具體用法?Golang Platform.GetFs怎麽用?Golang Platform.GetFs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-agent/platform.Platform
的用法示例。
在下文中一共展示了Platform.GetFs方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewProvider
func NewProvider(
platform boshplatform.Platform,
client boshmonit.Client,
logger boshlog.Logger,
dirProvider boshdir.Provider,
handler boshhandler.Handler,
) (p Provider) {
monitJobSupervisor := NewMonitJobSupervisor(
platform.GetFs(),
platform.GetRunner(),
client,
logger,
dirProvider,
2825,
MonitReloadOptions{
MaxTries: 3,
MaxCheckTries: 6,
DelayBetweenCheckTries: 5 * time.Second,
},
)
p.supervisors = map[string]JobSupervisor{
"monit": monitJobSupervisor,
"dummy": NewDummyJobSupervisor(),
"dummy-nats": NewDummyNatsJobSupervisor(handler),
}
return
}
示例2: NewProvider
func NewProvider(
platform boshplatform.Platform,
client boshmonit.Client,
logger boshlog.Logger,
dirProvider boshdir.Provider,
handler boshhandler.Handler,
) (p Provider) {
fs := platform.GetFs()
runner := platform.GetRunner()
timeService := clock.NewClock()
monitJobSupervisor := NewMonitJobSupervisor(
fs,
runner,
client,
logger,
dirProvider,
jobSupervisorListenPort,
MonitReloadOptions{
MaxTries: 3,
MaxCheckTries: 6,
DelayBetweenCheckTries: 5 * time.Second,
},
timeService,
)
p.supervisors = map[string]JobSupervisor{
"monit": monitJobSupervisor,
"dummy": NewDummyJobSupervisor(),
"dummy-nats": NewDummyNatsJobSupervisor(handler),
"windows": NewWindowsJobSupervisor(runner, dirProvider, fs, logger, jobSupervisorListenPort, make(chan bool)),
}
return
}
示例3: NewFactory
func NewFactory(
settingsService boshsettings.Service,
platform boshplatform.Platform,
blobstore boshblob.Blobstore,
taskService boshtask.Service,
notifier boshnotif.Notifier,
applier boshappl.Applier,
compiler boshcomp.Compiler,
jobSupervisor boshjobsuper.JobSupervisor,
specService boshas.V1Service,
jobScriptProvider boshscript.JobScriptProvider,
logger boshlog.Logger,
) (factory Factory) {
compressor := platform.GetCompressor()
copier := platform.GetCopier()
dirProvider := platform.GetDirProvider()
vitalsService := platform.GetVitalsService()
certManager := platform.GetCertManager()
ntpService := boshntp.NewConcreteService(platform.GetFs(), dirProvider)
factory = concreteFactory{
availableActions: map[string]Action{
// Task management
"ping": NewPing(),
"get_task": NewGetTask(taskService),
"cancel_task": NewCancelTask(taskService),
// VM admin
"ssh": NewSSH(settingsService, platform, dirProvider, logger),
"fetch_logs": NewFetchLogs(compressor, copier, blobstore, dirProvider),
"update_settings": NewUpdateSettings(certManager, logger),
// Job management
"prepare": NewPrepare(applier),
"apply": NewApply(applier, specService, settingsService),
"start": NewStart(jobSupervisor, applier, specService),
"stop": NewStop(jobSupervisor),
"drain": NewDrain(notifier, specService, jobScriptProvider, jobSupervisor, logger),
"get_state": NewGetState(settingsService, specService, jobSupervisor, vitalsService, ntpService),
"run_errand": NewRunErrand(specService, dirProvider.JobsDir(), platform.GetRunner(), logger),
"run_script": NewRunScript(jobScriptProvider, specService, logger),
// Compilation
"compile_package": NewCompilePackage(compiler),
"release_apply_spec": NewReleaseApplySpec(platform),
// Disk management
"list_disk": NewListDisk(settingsService, platform, logger),
"migrate_disk": NewMigrateDisk(platform, dirProvider),
"mount_disk": NewMountDisk(settingsService, platform, platform.GetDevicePathResolver(), dirProvider, logger),
"unmount_disk": NewUnmountDisk(settingsService, platform),
// Networkingconcrete_factory_test.go
"prepare_network_change": NewPrepareNetworkChange(platform.GetFs(), settingsService, NewAgentKiller()),
"prepare_configure_networks": NewPrepareConfigureNetworks(platform, settingsService),
"configure_networks": NewConfigureNetworks(NewAgentKiller()),
},
}
return
}
示例4: Get
func (p HandlerProvider) Get(
platform boshplatform.Platform,
dirProvider boshdir.Provider,
) (handler boshhandler.Handler, err error) {
if p.handler != nil {
handler = p.handler
return
}
mbusURL, err := url.Parse(p.settingsService.GetSettings().Mbus)
if err != nil {
err = bosherr.WrapError(err, "Parsing handler URL")
return
}
switch mbusURL.Scheme {
case "nats":
handler = NewNatsHandler(p.settingsService, yagnats.NewClient(), p.logger)
case "https":
handler = boshmicro.NewHTTPSHandler(mbusURL, p.logger, platform.GetFs(), dirProvider)
default:
err = bosherr.Errorf("Message Bus Handler with scheme %s could not be found", mbusURL.Scheme)
}
p.handler = handler
return
}
示例5: NewBootstrap
func NewBootstrap(
platform boshplatform.Platform,
dirProvider boshdir.Provider,
settingsService boshsettings.Service,
logger boshlog.Logger,
) Bootstrap {
return bootstrap{
fs: platform.GetFs(),
platform: platform,
dirProvider: dirProvider,
settingsService: settingsService,
logger: logger,
}
}
示例6: NewProvider
func NewProvider(
platform boshplatform.Platform,
client boshmonit.Client,
logger boshlog.Logger,
dirProvider boshdir.Provider,
handler boshhandler.Handler,
) (p Provider) {
fs := platform.GetFs()
runner := platform.GetRunner()
timeService := clock.NewClock()
monitJobSupervisor := NewMonitJobSupervisor(
fs,
runner,
client,
logger,
dirProvider,
jobSupervisorListenPort,
MonitReloadOptions{
MaxTries: 3,
MaxCheckTries: 6,
DelayBetweenCheckTries: 5 * time.Second,
},
timeService,
)
network, err := platform.GetDefaultNetwork()
var machineIP string
if err != nil {
machineIP, _ = os.Hostname()
logger.Debug("providerWindows", "Initializing jobsupervisor.provider_windows: %s, using hostname \"%s\"instead of IP", err, machineIP)
} else {
machineIP = network.IP
}
p.supervisors = map[string]JobSupervisor{
"monit": monitJobSupervisor,
"dummy": NewDummyJobSupervisor(),
"dummy-nats": NewDummyNatsJobSupervisor(handler),
"windows": NewWindowsJobSupervisor(runner, dirProvider, fs, logger, jobSupervisorListenPort,
make(chan bool), machineIP),
}
return
}
示例7: init
//.........這裏部分代碼省略.........
fs,
runner,
sigarCollector,
compressor,
copier,
dirProvider,
vitalsService,
linuxCdutil,
diskManager,
ubuntuNetManager,
ubuntuCertManager,
monitRetryStrategy,
devicePathResolver,
500*time.Millisecond,
state,
linuxOptions,
logger,
defaultNetworkResolver,
)
})
JustBeforeEach(func() {
settingsPath := filepath.Join("bosh", "settings.json")
var settings boshsettings.Settings
json.Unmarshal([]byte(settingsJSON), &settings)
settingsSource := fakeinf.FakeSettingsSource{
PublicKey: "123",
SettingsValue: settings,
}
settingsService := boshsettings.NewService(
platform.GetFs(),
settingsPath,
settingsSource,
platform,
logger,
)
boot = NewBootstrap(
platform,
dirProvider,
settingsService,
logger,
)
})
Context("when a single network configuration is provided, with a MAC address", func() {
BeforeEach(func() {
settingsJSON = `{
"networks": {
"netA": {
"default": ["dns", "gateway"],
"ip": "2.2.2.2",
"dns": [
"8.8.8.8",
"4.4.4.4"
],
"netmask": "255.255.255.0",
"gateway": "2.2.2.0",
"mac": "aa:bb:cc"
}
}
}`
})