mirror of
https://github.com/clearlinux/rkt.git
synced 2026-09-05 21:31:38 +00:00
rkt: better error messages when users don't give enough volumes
Example of output: | $ rkt --debug --insecure-skip-verify run docker://redis | Failed to generate nspawn args: no volume for mountpoint "volume-/data" in app "redis". | You can inspect the volumes with: | sudo rkt image cat-manifest --pretty-print sha512-f95f15ce81345214328fdbe9407fdac3e46de0c11ceb69e8da5b0d1aa3158dfc | App "redis" requires the following volumes: | --volume volume-/data,kind=host,source=/some/path Fixes: https://github.com/coreos/rkt/issues/943
This commit is contained in:
+1
-1
@@ -365,7 +365,7 @@ func stage1() int {
|
||||
|
||||
args, env, err := getArgsEnv(p, flavor, systemdVersion, debug)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to get execution parameters: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
return 3
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -327,7 +327,16 @@ func (p *Pod) appToNspawnArgs(ra *schema.RuntimeApp, am *schema.ImageManifest) (
|
||||
key := mp.Name
|
||||
vol, ok := vols[key]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no volume for mountpoint %q in app %q", key, name)
|
||||
catCmd := fmt.Sprintf("sudo rkt image cat-manifest --pretty-print %v", id)
|
||||
volumeCmd := ""
|
||||
for _, mp := range app.MountPoints {
|
||||
volumeCmd += fmt.Sprintf("--volume %s,kind=host,source=/some/path ", mp.Name)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no volume for mountpoint %q in app %q.\n"+
|
||||
"You can inspect the volumes with:\n\t%v\n"+
|
||||
"App %q requires the following volumes:\n\t%v",
|
||||
key, name, catCmd, name, volumeCmd)
|
||||
}
|
||||
opt := make([]string, 4)
|
||||
|
||||
@@ -385,7 +394,7 @@ func (p *Pod) PodToNspawnArgs() ([]string, error) {
|
||||
}
|
||||
aa, err := p.appToNspawnArgs(ra, am)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to construct args for app %q: %v", am.Name, err)
|
||||
return nil, err
|
||||
}
|
||||
args = append(args, aa...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user