Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of m1.medium instance type on EC2 #39

Merged
merged 3 commits into from
Nov 27, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/parse_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
EC2_USAGE_MSG = "You did not provide an ips.yaml file, and you" +
" did not provide a machine id."
EC2_IPS_MISSING_MSG = "You did not provide an ips.yaml or it was empty."
INSTANCE_FLAG_NOT_IN_SET_MSG = "The instance type you provided was not " +
"one of the allowed values. Currently we allow m1.large, m1.xlarge, " +
"and c1.xlarge as the instance types."
POSSIBLE_INSTANCE_TYPES = ["m1.small", "m1.medium", "m1.large", "m1.xlarge", "c1.xlarge"]
INSTANCE_FLAG_NOT_IN_SET_MSG = "The instance type you provided was " +
"not one of the allowed values. Currently we allow the " +
"#{POSSIBLE_INSTANCE_TYPES.join(', ')} instance types."
INFRASTRUCTURE_FLAG_NOT_IN_SET_MSG = "The infrastructure you provided " +
"was not one of the allowed values. Currently we allow ec2 and euca " +
"as the infrastructure types."
Expand Down Expand Up @@ -278,9 +279,8 @@ def self.get_cloud_args(arg_hash, val_hash)
val_hash['machine'] = ENV['APPSCALE_MACHINE']
end

possible_instance_types = ["m1.small", "m1.large", "m1.xlarge", "c1.xlarge"]
if arg_hash['instance_type']
if !possible_instance_types.include?(arg_hash['instance_type'])
if !POSSIBLE_INSTANCE_TYPES.include?(arg_hash['instance_type'])
raise BadCommandLineArgException.new(INSTANCE_FLAG_NOT_IN_SET_MSG)
end
val_hash['instance_type'] = arg_hash['instance_type']
Expand Down
17 changes: 17 additions & 0 deletions test/tc_parse_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,21 @@ def test_infrastructure_flags
}
end

def test_instance_types
# Specifying m1.large as the instance type is acceptable.
args_1 = ['--instance_type', 'm1.large']
all_flags_1 = ['instance_type']
assert_nothing_raised(BadCommandLineArgException) {
ParseArgs.get_vals_from_args(args_1, all_flags_1, @usage)
}

# Specifying blarg1.humongous as the instance type is not
# acceptable.
args_2 = ['--instance_type', 'blarg1.humongous']
all_flags_2 = ['instance_type']
assert_raises(BadCommandLineArgException) {
ParseArgs.get_vals_from_args(args_2, all_flags_2, @usage)
}
end

end