[PATCH 1/3] BZ830987: build_command: template can be read from URL

mzatko at redhat.com mzatko at redhat.com
Wed Jul 18 16:34:57 UTC 2012


From: Maros Zatko <mzatko at redhat.com>

---
 lib/aeolus_cli/command/build_command.rb |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/aeolus_cli/command/build_command.rb b/lib/aeolus_cli/command/build_command.rb
index a3e5341..c2978e9 100644
--- a/lib/aeolus_cli/command/build_command.rb
+++ b/lib/aeolus_cli/command/build_command.rb
@@ -12,6 +12,8 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
+require 'open-uri'
+
 module Aeolus
   module CLI
     class BuildCommand < BaseCommand
@@ -73,13 +75,14 @@ module Aeolus
       end
 
       def read_template
-        template = read_file(@options[:template])
-        if template.nil?
-          puts "Error: Cannot find specified file"
-          quit(1)
+        begin
+          f = open(@options[:template])
+          return f.read
+        rescue Errno::ENOENT => e
+          puts "Error: Cannot open '#{e}'"
+          exit(1)
         end
-        template
-      end
+     end
 
       def combo_implemented?
         if @options[:template].empty? || @options[:target].empty? || @options[:environment].nil?
-- 
1.7.10.4




More information about the aeolus-devel mailing list