Skip to content

Commit

Permalink
send hash based arguments to engineyard-serverside
Browse files Browse the repository at this point in the history
  • Loading branch information
outerim committed Sep 2, 2010
1 parent ea87406 commit e29157f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
17 changes: 11 additions & 6 deletions lib/engineyard/model/instance.rb
Expand Up @@ -113,13 +113,18 @@ def ssh(remote_command, output = true)

def invoke_engineyard_serverside(deploy_args, verbose=false)
start = [engineyard_serverside_path, "_#{ENGINEYARD_SERVERSIDE_VERSION}_", 'deploy']
instance_args = environment.instances.find_all do |inst|
inst.has_app_code?
end.inject(['--instances']) do |command, inst|
instance_tuple = [inst.public_hostname, inst.role]
instance_tuple << inst.name if inst.name

command << instance_tuple.join(',')
instances = environment.instances.select { |inst| inst.has_app_code? }
instance_args = ['']
if !instances.empty?
instance_args << '--instances'
instance_args += instances.collect { |i| i.public_hostname }

instance_args << '--instance_roles'
instance_args += instances.collect { |i| [i.public_hostname, i.role].join(':') }

instance_args << '--instance_names'
instance_args += instances.collect { |i| i.name ? [i.public_hostname, i.name].join(':') : nil }.compact
end

framework_arg = ['--framework-env', environment.framework_env]
Expand Down
11 changes: 4 additions & 7 deletions spec/support/shared_behavior.rb
Expand Up @@ -150,12 +150,12 @@ def make_scenario(hash)

it "passes along instance information to engineyard-serverside" do
instance_args = [
Regexp.quote("app_master_hostname.compute-1.amazonaws.com,app_master"),
Regexp.quote("app_hostname.compute-1.amazonaws.com,app"),
Regexp.quote("util_fluffy_hostname.compute-1.amazonaws.com,util,fluffy"),
/--instances app_master[^\s]+ app_hostname[^\s]+ util_fluffy/,
/--instance_roles app_master[^\s]+:app_master app_hostname[^\s]+:app util_fluffy[^\s]+:util/,
/--instance_names util_fluffy[^\s]+:fluffy/
]

db_instance = Regexp.quote("db_master_hostname.compute-1.amazonaws.com,db_master")
db_instance = /db_master/

# apps + utilities are all mentioned
instance_args.each do |i|
Expand All @@ -164,9 +164,6 @@ def make_scenario(hash)

# but not database instances
@ssh_commands.last.should_not =~ /#{db_instance}/

# and it's all after the option '--instances'
@ssh_commands.last.should match(/--instances (#{instance_args.join('|')})/)
end

it "passes the framework environment" do
Expand Down

0 comments on commit e29157f

Please sign in to comment.