mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Merge pull request #902 from hashicorp/f-fs-error
Improved the error related to fs commands
This commit is contained in:
@@ -114,6 +114,13 @@ func (f *FSCatCommand) Run(args []string) int {
|
||||
}
|
||||
}
|
||||
|
||||
if alloc.DesiredStatus == "failed" {
|
||||
allocID := limit(alloc.ID, length)
|
||||
msg := fmt.Sprintf(`The allocation %q failed to be placed. To see the cause, run:
|
||||
nomad alloc-status %s`, allocID, allocID)
|
||||
f.Ui.Error(msg)
|
||||
return 0
|
||||
}
|
||||
// Stat the file to find it's size
|
||||
file, _, err := client.AllocFS().Stat(alloc, path, nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -120,6 +120,13 @@ func (f *FSListCommand) Run(args []string) int {
|
||||
}
|
||||
}
|
||||
|
||||
if alloc.DesiredStatus == "failed" {
|
||||
allocID := limit(alloc.ID, length)
|
||||
msg := fmt.Sprintf(`The allocation %q failed to be placed. To see the cause, run:
|
||||
nomad alloc-status %s`, allocID, allocID)
|
||||
f.Ui.Error(msg)
|
||||
return 0
|
||||
}
|
||||
// Get the file at the given path
|
||||
files, _, err := client.AllocFS().List(alloc, path, nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -119,6 +119,13 @@ func (f *FSStatCommand) Run(args []string) int {
|
||||
}
|
||||
}
|
||||
|
||||
if alloc.DesiredStatus == "failed" {
|
||||
allocID := limit(alloc.ID, length)
|
||||
msg := fmt.Sprintf(`The allocation %q failed to be placed. To see the cause, run:
|
||||
nomad alloc-status %s`, allocID, allocID)
|
||||
f.Ui.Error(msg)
|
||||
return 0
|
||||
}
|
||||
// Get the file information
|
||||
file, _, err := client.AllocFS().Stat(alloc, path, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user