本文整理汇总了Golang中github.com/crunchydata/crunchy-postgresql-manager/types.Container.ProjectID方法的典型用法代码示例。如果您正苦于以下问题:Golang Container.ProjectID方法的具体用法?Golang Container.ProjectID怎么用?Golang Container.ProjectID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/crunchydata/crunchy-postgresql-manager/types.Container
的用法示例。
在下文中一共展示了Container.ProjectID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: provisionImpl
//.........这里部分代码省略.........
return "", err
}
logit.Info.Println("Provision: provisionvolume call response=" + response.Status)
}
}
logit.Info.Println("PROFILE provisionImpl 3 provision volume completed")
//run docker run to create the container
params.CPU, params.MEM, err = getDockerResourceSettings(dbConn, params.Profile)
if err != nil {
logit.Error.Println(err.Error())
return "", err
}
//inspect and remove any existing container
logit.Info.Println("PROFILE provisionImpl inspect 4")
inspectReq := &swarmapi.DockerInspectRequest{}
inspectReq.ContainerName = params.ContainerName
var inspectResponse swarmapi.DockerInspectResponse
inspectResponse, err = swarmapi.DockerInspect(inspectReq)
if err != nil {
logit.Error.Println(err.Error())
return "", err
}
if inspectResponse.RunningState != "not-found" {
logit.Info.Println("PROFILE provisionImpl remove existing container 4a")
rreq := &swarmapi.DockerRemoveRequest{}
rreq.ContainerName = params.ContainerName
_, err = swarmapi.DockerRemove(rreq)
if err != nil {
logit.Error.Println(err.Error())
return "", err
}
}
//pass any restore env vars to the new container
if params.RestoreJob != "" {
if params.EnvVars == nil {
//logit.Info.Println("making envvars map")
params.EnvVars = make(map[string]string)
}
params.EnvVars["RestoreJob"] = params.RestoreJob
params.EnvVars["RestoreRemotePath"] = params.RestoreRemotePath
params.EnvVars["RestoreRemoteHost"] = params.RestoreRemoteHost
params.EnvVars["RestoreRemoteUser"] = params.RestoreRemoteUser
params.EnvVars["RestoreDbUser"] = params.RestoreDbUser
params.EnvVars["RestoreDbPass"] = params.RestoreDbPass
params.EnvVars["RestoreSet"] = params.RestoreSet
}
//
runReq := swarmapi.DockerRunRequest{}
runReq.PGDataPath = params.PGDataPath
runReq.Profile = params.Profile
runReq.Image = params.Image
runReq.ContainerName = params.ContainerName
runReq.EnvVars = params.EnvVars
//logit.Info.Println("CPU=" + params.CPU)
//logit.Info.Println("MEM=" + params.MEM)
runReq.CPU = "0"
runReq.MEM = "0"
var runResp swarmapi.DockerRunResponse
runResp, err = swarmapi.DockerRun(&runReq)
if err != nil {
logit.Error.Println(err.Error())
return "", err
}
logit.Info.Println("PROFILE provisionImpl created container 5 " + runResp.ID)
dbnode := types.Container{}
dbnode.ID = ""
dbnode.Name = params.ContainerName
dbnode.Image = params.Image
dbnode.ClusterID = "-1"
dbnode.ProjectID = params.ProjectID
if params.Standalone == "true" {
dbnode.Role = "standalone"
} else {
dbnode.Role = "unassigned"
}
var strid int
strid, err = admindb.InsertContainer(dbConn, dbnode)
newid := strconv.Itoa(strid)
if err != nil {
logit.Error.Println(err.Error())
return "", err
}
dbnode.ID = newid
if params.Image != "cpm-node-proxy" {
//register default db users on the new node
err = createDBUsers(dbConn, dbnode)
}
return newid, err
}