本文整理匯總了Golang中github.com/giantswarm/yochu/fs.FsClient類的典型用法代碼示例。如果您正苦於以下問題:Golang FsClient類的具體用法?Golang FsClient怎麽用?Golang FsClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FsClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Teardown
func Teardown(fsc *fs.FsClient, sc *systemd.SystemdClient, distributionPath string, stopDaemon bool) error {
vLogger("\n# call rkt.Teardown()")
for _, u := range units {
exists, err := sc.Exists(u)
if err != nil {
return maskAny(err)
}
if !exists || !stopDaemon {
continue
}
if err := sc.Stop(u); err != nil {
return maskAny(err)
}
if err := fsc.Remove(rktSystemdPath + u); err != nil {
return maskAny(err)
}
}
// reload unit files, that is, `systemctl daemon-reload`
if err := sc.Reload(); err != nil {
return maskAny(err)
}
if err := fsc.Remove(distributionPath + "/rkt"); err != nil {
return maskAny(err)
}
return nil
}
示例2: Teardown
func Teardown(fsc *fs.FsClient, sc *systemd.SystemdClient) error {
vLogger("\n# call iptables.Teardown()")
for _, s := range services {
exists, err := sc.Exists(s)
if err != nil {
return maskAny(err)
}
if !exists {
continue
}
if err := sc.Stop(s); err != nil {
return maskAny(err)
}
}
for _, p := range paths {
if err := fsc.Remove(p); err != nil {
return maskAny(err)
}
}
if err := sc.Reload(); err != nil {
return maskAny(err)
}
return nil
}
示例3: Teardown
func Teardown(fsc *fs.FsClient, sc *systemd.SystemdClient, distributionPath, overlayWorkdir, overlayMountPoint string) error {
vLogger("\n# call overlay.Teardown()")
exists, err := sc.Exists(overlayMount)
if err != nil {
return maskAny(err)
}
if exists {
if err := sc.Stop(overlayMount); err != nil {
return maskAny(err)
}
}
if err := fsc.Remove(overlayMountPath); err != nil && !fs.IsNotExist(err) {
return maskAny(err)
}
if err := sc.Reload(); err != nil {
return maskAny(err)
}
if err := fsc.Remove(overlayWorkdir); err != nil && !fs.IsNotExist(err) {
return maskAny(err)
}
return nil
}
示例4: Teardown
func Teardown(fsc *fs.FsClient, sc *systemd.SystemdClient, stopDaemon bool) error {
vLogger("\n# call docker.Teardown()")
for _, s := range services {
exists, err := sc.Exists(s)
if err != nil {
return maskAny(err)
}
if !exists || !stopDaemon {
continue
}
if err := sc.Stop(s); err != nil {
return maskAny(err)
}
}
for _, p := range paths {
if err := fsc.Remove(p); err != nil {
return maskAny(err)
}
}
// reload unit files, that is, `systemctl daemon-reload`
if err := sc.Reload(); err != nil {
return maskAny(err)
}
return nil
}
示例5: createRktGarbageService
func createRktGarbageService(fsc *fs.FsClient, useOverlay bool) error {
opts := rktOptions{
UseOverlay: useOverlay,
}
b, err := templates.Render(rktGarbageServiceTemplate, opts)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(rktSystemdPath+rktGarbageServiceName, b.Bytes(), unitFileMode); err != nil {
return maskAny(err)
}
rktGarbageTimer, err := templates.Asset(rktGarbageTimerTemplate)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(rktSystemdPath+rktGarbageTimerName, rktGarbageTimer, unitFileMode); err != nil {
return maskAny(err)
}
return nil
}
示例6: Teardown
func Teardown(fsc *fs.FsClient, distributionPath string) error {
vLogger("\n# call distribution.Teardown()")
if err := fsc.Remove(distributionPath); err != nil {
return maskAny(err)
}
return nil
}
示例7: Setup
func Setup(fsc *fs.FsClient, distributionPath string) error {
vLogger("\n# call distribution.Setup()")
if err := fsc.MkdirAll(distributionPath, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例8: setupRules
func setupRules(fsc *fs.FsClient, subnet, dockerSubnet, gateway string, useDockerRules bool) error {
rulesBytes, err := RenderRulesFromTemplate(subnet, dockerSubnet, gateway, useDockerRules)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(rulesPath, rulesBytes, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例9: setupRules
func setupRules(fsClient *fs.FsClient) error {
rulesBytes, err := RenderRulesFromTemplate()
if err != nil {
return maskAny(err)
}
if err := fsClient.Write(rulesPath, rulesBytes, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例10: setupService
func setupService(fsc *fs.FsClient) error {
iptablesService, err := templates.Asset(serviceTemplate)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(servicePath, iptablesService, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例11: setupNetfilter
func setupNetfilter(fsc *fs.FsClient) error {
netfilterService, err := templates.Asset(netfilterTemplate)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(netfilterPath, netfilterService, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例12: Setup
func Setup(fsc *fs.FsClient, fc fetchclient.FetchClient, distributionPath, k8sVersion string) error {
vLogger("\n# call k8s.Setup()")
k8sRaw, err := fc.Get("k8s/" + k8sVersion + "/kubectl")
if err != nil {
return maskAny(err)
}
if err := fsc.Write(distributionPath+"/kubectl", k8sRaw, fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例13: createFleetService
func createFleetService(fsc *fs.FsClient, useOverlay bool) error {
opts := fleetOptions{
UseOverlay: useOverlay,
}
b, err := templates.Render(fleetServiceTemplate, opts)
if err != nil {
return maskAny(err)
}
if err := fsc.Write(fleetServicePath, b.Bytes(), fileMode); err != nil {
return maskAny(err)
}
return nil
}
示例14: Teardown
func Teardown(fsc *fs.FsClient, sc *systemd.SystemdClient, distributionPath string, stopDaemon bool) error {
vLogger("\n# call fleet.Teardown()")
exists, err := sc.Exists(fleetServiceName)
if err != nil {
return maskAny(err)
}
if exists && stopDaemon {
if err := sc.Stop(fleetServiceName); err != nil {
return maskAny(err)
}
}
if err := fsc.Remove(distributionPath + "/fleet"); err != nil {
return maskAny(err)
}
if err := fsc.Remove(distributionPath + "/fleetd"); err != nil {
return maskAny(err)
}
if err := fsc.Remove(distributionPath + "/fleetctl"); err != nil {
return maskAny(err)
}
if err := sc.Reload(); err != nil {
return maskAny(err)
}
return nil
}
示例15: Setup
func Setup(fsc *fs.FsClient, sc *systemd.SystemdClient, fc fetchclient.FetchClient, distributionPath, etcdVersion string, startDaemon bool, useOverlay bool) error {
vLogger("\n# call etcd.Setup()")
etcdRaw, err := fc.Get("etcd/" + etcdVersion + "/etcd")
if err != nil {
return maskAny(err)
}
if err := fsc.Write(distributionPath+"/etcd2", etcdRaw, fileMode); err != nil {
return maskAny(err)
}
etcdctlRaw, err := fc.Get("etcd/" + etcdVersion + "/etcdctl")
if err != nil {
return maskAny(err)
}
if err := fsc.Write(distributionPath+"/etcdctl", etcdctlRaw, fileMode); err != nil {
return maskAny(err)
}
err = createEtcdService(fsc, useOverlay)
if err != nil {
return maskAny(err)
}
if err := sc.Reload(); err != nil {
return maskAny(err)
}
if startDaemon {
if err := sc.Start(etcdServiceName); err != nil {
return maskAny(err)
}
}
return nil
}