Merge pull request #618 from richardcloudsoft/issue-910-take-2

Issue 910: failure to start machines where image description contains regexp charatcer
This commit is contained in:
Adrian Cole 2012-05-09 07:00:59 -07:00
commit 404dc93140
1 changed files with 3 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import static org.jclouds.compute.util.ComputeServiceUtils.getSpace;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
@ -499,13 +500,13 @@ public class TemplateBuilderImpl implements TemplateBuilder {
if (image.getName() != null) if (image.getName() != null)
this.imageName = image.getName(); this.imageName = image.getName();
if (image.getDescription() != null) if (image.getDescription() != null)
this.imageDescription = String.format("^%s$", image.getDescription()); this.imageDescription = String.format("^%s$", Pattern.quote(image.getDescription()));
if (image.getOperatingSystem().getName() != null) if (image.getOperatingSystem().getName() != null)
this.osName = image.getOperatingSystem().getName(); this.osName = image.getOperatingSystem().getName();
if (image.getOperatingSystem().getDescription() != null) if (image.getOperatingSystem().getDescription() != null)
this.osDescription = image.getOperatingSystem().getDescription(); this.osDescription = image.getOperatingSystem().getDescription();
if (image.getVersion() != null) if (image.getVersion() != null)
this.imageVersion = String.format("^%s$", image.getVersion()); this.imageVersion = String.format("^%s$", Pattern.quote(image.getVersion()));
if (image.getOperatingSystem().getVersion() != null) if (image.getOperatingSystem().getVersion() != null)
this.osVersion = image.getOperatingSystem().getVersion(); this.osVersion = image.getOperatingSystem().getVersion();
this.os64Bit = image.getOperatingSystem().is64Bit(); this.os64Bit = image.getOperatingSystem().is64Bit();