From d12333d542ade15b37b882ef04662d9951737ee7 Mon Sep 17 00:00:00 2001 From: Matthias Schmitz Date: Thu, 26 Mar 2015 22:57:33 +0100 Subject: [PATCH] Check if an given image is readable in oneimage. When running "oneimage create --path .." the tool should check not only for the existence but also for the readability of the given image. If the image is unreadable (one user create the image an other tries to upload it) the image will be created in ERROR state in the datastore. --- src/cli/one_helper/oneimage_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/one_helper/oneimage_helper.rb b/src/cli/one_helper/oneimage_helper.rb index 177e23a0e7..068a417a85 100644 --- a/src/cli/one_helper/oneimage_helper.rb +++ b/src/cli/one_helper/oneimage_helper.rb @@ -86,10 +86,10 @@ class OneImageHelper < OpenNebulaHelper::OneHelper path=Dir.pwd+"/"+o end - if File.exist?(path) + if File.readable?(path) [0, path] else - [-1, "File '#{path}' does not exist."] + [-1, "File '#{path}' does not exist or is not readable."] end end },