lib/vagrant-ovirt3/action/read_state.rb in vagrant-ovirt3-1.2.0 vs lib/vagrant-ovirt3/action/read_state.rb in vagrant-ovirt3-1.3.0
- old
+ new
@@ -14,23 +14,23 @@
def call(env)
env[:machine_state_id] = read_state(env[:ovirt_compute], env[:machine])
@app.call(env)
end
+ # Possible states include (but may not be limited to):
+ # :not_created, :up, :down, :saving_state, :suspended
def read_state(ovirt, machine)
return :not_created if machine.id.nil?
# Find the machine
server = ovirt.servers.get(machine.id)
- if server.nil? || [:"shutting-down", :terminated].include?(server.status.to_sym)
- # The machine can't be found
- @logger.info("Machine not found or terminated, assuming it got destroyed.")
+ if server.nil?
machine.id = nil
return :not_created
end
# Return the state
- return server.status
+ return server.status.to_sym
end
end
end
end
end