本文整理汇总了Golang中github.com/megamsys/gulp/provision.Box类的典型用法代码示例。如果您正苦于以下问题:Golang Box类的具体用法?Golang Box怎么用?Golang Box使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Box类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Bootstrap
func (p *chefsoloProvisioner) Bootstrap(box *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "--- bootstrap box (%s)\n", box.GetFullName())
actions := []*action.Action{
&createMachine,
&updateStatusInRiak,
&updateIpsInRiak,
&appendAuthKeys,
&updateStatusInRiak,
&changeStateofMachine,
}
pipeline := action.NewPipeline(actions...)
args := runMachineActionsArgs{
box: box,
writer: w,
machineStatus: constants.StatusBootstrapping,
provisioner: p,
}
if err := pipeline.Execute(args); err != nil {
return err
}
fmt.Fprintf(w, "--- bootstrap box (%s) OK\n", box.GetFullName())
return nil
}
示例2: mkBox
//make a box with the details for a provisioner.
func (c *Component) mkBox() (provision.Box, error) {
bt := provision.Box{
Id: c.Id,
Level: provision.BoxSome,
Name: c.Name,
DomainName: c.domain(),
Envs: c.envs(),
Tosca: c.Tosca,
Operations: c.Operations,
Commit: "",
Provider: c.provider(),
PublicIp: c.publicIp(),
}
if &c.Repo != nil {
bt.Repo = &repository.Repo{
Type: c.Repo.Rtype,
Source: c.Repo.Source,
OneClick: c.withOneClick(),
URL: c.Repo.Rurl,
}
bt.Repo.Hook = upgrade.BuildHook(c.Operations, repository.CIHOOK) //MEGAMD
}
return bt, nil
}
示例3: Stateup
func (p *chefsoloProvisioner) Stateup(b *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "--- stateup box (%s)\n", b.GetFullName())
var repo string
if b.Repo != nil {
repo = b.Repo.Gitr()
}
DefaultAttributes, _ := json.Marshal(&Attributes{
RunList: []string{"recipe[" + p.Cookbook + "]"},
ToscaType: b.GetShortTosca(),
Scm: repo,
})
p.Attributes = string(DefaultAttributes)
p.Format = DefaultFormat
p.LogLevel = DefaultLogLevel
p.RootPath = meta.MC.Dir
p.Sudo = DefaultSudo
return p.kickOffSolo(b, w)
}
示例4: Stop
func (p *chefsoloProvisioner) Stop(b *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "--- stop box (%s)\n", b.GetFullName())
actions := []*action.Action{
&updateStatusInRiak,
&stopBox,
&updateStatusInRiak,
}
pipeline := action.NewPipeline(actions...)
args := runMachineActionsArgs{
box: b,
writer: w,
machineStatus: constants.StatusStopping,
provisioner: p,
}
if err := pipeline.Execute(args); err != nil {
log.Errorf("error on execute stop pipeline for box %s - %s", b.GetFullName(), err)
return err
}
fmt.Fprintf(w, "--- stop box (%s) OK\n", b.GetFullName())
return nil
}
示例5: kickOffSolo
//1. &prepareJSON in generate the json file for chefsolo
//2. &prepareConfig in generate the config file for chefsolo.
//3. &updateStatus in Riak - Creating..
func (p *chefsoloProvisioner) kickOffSolo(b *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "--- kickofff chefsolo box (%s)\n", b.GetFullName())
soloAction := make([]*action.Action, 0, 4)
soloAction = append(soloAction, &generateSoloJson, &generateSoloConfig, &cloneBox)
if b.Level != provision.BoxNone {
soloAction = append(soloAction, &chefSoloRun)
}
soloAction = append(soloAction, &updateStatusInRiak)
actions := soloAction
pipeline := action.NewPipeline(actions...)
args := runMachineActionsArgs{
box: b,
writer: w,
machineStatus: constants.StatusRunning,
provisioner: p,
}
if err := pipeline.Execute(args); err != nil {
log.Errorf("error on execute chefsolo pipeline for box %s - %s", b.GetFullName(), err)
return err
}
fmt.Fprintf(w, "--- kickofff chefsolo box (%s) OK\n", b.GetFullName())
return nil
}