本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/settings/directories.Provider.TmpDir方法的典型用法代码示例。如果您正苦于以下问题:Golang Provider.TmpDir方法的具体用法?Golang Provider.TmpDir怎么用?Golang Provider.TmpDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/settings/directories.Provider
的用法示例。
在下文中一共展示了Provider.TmpDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewWindowsCertManager
func NewWindowsCertManager(fs boshsys.FileSystem, runner boshsys.CmdRunner, dirProvider boshdir.Provider, logger logger.Logger) Manager {
return &windowsCertManager{
fs: fs,
runner: runner,
dirProvider: dirProvider,
logger: logger,
backupPath: path.Join(dirProvider.TmpDir(), "rootCertBackup.sst"),
}
}
示例2:
dirProvider = boshdir.NewProvider(tempDir)
certManager = cert.NewWindowsCertManager(fs, boshsys.NewExecCmdRunner(log), dirProvider, log)
})
AfterEach(func() {
for _, thumbprint := range certThumbprints {
cmd := exec.Command("powershell", "-Command", fmt.Sprintf(removeCertScript, `Cert:\LocalMachine\Root\`+thumbprint))
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).To(BeNil())
Eventually(session).Should(gexec.Exit(0))
}
os.RemoveAll(tempDir)
})
It("should create the tmpDir if doesn't exist", func() {
_, err := os.Stat(dirProvider.TmpDir())
fmt.Println("BEfore", dirProvider.TmpDir(), err)
missing := os.IsNotExist(err)
Expect(missing).To(BeTrue())
err = certManager.UpdateCertificates(validCerts)
Expect(err).To(BeNil())
_, err = os.Stat(dirProvider.TmpDir())
Expect(err).To(BeNil())
})
Context("When TempDir exists", func() {
BeforeEach(func() {
err := fs.MkdirAll(dirProvider.TmpDir(), os.FileMode(0777))
Expect(err).To(BeNil())
})
It("adds certs to the trusted cert chain", func() {