more compatible delimiter as - doesn't work in rackspace

This commit is contained in:
Adrian Cole 2012-05-21 20:19:42 -06:00
parent a2bbb0e611
commit 7d9bba750a
2 changed files with 4 additions and 4 deletions

View File

@ -193,7 +193,7 @@ public class ComputeServiceUtils {
Builder<String, String> builder = ImmutableMap.<String, String> builder(); Builder<String, String> builder = ImmutableMap.<String, String> builder();
builder.putAll(options.getUserMetadata()); builder.putAll(options.getUserMetadata());
if (options.getTags().size() > 0) if (options.getTags().size() > 0)
builder.put("jclouds.tags", Joiner.on(',').join(options.getTags())); builder.put("jclouds_tags", Joiner.on(',').join(options.getTags()));
return builder.build(); return builder.build();
} }
@ -202,10 +202,10 @@ public class ComputeServiceUtils {
*/ */
public static NodeMetadataBuilder addMetadataAndParseTagsFromCommaDelimitedValue(NodeMetadataBuilder builder, public static NodeMetadataBuilder addMetadataAndParseTagsFromCommaDelimitedValue(NodeMetadataBuilder builder,
Map<String, String> map) { Map<String, String> map) {
String tagString = map.get("jclouds.tags"); String tagString = map.get("jclouds_tags");
if (tagString != null) if (tagString != null)
builder.tags(Splitter.on(',').split(tagString)); builder.tags(Splitter.on(',').split(tagString));
builder.userMetadata(filterKeys(map, not(equalTo("jclouds.tags")))); builder.userMetadata(filterKeys(map, not(equalTo("jclouds_tags"))));
return builder; return builder;
} }

View File

@ -60,7 +60,7 @@ public class ComputeServiceUtilsTest {
@Test @Test
public void testMetadataAndTagsAsCommaDelimitedValue() { public void testMetadataAndTagsAsCommaDelimitedValue() {
TemplateOptions options = TemplateOptions.Builder.tags(ImmutableSet.of("tag")).userMetadata(ImmutableMap.<String, String>of("foo", "bar")); TemplateOptions options = TemplateOptions.Builder.tags(ImmutableSet.of("tag")).userMetadata(ImmutableMap.<String, String>of("foo", "bar"));
assertEquals(metadataAndTagsAsCommaDelimitedValue(options), ImmutableMap.<String, String>of("foo", "bar", "jclouds.tags", "tag")); assertEquals(metadataAndTagsAsCommaDelimitedValue(options), ImmutableMap.<String, String>of("foo", "bar", "jclouds_tags", "tag"));
} }
@Test @Test