Ensuring pem files are properly split regardless of source OS

This commit is contained in:
zack-shoylev 2013-06-26 14:40:50 -05:00 committed by Ignasi Barrera
parent 5f1f21341d
commit afefb7bf73
1 changed files with 4 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import java.security.PrivateKey;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import javax.inject.Inject;
import javax.inject.Named;
@ -59,6 +60,8 @@ import com.google.inject.TypeLiteral;
*/
@Singleton
public class GroupToBootScript implements Function<String, Statement> {
private static final Pattern newLinePattern = Pattern.compile("(\\r\\n)|(\\n)");
@VisibleForTesting
static final Type RUN_LIST_TYPE = new TypeLiteral<Map<String, List<String>>>() {
}.getType();
@ -108,7 +111,7 @@ public class GroupToBootScript implements Function<String, Statement> {
String.format("chef_server_url \"%s\"", endpoint.get())));
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";
Statement createFirstBoot = appendFile(chefBootFile, Collections.singleton(json.toJson(bootstrapConfig)));