Search in sources :

Example 1 with PUBLISHED_PATH

use of org.craftercms.studio.api.v2.utils.StudioConfiguration.PUBLISHED_PATH in project studio by craftercms.

the class StudioClusterPublishedRepoSyncTask method addRemotes.

protected void addRemotes(String siteId, List<ClusterMember> clusterNodes) throws InvalidRemoteUrlException, ServiceLayerException, CryptoException {
    Map<String, String> existingRemotes = remotesMap.get(siteId);
    logger.debug("Add cluster members as remotes to local published repository");
    for (ClusterMember member : clusterNodes) {
        if (existingRemotes != null && existingRemotes.containsKey(member.getGitRemoteName())) {
            continue;
        }
        try {
            if (existingRemotes == null) {
                existingRemotes = new HashMap<String, String>();
                remotesMap.put(siteId, existingRemotes);
            }
            String remoteUrl = member.getGitUrl().replace("{siteId}", siteId) + "/" + studioConfiguration.getProperty(PUBLISHED_PATH);
            addRemoteRepository(siteId, member, remoteUrl);
            existingRemotes.put(member.getGitRemoteName(), StringUtils.EMPTY);
        } catch (IOException e) {
            logger.error("Failed to open repository for site " + siteId, e);
        }
    }
}
Also used : ClusterMember(org.craftercms.studio.api.v2.dal.ClusterMember) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ClusterMember (org.craftercms.studio.api.v2.dal.ClusterMember)1