mirror of https://github.com/apache/jclouds.git
Ensuring pem files are properly split regardless of source OS
This commit is contained in:
parent
5f1f21341d
commit
afefb7bf73
|
@ -28,6 +28,7 @@ import java.security.PrivateKey;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
@ -59,6 +60,8 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GroupToBootScript implements Function<String, Statement> {
|
public class GroupToBootScript implements Function<String, Statement> {
|
||||||
|
private static final Pattern newLinePattern = Pattern.compile("(\\r\\n)|(\\n)");
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final Type RUN_LIST_TYPE = new TypeLiteral<Map<String, List<String>>>() {
|
static final Type RUN_LIST_TYPE = new TypeLiteral<Map<String, List<String>>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
@ -108,7 +111,7 @@ public class GroupToBootScript implements Function<String, Statement> {
|
||||||
String.format("chef_server_url \"%s\"", endpoint.get())));
|
String.format("chef_server_url \"%s\"", endpoint.get())));
|
||||||
|
|
||||||
Statement createValidationPem = appendFile(chefConfigDir + "{fs}validation.pem",
|
Statement createValidationPem = appendFile(chefConfigDir + "{fs}validation.pem",
|
||||||
Splitter.on('\n').split(Pems.pem(validatorKey)));
|
Splitter.on(newLinePattern).split(Pems.pem(validatorKey)));
|
||||||
|
|
||||||
String chefBootFile = chefConfigDir + "{fs}first-boot.json";
|
String chefBootFile = chefConfigDir + "{fs}first-boot.json";
|
||||||
Statement createFirstBoot = appendFile(chefBootFile, Collections.singleton(json.toJson(bootstrapConfig)));
|
Statement createFirstBoot = appendFile(chefBootFile, Collections.singleton(json.toJson(bootstrapConfig)));
|
||||||
|
|
Loading…
Reference in New Issue