Skip to content

Commit

Permalink
make scp filemode configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdotdanger committed Mar 19, 2011
1 parent 7ab7593 commit 009e69c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/com/lunabeat/dooper/ClusterConfig.java
Expand Up @@ -32,6 +32,7 @@
*/
public class ClusterConfig implements AWSCredentials {


private final Properties _properties = new Properties();
private final Properties _requiredFields = new Properties();
private final static String REQUIRED_FIELDS = "/com/lunabeat/dooper/RequiredConfigFields.properties";
Expand Down Expand Up @@ -70,7 +71,8 @@ static private List<String> initInstaceGroupTypes(){
tmpList.add("slaves");
return Collections.unmodifiableList(tmpList);
}
public static final String SCP_FILE_MODE = "0644";
public static final String SCP_DEFAULT_FILE_MODE = "0755";
public static final String SCP_FILE_MODE_KEY = "Scp.Filemode";


/**
Expand Down
5 changes: 3 additions & 2 deletions src/com/lunabeat/dooper/HadoopCluster.java
Expand Up @@ -414,8 +414,9 @@ public void putFile(ClusterInstance host, String src, String dest) throws SCPExc
SCPClient scp = new SCPClient(conn);
String[] pathAndFile = splitPathAndFile(dest);
String outFileName = pathAndFile[1].length() > 0 ? pathAndFile[1] : splitPathAndFile(src)[1];
LOGGER.info("SCP '" + src + "' '" + outFileName + "' '" + pathAndFile[0] + "' " + ClusterConfig.SCP_FILE_MODE);
scp.put(src, outFileName, pathAndFile[0], ClusterConfig.SCP_FILE_MODE);
String fileMode = _config.get(ClusterConfig.SCP_FILE_MODE_KEY, ClusterConfig.SCP_DEFAULT_FILE_MODE);
LOGGER.info("SCP '" + src + "' '" + outFileName + "' '" + pathAndFile[0] + "' " + fileMode);
scp.put(src, outFileName, pathAndFile[0], fileMode);
} catch (IOException e) {
throw new SCPException(e.getMessage(), e.getCause(), host);
}
Expand Down

0 comments on commit 009e69c

Please sign in to comment.