本文整理汇总了Golang中github.com/blablacar/cnt/log.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Push
func (p *Pod) Push() {
log.Get().Info("Push POD", p.manifest.Name)
p.Build()
for _, e := range p.manifest.Pod.Apps {
aci, err := NewAciWithManifest(p.path+"/"+e.Name, p.args, p.toAciManifest(e))
if err != nil {
log.Get().Panic(err)
}
aci.PodName = &p.manifest.Name
aci.Push()
}
utils.ExecCmd("curl", "-i",
"-F", "r=releases",
"-F", "hasPom=false",
"-F", "e=pod",
"-F", "g=com.blablacar.aci.linux.amd64",
"-F", "p=pod",
"-F", "v="+p.manifest.Name.Version(),
"-F", "a="+p.manifest.Name.ShortName(),
"-F", "[email protected]"+p.target+POD_TARGET_MANIFEST,
"-u", config.GetConfig().Push.Username+":"+config.GetConfig().Push.Password,
config.GetConfig().Push.Url+"/service/local/artifact/maven/content")
}
开发者ID:PrFalken,项目名称:cnt,代码行数:27,代码来源:pod-push.go
示例2: Test
func (cnt *Img) Test() {
log.Get().Info("Testing " + cnt.manifest.NameAndVersion)
if _, err := os.Stat(cnt.target + "/image.aci"); os.IsNotExist(err) {
if err := cnt.Build(); err != nil {
log.Get().Panic("Cannot Install since build failed")
}
}
// prepare runner in target
// run contauner with mout mpoint
// run real service in background
// run tests
//
// BATS
os.MkdirAll(cnt.target+"/test", 0777)
bats.WriteBats(cnt.target + "/test")
// if err := utils.ExecCmd("systemd-nspawn", "--directory=" + cnt.rootfs, "--capability=all",
// "--bind=" + cnt.target + "/:/target", "--share-system", "target/build.sh"); err != nil {
// log.Get().Panic("Build step did not succeed", err)
//
//
// utils.ExecCmd("rkt", "--insecure-skip-verify=true", "run", cnt.target + "/image.aci") // TODO missing command override that will arrive in next RKT version
// }
}
开发者ID:PrFalken,项目名称:cnt,代码行数:26,代码来源:aci-test.go
示例3: discoverAndRunUpdateType
func discoverAndRunUpdateType(path string, args builder.BuildArgs) {
if cnt, err := builder.NewAci(path, args); err == nil {
cnt.UpdateConf()
} else if _, err := builder.OpenPod(path, args); err == nil {
log.Get().Panic("Not Yet implemented for pods")
} else {
log.Get().Panic("Cannot find cnt-manifest.yml")
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:9,代码来源:cnt.go
示例4: copyRunlevelsPrestart
func (cnt *Img) copyRunlevelsPrestart() {
if err := os.MkdirAll(cnt.rootfs+"/etc/prestart/late-prestart.d", 0755); err != nil {
log.Get().Panic(err)
}
if err := os.MkdirAll(cnt.rootfs+"/etc/prestart/early-prestart.d", 0755); err != nil {
log.Get().Panic(err)
}
utils.CopyDir(cnt.path+RUNLEVELS_PRESTART, cnt.rootfs+"/etc/prestart/early-prestart.d")
utils.CopyDir(cnt.path+RUNLEVELS_LATESTART, cnt.rootfs+"/etc/prestart/late-prestart.d")
}
开发者ID:PrFalken,项目名称:cnt,代码行数:10,代码来源:aci-build.go
示例5: WritePodManifest
func WritePodManifest(im *schema.PodManifest, targetFile string) {
buff, err := im.MarshalJSON()
if err != nil {
log.Get().Panic(err)
}
err = ioutil.WriteFile(targetFile, []byte(buff), 0644)
if err != nil {
log.Get().Panic(err)
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:10,代码来源:pod-manifest.go
示例6: Test
func (p *Pod) Test() {
log.Get().Info("Testing POD", p.manifest.Name)
for _, e := range p.manifest.Pod.Apps {
aci, err := NewAciWithManifest(p.path+"/"+e.Name, p.args, p.toAciManifest(e))
if err != nil {
log.Get().Panic(err)
}
aci.PodName = &p.manifest.Name
aci.Test()
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:12,代码来源:pod-test.go
示例7: UnmarshalJSON
func (n *ACFullname) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
log.Get().Panic(err)
return err
}
nn, err := NewACFullName(s)
if err != nil {
log.Get().Panic(err)
return err
}
*n = *nn
return nil
}
开发者ID:PrFalken,项目名称:cnt,代码行数:14,代码来源:ac-fullname.go
示例8: copyConfd
func (cnt *Img) copyConfd() {
if err := os.MkdirAll(cnt.rootfs+"/etc/prestart/", 0755); err != nil {
log.Get().Panic(err)
}
utils.CopyDir(cnt.path+CONFD_CONFIG, cnt.rootfs+"/etc/prestart/conf.d")
utils.CopyDir(cnt.path+CONFD_TEMPLATE, cnt.rootfs+"/etc/prestart/templates")
}
开发者ID:PrFalken,项目名称:cnt,代码行数:7,代码来源:aci-build.go
示例9: Clean
func (p *Pod) Clean() {
log.Get().Info("Cleaning POD", p.manifest.Name)
if err := os.RemoveAll(p.target + "/"); err != nil {
log.Get().Panic("Cannot clean", p.manifest.Name, err)
}
for _, e := range p.manifest.Pod.Apps {
aci, err := NewAciWithManifest(p.path+"/"+e.Name, p.args, p.toAciManifest(e))
if err != nil {
log.Get().Panic(err)
}
aci.PodName = &p.manifest.Name
aci.Clean()
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:16,代码来源:pod-clean.go
示例10: ExecCmd
func ExecCmd(head string, parts ...string) error {
log.Get().Debug("Exec > ", head, " ", strings.Join(parts, " "))
cmd := exec.Command(head, parts...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
开发者ID:PrFalken,项目名称:cnt,代码行数:7,代码来源:utils.go
示例11: UserHomeOrFatal
func UserHomeOrFatal() string {
usr, err := homedir.Dir()
if err != nil {
log.Get().Panic(err)
}
return usr
}
开发者ID:PrFalken,项目名称:cnt,代码行数:7,代码来源:utils.go
示例12: checkBuilt
func (i *Img) checkBuilt() {
if _, err := os.Stat(i.target + "/image.aci"); os.IsNotExist(err) {
if err := i.Build(); err != nil {
log.Get().Panic("Cannot Install since build failed")
}
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:7,代码来源:aci.go
示例13: NewAci
func NewAci(path string, args BuildArgs) (*Img, error) {
manifest, err := readManifest(path + IMG_MANIFEST)
if err != nil {
log.Get().Debug(path, IMG_MANIFEST+" does not exists")
return nil, err
}
return NewAciWithManifest(path, args, *manifest)
}
开发者ID:PrFalken,项目名称:cnt,代码行数:8,代码来源:aci.go
示例14: writeImgManifest
func (cnt *Img) writeImgManifest() {
log.Get().Debug("Writing aci manifest")
version := cnt.manifest.NameAndVersion.Version()
if version == "" {
version = utils.GenerateVersion()
}
utils.WriteImageManifest(&cnt.manifest, cnt.target+"/manifest", cnt.manifest.NameAndVersion.Name(), version)
}
开发者ID:PrFalken,项目名称:cnt,代码行数:8,代码来源:aci-build.go
示例15: runlevelBuildSetup
func (cnt *Img) runlevelBuildSetup() {
files, err := ioutil.ReadDir(cnt.path + RUNLEVELS_BUILD_SETUP)
if err != nil {
return
}
os.Setenv("BASEDIR", cnt.path)
os.Setenv("TARGET", cnt.target)
for _, f := range files {
if !f.IsDir() {
log.Get().Info("Running Build setup level : ", f.Name())
if err := utils.ExecCmd(cnt.path + RUNLEVELS_BUILD_SETUP + "/" + f.Name()); err != nil {
log.Get().Panic(err)
}
}
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:17,代码来源:aci-build.go
示例16: NewAciWithManifest
func NewAciWithManifest(path string, args BuildArgs, manifest spec.AciManifest) (*Img, error) {
log.Get().Debug("New aci", path, args, manifest)
cnt, err := PrepAci(path, args)
if err != nil {
return nil, err
}
cnt.manifest = manifest
return cnt, nil
}
开发者ID:PrFalken,项目名称:cnt,代码行数:9,代码来源:aci.go
示例17: Execute
func Execute() {
log.Set(logger.NewLogger())
currentAbsDir, err := filepath.Abs("")
if err != nil {
log.Get().Panic("Cannot find current absolute directory")
}
var rootCmd = &cobra.Command{Use: "cnt"}
buildCmd.Flags().BoolVarP(&buildArgs.Zip, "nozip", "z", false, "Zip final image or not")
rootCmd.PersistentFlags().BoolVarP(&buildArgs.Clean, "clean", "c", false, "Clean before doing anything")
rootCmd.PersistentFlags().StringVarP(&buildArgs.TargetPath, "target-path", "t", currentAbsDir, "Set target path")
rootCmd.AddCommand(buildCmd, cleanCmd, pushCmd, installCmd, testCmd, versionCmd, initCmd, updateCmd)
config.GetConfig().Load()
rootCmd.Execute()
log.Get().Info("Victory !")
}
开发者ID:PrFalken,项目名称:cnt,代码行数:18,代码来源:cnt.go
示例18: tarAci
func (cnt *Img) tarAci() {
dir, _ := os.Getwd()
log.Get().Debug("chdir to", cnt.target)
os.Chdir(cnt.target)
args := []string{"manifest", "rootfs/"}
if _, err := os.Stat(cnt.path + RUNLEVELS_BUILD_INHERIT_EARLY); err == nil {
args = append(args, strings.TrimPrefix(RUNLEVELS_BUILD_INHERIT_EARLY, "/"))
}
if _, err := os.Stat(cnt.path + RUNLEVELS_BUILD_INHERIT_LATE); err == nil {
args = append(args, strings.TrimPrefix(RUNLEVELS_BUILD_INHERIT_LATE, "/"))
}
utils.Tar(cnt.args.Zip, "image.aci", args...)
log.Get().Debug("chdir to", dir)
os.Chdir(dir)
}
开发者ID:PrFalken,项目名称:cnt,代码行数:18,代码来源:aci-build.go
示例19: discoverAndRunTestType
func discoverAndRunTestType(path string, args builder.BuildArgs) {
if cnt, err := builder.NewAci(path, args); err == nil {
cnt.Test()
} else if pod, err := builder.OpenPod(path, args); err == nil {
pod.Test()
} else {
log.Get().Panic("Cannot find cnt-manifest.yml")
}
}
开发者ID:PrFalken,项目名称:cnt,代码行数:9,代码来源:cnt.go
示例20: Build
func (p *Pod) Build() {
log.Get().Info("Building POD : ", p.manifest.Name)
os.MkdirAll(p.target, 0777)
os.Remove(p.target + POD_TARGET_MANIFEST)
apps := p.processAci()
p.writePodManifest(apps)
}
开发者ID:PrFalken,项目名称:cnt,代码行数:10,代码来源:pod-build.go
注:本文中的github.com/blablacar/cnt/log.Get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论