Permalink
Browse files

make scp filemode configurable.

  • Loading branch information...
1 parent 7ab7593 commit 009e69cb12476490e433657113bb47727ac31267 @carlosdotdanger committed Mar 19, 2011
Showing with 6 additions and 3 deletions.
  1. +3 −1 src/com/lunabeat/dooper/ClusterConfig.java
  2. +3 −2 src/com/lunabeat/dooper/HadoopCluster.java
@@ -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";
@@ -70,7 +71,8 @@
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";
/**
@@ -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);
}

0 comments on commit 009e69c

Please sign in to comment.