lib/rubber/recipes/rubber/instances.rb in axtro-rubber-1.2.1 vs lib/rubber/recipes/rubber/instances.rb in axtro-rubber-1.2.2

- old
+ new

@@ -33,11 +33,13 @@ end # Add in roles that the given set of roles depends on ir = Rubber::Configuration::RoleItem.expand_role_dependencies(ir, get_role_dependencies) - create_instance(instance_alias, ir, create_spot_instance) + user_data = env.cloud_providers[env.cloud_provider]["user_data"] + + create_instance(instance_alias, ir, create_spot_instance, user_data) end desc <<-DESC Refresh the host data for a EC2 instance with the given ALIAS. This is useful to run when rubber:create fails after instance creation @@ -154,11 +156,11 @@ set :print_ip_command, "ifconfig eth0 | awk 'NR==2 {print $2}' | awk -F: '{print $2}'" # Creates a new ec2 instance with the given alias and roles # Configures aliases (/etc/hosts) on local and remote machines - def create_instance(instance_alias, instance_roles, create_spot_instance=false) + def create_instance(instance_alias, instance_roles, create_spot_instance=false, user_data = nil) fatal "Instance already exists: #{instance_alias}" if rubber_instances[instance_alias] role_names = instance_roles.collect{|x| x.name} env = rubber_cfg.environment.bind(role_names, instance_alias) @@ -199,10 +201,10 @@ print "\n" end if !create_spot_instance || (create_spot_instance && max_wait_time < 0) logger.info "Creating instance #{ami}/#{ami_type}/#{security_groups.join(',') rescue 'Default'}/#{availability_zone || 'Default'}" - instance_id = cloud.create_instance(ami, ami_type, security_groups, availability_zone) + instance_id = cloud.create_instance(ami, ami_type, security_groups, availability_zone, user_data) end logger.info "Instance #{instance_id} created" instance_item = Rubber::Configuration::InstanceItem.new(instance_alias, env.domain, instance_roles, instance_id, security_groups)