lib/sushi_fabric/sushiApp.rb in sushi_fabric-0.7.3 vs lib/sushi_fabric/sushiApp.rb in sushi_fabric-0.7.4
- old
+ new
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# encoding: utf-8
-# Version = '20170410-034927'
+# Version = '20170413-113844'
require 'csv'
require 'fileutils'
require 'yaml'
require 'drb/drb'
@@ -365,20 +365,12 @@
def prepare_result_dir
FileUtils.mkdir_p(@scratch_result_dir)
FileUtils.mkdir_p(@job_script_dir)
end
def check_latest_module_version(mod)
- command = "module whatis #{mod}"
- IO.popen(command) do |io|
- latest_mod = nil
- while line = io.gets
- unless line.chomp.strip.empty?
- latest_mod = line.split.first
- break
- end
- end
- end
+ command_out = %x[ bash -lc "source #{@module_source}; module whatis #{mod} 2>&1" ]
+ latest_mod = command_out.split.first
latest_mod = nil if latest_mod == "Failed"
latest_mod
end
def job_header
@scratch_dir = if @params['process_mode'] == 'SAMPLE'
@@ -396,13 +388,13 @@
"source #{@module_source}"
else
""
end
module_add_commands = if @modules and !@modules.empty?
- #modules_with_version = @modules.map{|mod| check_latest_module_version(mod)}
- #modules_with_version.compact!
- #"module add #{modules_with_version.join(' ')}"
- "module add #{@modules.join(' ')}"
+ modules_with_version = @modules.map{|mod| check_latest_module_version(mod)}
+ modules_with_version.compact!
+ "module add #{modules_with_version.join(' ')}"
+ #"module add #{@modules.join(' ')}"
else
""
end
@out.print <<-EOF
#!/bin/bash