lib/rundock/plugin/operation/deploy.rb in rundock-0.5.4 vs lib/rundock/plugin/operation/deploy.rb in rundock-0.5.7

- old
+ new

@@ -49,26 +49,26 @@ Logger.error('src: options not found.') if !opt.key?(:src) || opt[:src].blank? Logger.error('dst: options not found.') if !opt.key?(:dst) || opt[:dst].blank? is_erb = opt.key?(:erb) && opt[:erb] - if opt.key?(:trim_mode) - trim_mode = opt[:trim_mode] - else - trim_mode = DEFAULT_TRIM_MODE - end + trim_mode = if opt.key?(:trim_mode) + opt[:trim_mode] + else + DEFAULT_TRIM_MODE + end erb_options = '' erb_options = " erb: true trim_mode: #{trim_mode}" if is_erb Logger.info("deploy localhost: #{opt[:src]} remote:#{attributes[:nodeinfo][:host]}:#{opt[:dst]}#{erb_options}") Logger.debug("deploy erb binding: #{opt[:binding]}") if is_erb - if is_erb - val_binding = extract_map(backend, opt[:binding]) - else - val_binding = {} - end + val_binding = if is_erb + extract_map(backend, opt[:binding]) + else + {} + end if is_erb erb_content = conv_erb(opt[:src], trim_mode, val_binding) tempfile = Tempfile.new('', Dir.tmpdir)