Skip to content

Commit

Permalink
Fixed ability to launch spot instance within a VPC with custom VPC se…
Browse files Browse the repository at this point in the history
…curity group

Fixes:
Status Code: 400, AWS Service: AmazonEC2, AWS Request ID: 6079cf60-3c23-4ea7-935a-807bd5f81b95, AWS Error Code: InvalidParameterCombination, AWS Error Message: The parameter groupName cannot be used with the parameter subnet
  • Loading branch information
mriddle committed Aug 23, 2013
1 parent 8d5be49 commit 033b2a3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/hudson/plugins/ec2/SlaveTemplate.java
Expand Up @@ -471,12 +471,18 @@ private EC2AbstractSlave provisionSpot(TaskListener listener) throws AmazonClien

/* If we have a subnet ID then we can only use VPC security groups */
if (!securityGroupSet.isEmpty()) {
List<String> group_ids = getEc2SecurityGroups(ec2);
List<String> group_ids = getEc2SecurityGroups(ec2);
ArrayList<GroupIdentifier> groups = new ArrayList<GroupIdentifier>();

if (!group_ids.isEmpty()) {
launchSpecification.setSecurityGroups(group_ids);
}
}
for (String group_id : group_ids) {
GroupIdentifier group = new GroupIdentifier();
group.setGroupId(group_id);
groups.add(group);
}

if (!groups.isEmpty())
launchSpecification.setAllSecurityGroups(groups);
}
} else {
/* No subnet: we can use standard security groups by name */
if (securityGroupSet.size() > 0)
Expand Down

0 comments on commit 033b2a3

Please sign in to comment.