本文整理汇总了Golang中github.com/openshift/origin/pkg/bootstrap/docker/dockerhelper.NewHelper函数的典型用法代码示例。如果您正苦于以下问题:Golang NewHelper函数的具体用法?Golang NewHelper怎么用?Golang NewHelper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewHelper函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Status
// Status prints the OpenShift cluster status
func (c *ClientStatusConfig) Status(f *clientcmd.Factory, out io.Writer) error {
dockerClient, _, err := getDockerClient(out, c.DockerMachine, false)
if err != nil {
return errors.ErrNoDockerClient(err)
}
helper := dockerhelper.NewHelper(dockerClient, nil)
container, running, err := helper.GetContainerState(openshift.OpenShiftContainer)
if err != nil {
return errors.NewError("cannot get state of OpenShift container %s", openshift.OpenShiftContainer).WithCause(err)
}
if !running {
return errors.NewError("OpenShift cluster is not running")
}
healthy, err := isHealthy(f)
if err != nil {
return err
}
if !healthy {
return errors.NewError("OpenShift cluster health check failed")
}
config, err := openshift.GetConfigFromContainer(dockerClient)
if err != nil {
return err
}
fmt.Print(status(container, config))
return nil
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:34,代码来源:status.go
示例2: Stop
// Stop stops the currently running origin container and any
// containers started by the node.
func (c *ClientStopConfig) Stop(out io.Writer) error {
client, err := c.getDockerClient(out)
if err != nil {
return err
}
helper := dockerhelper.NewHelper(client, nil)
glog.V(4).Infof("Killing previous socat tunnel")
err = openshift.KillExistingSocat()
if err != nil {
glog.V(1).Infof("error: cannot kill socat: %v", err)
}
glog.V(4).Infof("Stopping and removing origin container")
if err = helper.StopAndRemoveContainer("origin"); err != nil {
glog.V(1).Infof("Error stopping origin container: %v", err)
}
names, err := helper.ListContainerNames()
if err != nil {
return err
}
for _, name := range names {
if _, _, err = dockertools.ParseDockerName(name); err != nil {
continue
}
name = strings.TrimLeft(name, "/")
glog.V(4).Infof("Stopping container %s", name)
if err = client.StopContainer(name, 0); err != nil {
glog.V(1).Infof("Error stopping container %s: %v", name, err)
}
glog.V(4).Infof("Removing container %s", name)
if err = helper.RemoveContainer(name); err != nil {
glog.V(1).Infof("Error removing container %s: %v", name, err)
}
}
return nil
}
开发者ID:Xmagicer,项目名称:origin,代码行数:37,代码来源:down.go
示例3: NewHelper
// NewHelper creates a new OpenShift helper
func NewHelper(client *docker.Client, hostHelper *host.HostHelper, image, containerName, publicHostname, routingSuffix string) *Helper {
return &Helper{
dockerHelper: dockerhelper.NewHelper(client),
execHelper: exec.NewExecHelper(client, containerName),
hostHelper: hostHelper,
runHelper: run.NewRunHelper(client),
image: image,
containerName: containerName,
publicHost: publicHostname,
routingSuffix: routingSuffix,
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:13,代码来源:helper.go
示例4: DockerHelper
// DockerHelper returns a helper object to work with the Docker client
func (c *ClientStartConfig) DockerHelper() *dockerhelper.Helper {
if c.dockerHelper == nil {
c.dockerHelper = dockerhelper.NewHelper(c.dockerClient, c.engineAPIClient)
}
return c.dockerHelper
}
开发者ID:bmeng,项目名称:origin,代码行数:7,代码来源:up.go
注:本文中的github.com/openshift/origin/pkg/bootstrap/docker/dockerhelper.NewHelper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论