From c862454b60684e1ad576677598d18bbe4c9ff1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gonz=C3=A1lez?= Date: Mon, 11 Jun 2018 10:33:02 +0200 Subject: [PATCH] F#2153 Now `onehost flush` use ONE_LOCATION env variable (#2165) --- src/cli/onehost | 11 ++++++++++- src/oca/ruby/opennebula/host.rb | 8 +------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cli/onehost b/src/cli/onehost index a55067bc2d..986dc12e21 100755 --- a/src/cli/onehost +++ b/src/cli/onehost @@ -244,8 +244,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do EOT command :flush, flush_desc, [:range,:hostid_list] do + begin + if !ONE_LOCATION + action = YAML.load_file("/etc/one/cli/onehost.yaml")[:default_actions][0][:flush] + else + action = YAML.load_file("#{ONE_LOCATION}/etc/cli/onehost.yaml")[:default_actions][0][:flush] + end + rescue Exception => e + STDERR.puts e + end helper.perform_actions(args[0],options,"flush") do |host| - host.flush + host.flush action end end diff --git a/src/oca/ruby/opennebula/host.rb b/src/oca/ruby/opennebula/host.rb index 0bfa236b6d..2250642143 100644 --- a/src/oca/ruby/opennebula/host.rb +++ b/src/oca/ruby/opennebula/host.rb @@ -125,15 +125,9 @@ module OpenNebula set_status("OFFLINE") end - def flush() + def flush(action) self.disable - begin - action = YAML.load_file("/etc/one/cli/onehost.yaml")[:default_actions][0][:flush] - rescue Exception => e - STDERR.puts e - end - vm_pool = OpenNebula::VirtualMachinePool.new(@client, VirtualMachinePool::INFO_ALL_VM)