Skip to content

Commit

Permalink
Added todos into the readme. Added new api to fetch groups based on t…
Browse files Browse the repository at this point in the history
…he app. printInstanceDetails takes running param from outside
  • Loading branch information
Sumit Vij committed Aug 29, 2013
1 parent 79955da commit e0c3ba6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
10 changes: 6 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#TODOs
* Load group name specific configuration
* Load dependent gems like fog, colored from the dependencies
* Push to github or git repo.
# Capistrano AWS extension that provides better support for mulitstage deployments.
##TODOs
* Add the documentation around how to use it, why to use it etc.
* Add the api to start instance on AWS with all the relevant attributes like group, roles etc.
* Review the api to work on running and non-running instances; make it more consistent
* API cleanup and strengthing

3 changes: 0 additions & 3 deletions lib/capawsext/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@ def init_group_global_variables(group, sec_groups)
set :group, group
#Load the file is exists
load "config/#{group}" if File.exists?(File.expand_path(Dir.pwd + "/config/#{group}.rb"))
#TODO: call the group name configuration file to load group configuration.
#Like the capmultiext

end
end
2 changes: 1 addition & 1 deletion lib/capawsext/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CapAwsExt
VERSION="0.2"
VERSION="0.2.1"
end
25 changes: 19 additions & 6 deletions lib/capawsext/whoec2helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ def get_instances_role(group, role)
return ret_instances
end

def printInstanceDetails()
def printInstanceDetails(only_running=true)
@instances.each_with_index do |instance, i|
puts sprintf "%02d: %-20s %-20s %-20s %-20s %-25s %-20s (%s) (%s) (%s)",
i, (instance.tags["Name"] || "").green,instance.private_dns_name ,instance.id.red, instance.flavor_id.cyan,
instance.dns_name.blue, instance.availability_zone.magenta, (instance.tags["role"] || "").yellow,
(instance.tags["group"] || "").yellow, (instance.tags["app"] || "").green if instance.ready?
end
if only_running and (not instance.ready?)
next
end

puts sprintf "%02d: %-20s %-20s %-20s %-20s %-25s %-20s (%s) (%s) (%s)",
i, (instance.tags["Name"] || "").green,instance.private_dns_name ,instance.id.red, instance.flavor_id.cyan,
instance.dns_name.blue, instance.availability_zone.magenta, (instance.tags["role"] || "").yellow,
(instance.tags["group"] || "").yellow, (instance.tags["app"] || "").green
end

end

Expand Down Expand Up @@ -72,6 +76,15 @@ def get_groups
return groups
end

def get_groups_byapp(app)
groups = Set.new
@instances.each { |instance|
group = instance.tags['group']
groups << group if not group.nil? and instance.tags["app"] == app
}
return groups
end

def get_instances(group)
ret_instances = Array.new
@instances.each { |instance|
Expand Down

0 comments on commit e0c3ba6

Please sign in to comment.