mirror of https://github.com/apache/jclouds.git
JCLOUDS-1050: Fix BootstrapConfig deserialization in Chef
This commit is contained in:
parent
415a8a6600
commit
962de83e86
|
@ -41,6 +41,10 @@ public class BootstrapConfig {
|
|||
public String toString() {
|
||||
return ":verify_" + name().toLowerCase();
|
||||
}
|
||||
|
||||
public static SSLVerifyMode fromValue(String value) {
|
||||
return valueOf(value.replaceAll(":verify_", "").toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.jclouds.chef.ChefApi;
|
|||
import org.jclouds.chef.domain.BootstrapConfig;
|
||||
import org.jclouds.chef.domain.Client;
|
||||
import org.jclouds.chef.domain.DatabagItem;
|
||||
import org.jclouds.chef.domain.BootstrapConfig.SSLVerifyMode;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -70,6 +71,7 @@ public class BootstrapConfigForGroupTest {
|
|||
BootstrapConfigForGroup fn = new BootstrapConfigForGroup("jclouds", chefApi, json);
|
||||
DatabagItem databag = new DatabagItem("foo",
|
||||
"{\"environment\":\"development\",\"ssl_ca_file\":\"/etc/certs/chef-server.crt\","
|
||||
+ "\"ssl_verify_mode\": \":verify_peer\","
|
||||
+ "\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"],"
|
||||
+ "\"attributes\":{\"tomcat6\":{\"ssl_port\":8433}}}");
|
||||
|
||||
|
@ -79,6 +81,7 @@ public class BootstrapConfigForGroupTest {
|
|||
BootstrapConfig config = fn.apply("foo");
|
||||
assertEquals(config.getEnvironment(), "development");
|
||||
assertEquals(config.getSslCAFile(), "/etc/certs/chef-server.crt");
|
||||
assertEquals(config.getSslVerifyMode(), SSLVerifyMode.PEER);
|
||||
assertEquals(config.getRunList().get(0), "recipe[apache2]");
|
||||
assertEquals(config.getRunList().get(1), "role[webserver]");
|
||||
assertEquals(config.getAttributes().toString(), "{\"tomcat6\":{\"ssl_port\":8433}}");
|
||||
|
|
Loading…
Reference in New Issue