本文整理汇总了Golang中github.com/appc/spec/schema/types.NewACName函数的典型用法代码示例。如果您正苦于以下问题:Golang NewACName函数的具体用法?Golang NewACName怎么用?Golang NewACName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewACName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: getAppName
// getAppName returns the app name to enter
// If one was supplied in the flags then it's simply returned
// If the PM contains a single app, that app's name is returned
// If the PM has multiple apps, the names are printed and an error is returned
func getAppName(p *pkgPod.Pod) (*types.ACName, error) {
if flagAppName != "" {
return types.NewACName(flagAppName)
}
// figure out the app name, or show a list if multiple are present
_, m, err := p.PodManifest()
if err != nil {
return nil, errwrap.Wrap(errors.New("error reading pod manifest"), err)
}
switch len(m.Apps) {
case 0:
return nil, fmt.Errorf("pod contains zero apps")
case 1:
return &m.Apps[0].Name, nil
default:
}
stderr.Print("pod contains multiple apps:")
for _, ra := range m.Apps {
stderr.Printf("\t%v", ra.Name)
}
return nil, fmt.Errorf("specify app using \"rkt enter --app= ...\"")
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:30,代码来源:enter.go
示例2: Set
func (pl *portList) Set(s string) error {
parts := strings.SplitN(s, ":", 3)
if len(parts) < 2 {
return fmt.Errorf("%q is not in name:[ip:]port format", s)
}
name, err := types.NewACName(parts[0])
if err != nil {
return errwrap.Wrap(fmt.Errorf("%q is not a valid port name", parts[0]), err)
}
portStr := parts[1]
var ip net.IP
if len(parts) == 3 {
portStr = parts[2]
ip = net.ParseIP(parts[1])
if ip == nil {
return fmt.Errorf("%q is not a valid IP", parts[1])
}
}
port, err := strconv.ParseUint(portStr, 10, 16)
if err != nil {
return fmt.Errorf("%q is not a valid port number", parts[1])
}
p := types.ExposedPort{
Name: *name,
HostPort: uint(port),
HostIP: ip,
}
*pl = append(*pl, p)
return nil
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:35,代码来源:run.go
示例3: getApp
// getApp returns the app to export
// If one was supplied in the flags then it's returned if present
// If the PM contains a single app, that app is returned
// If the PM has multiple apps, the names are printed and an error is returned
func getApp(p *pod) (*schema.RuntimeApp, error) {
apps, err := p.getApps()
if err != nil {
return nil, errwrap.Wrap(errors.New("problem getting the pod's app list"), err)
}
if flagExportAppName != "" {
exportAppName, err := types.NewACName(flagExportAppName)
if err != nil {
return nil, err
}
for _, ra := range apps {
if *exportAppName == ra.Name {
return &ra, nil
}
}
return nil, fmt.Errorf("app %s is not present in pod", flagExportAppName)
}
switch len(apps) {
case 0:
return nil, fmt.Errorf("pod contains zero apps")
case 1:
return &apps[0], nil
default:
}
stderr.Print("pod contains multiple apps:")
for _, ra := range apps {
stderr.Printf("\t%v", ra.Name)
}
return nil, fmt.Errorf("specify app using \"rkt export --app= ...\"")
}
开发者ID:nak3,项目名称:rkt,代码行数:38,代码来源:export.go
示例4: AddMount
// AddMount will add a mount point with the given name and path to the untarred
// ACI stored at a.CurrentACIPath. If the mount point already exists its value
// will be updated to the new value. readOnly signifies whether or not the
// mount point should be read only.
func (a *ACBuild) AddMount(name, path string, readOnly bool) (err error) {
if err = a.lock(); err != nil {
return err
}
defer func() {
if err1 := a.unlock(); err == nil {
err = err1
}
}()
acn, err := types.NewACName(name)
if err != nil {
return err
}
fn := func(s *schema.ImageManifest) error {
removeMount(*acn)(s)
if s.App == nil {
s.App = newManifestApp()
}
s.App.MountPoints = append(s.App.MountPoints,
types.MountPoint{
Name: *acn,
Path: path,
ReadOnly: readOnly,
})
return nil
}
return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:joshix,项目名称:acbuild,代码行数:34,代码来源:mounts.go
示例5: handleAppAnnotations
func handleAppAnnotations(w http.ResponseWriter, r *http.Request, pm *schema.PodManifest, im *schema.ImageManifest) {
defer r.Body.Close()
n := mux.Vars(r)["app"]
an, err := types.NewACName(n)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(w, "App name %q is not a valid AC Name", n)
return
}
anno := mergeAppAnnotations(im, pm, an)
out, err := anno.MarshalJSON()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprint(w, err.Error())
return
}
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(out)
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:25,代码来源:metadata_service.go
示例6: AddPort
// AddPort will add a port with the given name, protocol, port, and count to
// the untarred ACI stored at a.CurrentACIPath. If the port already exists its
// value will be updated to the new value. socketActivated signifies whether or
// not the application will be socket activated via this port.
func (a *ACBuild) AddPort(name, protocol string, port, count uint, socketActivated bool) (err error) {
if err = a.lock(); err != nil {
return err
}
defer func() {
if err1 := a.unlock(); err == nil {
err = err1
}
}()
acn, err := types.NewACName(name)
if err != nil {
return err
}
fn := func(s *schema.ImageManifest) error {
if s.App == nil {
s.App = newManifestApp()
}
removePort(*acn)(s)
s.App.Ports = append(s.App.Ports,
types.Port{
Name: *acn,
Protocol: protocol,
Port: port,
Count: count,
SocketActivated: socketActivated,
})
return nil
}
return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:dgonyeo,项目名称:acbuild,代码行数:36,代码来源:port.go
示例7: getAppName
// getAppName returns the app name to enter
// If one was supplied in the flags then it's simply returned
// If the PM contains a single app, that app's name is returned
// If the PM has multiple apps, the names are printed and an error is returned
func getAppName(p *pod) (*types.ACName, error) {
if flagAppName != "" {
return types.NewACName(flagAppName)
}
// figure out the app name, or show a list if multiple are present
b, err := ioutil.ReadFile(common.PodManifestPath(p.path()))
if err != nil {
return nil, errwrap.Wrap(errors.New("error reading pod manifest"), err)
}
m := schema.PodManifest{}
if err = m.UnmarshalJSON(b); err != nil {
return nil, errwrap.Wrap(errors.New("invalid pod manifest"), err)
}
switch len(m.Apps) {
case 0:
return nil, fmt.Errorf("pod contains zero apps")
case 1:
return &m.Apps[0].Name, nil
default:
}
stderr.Print("pod contains multiple apps:")
for _, ra := range m.Apps {
stderr.Printf("\t%v", ra.Name)
}
return nil, fmt.Errorf("specify app using \"rkt enter --app= ...\"")
}
开发者ID:hwinkel,项目名称:rkt,代码行数:35,代码来源:enter.go
示例8: handleAppAnnotation
func handleAppAnnotation(w http.ResponseWriter, r *http.Request, pm *schema.PodManifest, im *schema.ImageManifest) {
defer r.Body.Close()
n := mux.Vars(r)["name"]
k, err := types.NewACIdentifier(n)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(w, "App annotation name %q is not a valid AC Identifier", n)
return
}
n = mux.Vars(r)["app"]
an, err := types.NewACName(n)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(w, "App name %q is not a valid AC Name", n)
return
}
merged := mergeAppAnnotations(im, pm, an)
v, ok := merged.Get(k.String())
if !ok {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "App annotation %q not found", k)
return
}
w.Header().Add("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
w.Write([]byte(v))
}
开发者ID:hwinkel,项目名称:rkt,代码行数:32,代码来源:metadata_service.go
示例9: main
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("app-start", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
appName, err := types.NewACName(flagApp)
if err != nil {
log.FatalE("invalid app name", err)
}
enterCmd := stage1common.PrepareEnterCmd(false)
args := enterCmd
args = append(args, "/usr/bin/systemctl")
args = append(args, "start")
args = append(args, appName.String())
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
if out, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("%q failed to start:\n%s", appName, out)
}
os.Exit(0)
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:33,代码来源:app-start.go
示例10: RunOCI2ACI
// Entry point of oci2aci,
// First convert oci layout to aci layout, then build aci layout to image.
func RunOCI2ACI(args []string, flagDebug bool, flagName string) error {
var srcPath, dstPath string
srcPath = args[0]
if len(args) == 1 {
dstPath = ""
} else {
dstPath = args[1]
ext := filepath.Ext(dstPath)
if ext != schema.ACIExtension {
errStr := fmt.Sprintf("Extension must be %s (given %s)", schema.ACIExtension, ext)
err := errors.New(errStr)
return err
}
}
if flagDebug {
logrus.SetLevel(logrus.DebugLevel)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
manifestName = flagName
_, err := types.NewACName(manifestName)
if err != nil {
return err
}
if bValidate := validateOCIProc(srcPath); bValidate != true {
logrus.Infof("Conversion stop.")
return nil
}
dirWork := createWorkDir()
// First, convert layout
manifestPath, err := convertLayout(srcPath, dirWork)
if err != nil {
logrus.Debugf("Conversion from oci to aci layout failed: %v", err)
} else {
logrus.Debugf("Manifest:%v generated successfully.", manifestPath)
}
// Second, build image
imgPath, err := buildACI(dirWork)
if err != nil {
logrus.Debugf("Generate aci image failed:%v", err)
} else {
logrus.Debugf("Image:%v generated successfully.", imgPath)
}
// Save aci image to the path user specified
if dstPath != "" {
if err = run(exec.Command("cp", imgPath, dstPath)); err != nil {
logrus.Debugf("Store aci image failed:%v", err)
} else {
logrus.Debugf("Image:%v generated successfully", dstPath)
}
}
return nil
}
开发者ID:liangchenye,项目名称:oci2aci,代码行数:61,代码来源:convert.go
示例11: runAppStart
func runAppStart(cmd *cobra.Command, args []string) (exit int) {
if len(args) < 1 {
stderr.Print("must provide the pod UUID")
return 1
}
if flagAppName == "" {
stderr.Print("must provide the app to start")
return 1
}
p, err := pkgPod.PodFromUUIDString(getDataDir(), args[0])
if err != nil {
stderr.PrintE("problem retrieving pod", err)
return 1
}
defer p.Close()
if p.State() != pkgPod.Running {
stderr.Printf("pod %q isn't currently running", p.UUID)
return 1
}
appName, err := types.NewACName(flagAppName)
if err != nil {
stderr.PrintE("invalid app name", err)
}
podPID, err := p.ContainerPid1()
if err != nil {
stderr.PrintE(fmt.Sprintf("unable to determine the pid for pod %q", p.UUID), err)
return 1
}
cfg := stage0.CommonConfig{
DataDir: getDataDir(),
UUID: p.UUID,
Debug: globalFlags.Debug,
}
scfg := stage0.StartConfig{
CommonConfig: &cfg,
PodPath: p.Path(),
AppName: appName,
PodPID: podPID,
}
if globalFlags.Debug {
stage0.InitDebug()
}
err = stage0.StartApp(scfg)
if err != nil {
stderr.PrintE("error starting app", err)
return 1
}
return 0
}
开发者ID:joshix,项目名称:rkt,代码行数:59,代码来源:app_start.go
示例12: buildTestAci
func (aci *Aci) buildTestAci() (string, error) {
manifest, err := common.ExtractManifestFromAci(aci.target + common.PathImageAci)
if err != nil {
return "", errs.WithEF(err, aci.fields.WithField("file", aci.target+common.PathImageAci), "Failed to extract manifest from aci")
}
name := prefixTest + manifest.Name.String()
if version, ok := manifest.Labels.Get("version"); ok {
name += ":" + version
}
fullname := common.NewACFullName(name)
resultMountName, _ := types.NewACName(mountAcname)
aciManifest := &common.AciManifest{
Builder: aci.manifest.Tester.Builder,
Aci: common.AciDefinition{
App: common.DgrApp{
Exec: aci.manifest.Aci.App.Exec,
MountPoints: []types.MountPoint{{Path: pathTestsResult, Name: *resultMountName}},
WorkingDirectory: aci.manifest.Aci.App.WorkingDirectory,
User: aci.manifest.Aci.App.User,
Group: aci.manifest.Aci.App.Group,
SupplementaryGIDs: aci.manifest.Aci.App.SupplementaryGIDs,
Environment: aci.manifest.Aci.App.Environment,
Ports: aci.manifest.Aci.App.Ports,
Isolators: aci.manifest.Aci.App.Isolators,
},
Dependencies: append(aci.manifest.Tester.Aci.Dependencies, *common.NewACFullName(name[len(prefixTest):])),
Annotations: aci.manifest.Aci.Annotations,
PathWhitelist: aci.manifest.Aci.PathWhitelist,
},
NameAndVersion: *fullname,
}
content, err := yaml.Marshal(aciManifest)
if err != nil {
return "", errs.WithEF(err, aci.fields, "Failed to marshall manifest for test aci")
}
testAci, err := NewAciWithManifest(aci.path, aci.args, string(content), aci.checkWg)
if err != nil {
return "", errs.WithEF(err, aci.fields, "Failed to prepare test's build aci")
}
testAci.FullyResolveDep = false // this is required to run local tests without discovery
testAci.target = aci.target + pathTestsTarget
if err := testAci.CleanAndBuild(); err != nil {
return "", errs.WithEF(err, aci.fields, "Build of test aci failed")
}
hash, err := Home.Rkt.Fetch(aci.target + pathTestsTarget + pathImageAci)
if err != nil {
return "", errs.WithEF(err, aci.fields, "fetch of test aci failed")
}
return hash, nil
}
开发者ID:blablacar,项目名称:dgr,代码行数:57,代码来源:aci-test.go
示例13: Set
func (mf *MountsFlag) Set(val string) error {
mnt := schema.Mount{}
pieces := strings.SplitN(val, ":", 2)
if name, err := types.NewACName(pieces[0]); err != nil {
return err
} else {
mnt.Volume = *name
}
if len(pieces) == 1 {
mnt.MountPoint = mnt.Volume
} else if name, err := types.NewACName(pieces[1]); err != nil {
return err
} else {
mnt.MountPoint = *name
}
*mf = append(*mf, mnt)
return nil
}
开发者ID:sdoumbouya,项目名称:jetpack,代码行数:18,代码来源:flags.go
示例14: processAci
func (p *Pod) processAci(e common.RuntimeApp) (*schema.RuntimeApp, error) {
aci, err := p.buildAci(e)
if err != nil {
return nil, err
}
name, err := types.NewACName(e.Name)
if err != nil {
return nil, errs.WithEF(err, p.fields.WithField("name", e.Name), "Invalid name format")
}
sum, err := Sha512sum(aci.target + pathImageAci)
if err != nil {
return nil, errs.WithEF(err, p.fields.WithField("file", aci.target+pathImageAci), "Failed to calculate sha512 of aci")
}
tmp, _ := types.NewHash("sha512-" + sum)
labels := types.Labels{}
labels = append(labels, types.Label{Name: "version", Value: aci.manifest.NameAndVersion.Version()})
identifier, _ := types.NewACIdentifier(aci.manifest.NameAndVersion.Name())
ttmp := schema.RuntimeImage{Name: identifier, ID: *tmp, Labels: labels}
e.App.Group = aci.manifest.Aci.App.Group
e.App.User = aci.manifest.Aci.App.User
if e.App.User == "" {
e.App.User = "0"
}
if e.App.Group == "" {
e.App.Group = "0"
}
isolators, err := common.ToAppcIsolators(e.App.Isolators)
if err != nil {
return nil, errs.WithEF(err, p.fields, "Failed to prepare isolators")
}
return &schema.RuntimeApp{
Name: *name,
Image: ttmp,
App: &types.App{
Exec: e.App.Exec,
User: e.App.User,
Group: e.App.Group,
WorkingDirectory: e.App.WorkingDirectory,
SupplementaryGIDs: e.App.SupplementaryGIDs,
Environment: e.App.Environment,
MountPoints: e.App.MountPoints,
Ports: e.App.Ports,
Isolators: isolators,
},
Mounts: e.Mounts,
Annotations: e.Annotations}, nil
}
开发者ID:nyodas,项目名称:cnt,代码行数:54,代码来源:pod-build.go
示例15: Set
func (apl *appPortList) Set(s string) error {
parts := strings.SplitN(s, ":", 5)
if len(parts) != 5 {
return fmt.Errorf("--port invalid format")
}
// parsey parsey
name, err := types.NewACName(parts[0])
if err != nil {
return err
}
proto := parts[1]
switch proto {
case "tcp", "udp":
default:
return fmt.Errorf("invalid protocol %q", proto)
}
p, err := strconv.ParseUint(parts[2], 10, 16)
if err != nil {
return err
}
podPortNo := uint(p)
ip := net.ParseIP(parts[3])
if ip == nil {
return fmt.Errorf("could not parse IP %q", ip)
}
p, err = strconv.ParseUint(parts[4], 10, 16)
if err != nil {
return err
}
hostPortNo := uint(p)
podSide := types.Port{
Name: *name,
Protocol: proto,
Port: podPortNo,
Count: 1,
SocketActivated: false,
}
hostSide := types.ExposedPort{
Name: *name,
HostPort: hostPortNo,
HostIP: ip,
PodPort: &podSide,
}
*apl = append(*apl, hostSide)
return nil
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:54,代码来源:app_sandbox.go
示例16: processAci
func (p *Pod) processAci() []schema.RuntimeApp {
apps := []schema.RuntimeApp{}
for _, e := range p.manifest.Pod.Apps {
aciName := p.buildAciIfNeeded(e)
// TODO: support not FS override by only storing info pod manifest
// if aciName == nil {
// aciName = &e.Image
// }
name, _ := types.NewACName(e.Name)
sum, err := utils.Sha512sum(p.path + "/" + e.Name + "/target/image.aci")
if err != nil {
log.Get().Panic(err)
}
tmp, _ := types.NewHash("sha512-" + sum)
labels := types.Labels{}
labels = append(labels, types.Label{Name: "version", Value: aciName.Version()})
identifier, _ := types.NewACIdentifier(aciName.Name())
ttmp := schema.RuntimeImage{Name: identifier, ID: *tmp, Labels: labels}
if e.App.User == "" {
e.App.User = "0"
}
if e.App.Group == "" {
e.App.Group = "0"
}
apps = append(apps, schema.RuntimeApp{
Name: *name,
Image: ttmp,
App: &types.App{
Exec: e.App.Exec,
EventHandlers: e.App.EventHandlers,
User: e.App.User,
Group: e.App.Group,
WorkingDirectory: e.App.WorkingDirectory,
Environment: e.App.Environment,
MountPoints: e.App.MountPoints,
Ports: e.App.Ports,
Isolators: e.App.Isolators,
},
Mounts: e.Mounts,
Annotations: e.Annotations})
}
return apps
}
开发者ID:PrFalken,项目名称:cnt,代码行数:52,代码来源:pod-build.go
示例17: processAci
func (p *Pod) processAci() []schema.RuntimeApp {
apps := []schema.RuntimeApp{}
for _, e := range p.manifest.Pod.Apps {
aci := p.buildAci(e)
name, _ := types.NewACName(e.Name)
sum, err := utils.Sha512sum(aci.target + "/image.aci")
if err != nil {
panic(err)
}
tmp, _ := types.NewHash("sha512-" + sum)
labels := types.Labels{}
labels = append(labels, types.Label{Name: "version", Value: aci.manifest.NameAndVersion.Version()})
identifier, _ := types.NewACIdentifier(aci.manifest.NameAndVersion.Name())
ttmp := schema.RuntimeImage{Name: identifier, ID: *tmp, Labels: labels}
if e.App.User == "" {
e.App.User = "0"
}
if e.App.Group == "" {
e.App.Group = "0"
}
apps = append(apps, schema.RuntimeApp{
Name: *name,
Image: ttmp,
App: &types.App{
Exec: e.App.Exec,
User: e.App.User,
Group: e.App.Group,
WorkingDirectory: e.App.WorkingDirectory,
Environment: e.App.Environment,
MountPoints: e.App.MountPoints,
Ports: e.App.Ports,
Isolators: e.App.Isolators,
},
Mounts: e.Mounts,
Annotations: e.Annotations})
}
return apps
}
开发者ID:HimanshPal,项目名称:cnt,代码行数:46,代码来源:pod-build.go
示例18: prepareTestAci
func (cnt *Img) prepareTestAci() (*Img, error) {
files, err := ioutil.ReadDir(cnt.path + PATH_TESTS)
if err != nil {
return nil, err
}
utils.CopyDir(cnt.path+PATH_TESTS+PATH_FILES, cnt.target+PATH_TESTS+PATH_FILES)
utils.CopyDir(cnt.path+PATH_TESTS+PATH_ATTRIBUTES, cnt.target+PATH_TESTS+PATH_ATTRIBUTES)
utils.CopyDir(cnt.path+PATH_TESTS+PATH_CONFD, cnt.target+PATH_TESTS+PATH_CONFD)
utils.CopyDir(cnt.path+PATH_TESTS+PATH_RUNLEVELS, cnt.target+PATH_TESTS+PATH_RUNLEVELS)
os.MkdirAll(cnt.target+PATH_TESTS+PATH_FILES+PATH_TESTS, 0777)
for _, f := range files {
if !f.IsDir() {
if err := utils.CopyFile(cnt.path+PATH_TESTS+"/"+f.Name(), cnt.target+PATH_TESTS+PATH_FILES+PATH_TESTS+"/"+f.Name()); err != nil {
panic(err)
}
}
}
ExecScript := strings.Replace(TEST_INIT_SCRIPT, "%%COMMAND%%", "'"+strings.Join(cnt.manifest.Aci.App.Exec, "' '")+"'", 1)
ExecScript = strings.Replace(ExecScript, "%%CWD%%", "'"+cnt.manifest.Aci.App.WorkingDirectory+"'", 2)
ioutil.WriteFile(cnt.target+PATH_TESTS+PATH_FILES+"/init.sh", []byte(ExecScript), 0777)
fullname, err := spec.NewACFullName(cnt.manifest.NameAndVersion.Name() + "_test:" + cnt.manifest.NameAndVersion.Version())
if err != nil {
panic(err)
}
resultMountName, _ := types.NewACName("result")
testAci, err := NewAciWithManifest(cnt.target+PATH_TESTS, cnt.args, spec.AciManifest{
Aci: spec.AciDefinition{
App: &spec.CntApp{
Exec: []string{"/init.sh"},
MountPoints: []types.MountPoint{{Path: PATH_RESULT, Name: *resultMountName}},
},
Dependencies: []spec.ACFullname{BATS_ACI, cnt.manifest.NameAndVersion},
},
NameAndVersion: *fullname,
}, nil)
if err != nil {
panic("Cannot build test aci" + err.Error())
}
return testAci, nil
}
开发者ID:vcaputo,项目名称:cnt,代码行数:46,代码来源:aci-test.go
示例19: RemoveMount
// RemoveMount will remove the mount point with the given name from the
// untarred ACI stored at a.CurrentACIPath
func (a *ACBuild) RemoveMount(name string) (err error) {
if err = a.lock(); err != nil {
return err
}
defer func() {
if err1 := a.unlock(); err == nil {
err = err1
}
}()
acn, err := types.NewACName(name)
if err != nil {
return err
}
return util.ModifyManifest(removeMount(*acn), a.CurrentACIPath)
}
开发者ID:joshix,项目名称:acbuild,代码行数:19,代码来源:mounts.go
示例20: AppImageManifest
// AppImageManifest returns an ImageManifest for the app.
func (p *Pod) AppImageManifest(appName string) (*schema.ImageManifest, error) {
appACName, err := types.NewACName(appName)
if err != nil {
return nil, err
}
imb, err := ioutil.ReadFile(common.AppImageManifestPath(p.Path(), *appACName))
if err != nil {
return nil, err
}
aim := &schema.ImageManifest{}
if err := aim.UnmarshalJSON(imb); err != nil {
return nil, errwrap.Wrap(fmt.Errorf("invalid image manifest for app %q", appName), err)
}
return aim, nil
}
开发者ID:joshix,项目名称:rkt,代码行数:18,代码来源:pods.go
注:本文中的github.com/appc/spec/schema/types.NewACName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论