lib/cap-rightscale/configuration/rightscale.rb in cap-rightscale-0.4.3 vs lib/cap-rightscale/configuration/rightscale.rb in cap-rightscale-0.4.4
- old
+ new
@@ -53,11 +53,11 @@
start = Time.now
logger.info("SETTING ROLE: #{role}")
host_list = use_rs_cache ? get_cache_instance.load_server_cache(role, @caller) : [] # Get cache
- if host_list && host_list.size > 0
+ if host_list.size > 0
[:array_id, :except_tags].each {|key| params.delete(key)} # remove rightscale's parameters
logger.info("restore cache of servers:\n#{host_list.pretty_inspect}")
role(role, params) { host_list } # set cache to role()
else
# Request RightScale API
@@ -82,11 +82,11 @@
logger.info("Found server: #{hostname}(#{ip})")
use_nickname ? hostname : ip
end
host_list = RSUtils.valid_echo(host_list, logger) if validate_echo
- if host_list && host_list.size > 0
+ if host_list.size > 0
[:array_id, :except_tags].each {|key| params.delete(key)} # remove rightscale's parameters
role(role, params) { host_list }
get_cache_instance.dump_server_cache(role, host_list, @caller) if use_rs_cache # Dump cache
end
end
@@ -139,11 +139,11 @@
logger.info("Found server: #{hostname}(#{ip})")
use_nickname ? hostname : ip
end
host_list = RSUtils.valid_echo(host_list, logger) if validate_echo
- if host_list && host_list.size > 0
+ if host_list.size > 0
[:array_id, :except_tags].each {|key| params.delete(key)} # remove rightscale's parameters
role(role, params) { host_list }
get_cache_instance.dump_server_cache(role, host_list, @caller) if use_rs_cache # Dump cache
end
end
@@ -152,11 +152,12 @@
end
# Get servers matching tags in deployment
# === Parameters
# * _role_ - Capistrano role symbol (ex. :app, :web, :db)
- # * _params[:tags]_ - ex. :tags => "xx_db:role=master", "xx_web:role", "xx_lb" (RightScale tags partial matchs 'namespece:predicate=value')
+ # * _params[:tags]_ - ex. :tags => "xx_db:role=master",
+ # "xx_web:role", "xx_lb" (RightScale tags partial matchs 'namespece:predicate=value')
# * _params[:deployment]_ - ex. :deployment => 1[https://my.rightscale.com/deployments/{id}]
# * _params[:xxx]_ - ex. :user => "www", :port => 2345, etc...
# === Examples
# deployment_id = 1
# nickname :db, :tags => "xx_db:role", :deployment => deployment_id, :port => 3306
@@ -169,11 +170,11 @@
start = Time.now
logger.info("SETTING ROLE: #{role}")
host_list = use_rs_cache ? get_cache_instance.load_server_cache(role, @caller) : [] # Get cache
- if host_list && host_list.size > 0
+ if host_list.size > 0
[:deployment, :tags, :except_tags].each {|key| params.delete(key)} # remove rightscale's parameters
logger.info("restore cache of servers:\n#{host_list.pretty_inspect}")
role(role, params) { host_list } # set cache to role()
else
# Request RightScale API
@@ -200,10 +201,10 @@
use_nickname ? hostname : ip
end
host_list = RSUtils.valid_echo(host_list, logger) if validate_echo
- if host_list && host_list.size > 0
+ if host_list.size > 0
[:deployment, :tags, :except_tags].each {|key| params.delete(key)} # remove rightscale's parameters
role(role, params) { host_list }
get_cache_instance.dump_server_cache(role, host_list, @caller) if use_rs_cache # Dump cache
end
end