lib/rest_connection/rightscale/deployment.rb in rest_connection-0.1.0 vs lib/rest_connection/rightscale/deployment.rb in rest_connection-0.1.1

- old
+ new

@@ -17,10 +17,14 @@ include RightScale::Api::Base extend RightScale::Api::BaseExtend include RightScale::Api::Taggable extend RightScale::Api::TaggableExtend + def self.filters + [:description, :nickname] + end + def reload uri = URI.parse(self.href) @params ? @params.merge!(connection.get(uri.path)) : @params = connection.get(uri.path) @params['cloud_id'] = cloud_id @params @@ -43,11 +47,14 @@ connection.put(deploy_href.path, :deployment => {:parameters => {name => value} }) end def servers_no_reload connection.logger("WARNING: No Servers in the Deployment!") if @params['servers'].empty? - @params['servers'].map { |s| ServerInterface.new(self.cloud_id, s, self.rs_id) } + unless @params['servers'].reduce(true) { |bool,s| bool && s.is_a?(ServerInterface) } + @params['servers'].map! { |s| ServerInterface.new(self.cloud_id, s, self.rs_id) } + end + @params['servers'] end def servers # this populates extra information about the servers servers_no_reload.each do |s| @@ -68,7 +75,17 @@ deploy_href = URI.parse(self.href) if wait_for_servers servers_no_reload.each { |s| s.wait_for_state("stopped") } end connection.delete(deploy_href.path) + end + + def start_all + deploy_href = URI.parse(self.href) + connection.post(deploy_href.path + "/start_all") + end + + def stop_all + deploy_href = URI.parse(self.href) + connection.post(deploy_href.path + "/stop_all") end end