Sha256: 4c3ea7fa40d7de6097036c612d7715da0fef8043d3da953bc0ff998b2c251523

Contents?: true

Size: 1.74 KB

Versions: 14

Compression:

Stored size: 1.74 KB

Contents

#    This file is part of RestConnection 
#
#    RestConnection is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    RestConnection is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with RestConnection.  If not, see <http://www.gnu.org/licenses/>.
#
#class AuditEntry
#  attr_accessor :status, :output
#  def initialize(opts)
#    @status = opts[:status]
#    @output = opts[:output]
#  end
#  def wait_for_completed(audit_link = "no audit link available")
#    raise "FATAL: script failed. see audit #{audit_link}" unless @status
#  end
#end

class AuditEntry
  include  RightScale::Api::Base
  extend RightScale::Api::BaseExtend

  def wait_for_state(state, timeout=900)
    while(timeout > 0)
      reload
      connection.logger("state is #{self.state}, waiting for #{state}")
      friendly_url = "https://my.rightscale.com/audit_entries/"
      friendly_url += self.href.split(/\//).last
      raise "FATAL error, #{self.summary}\nSee Audit: API:#{self.href}, WWW:<a href='#{friendly_url}'>#{friendly_url}</a>\n" if self.state == 'failed'
      sleep 30
      timeout -= 30
      return true if state == self.state
    end
    raise "FATAL: Timeout waiting for Executable to complete.  State was #{self.state}" if timeout <= 0
  end

  def wait_for_completed(legacy=nil)
    wait_for_state("completed")
  end
end 

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rest_connection-0.0.23 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.22 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.21 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.20 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.19 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.18 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.17 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.16 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.15 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.14 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.13 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.12 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.11 lib/rest_connection/rightscale/audit_entry.rb
rest_connection-0.0.10 lib/rest_connection/rightscale/audit_entry.rb