incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: fix /root/.ssh directory creation for KVM Since /root is r-x permissions, Java fails to mkdir /root/.ssh (even though the agent is running as root) because it looks for the writable permission. This patch modifies the 'chmod 700 /root/.ssh' s
Date Wed, 26 Sep 2012 21:03:41 GMT
Updated Branches:
  refs/heads/master a95a9dc07 -> 38a885776


fix /root/.ssh directory creation for KVM
Since /root is r-x permissions, Java fails to mkdir /root/.ssh (even
though the agent is running as root) because it looks for the writable
permission. This patch modifies the 'chmod 700 /root/.ssh' shell command
that we already use into 'mkdir -m 700 /root/.ssh', to be able to create
the directory as root even though write permissions are not set on
/root. This seemed cleaner/safer than adding writable to /root.

Signed-off-by: Edison Su <sudison@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/38a88577
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/38a88577
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/38a88577

Branch: refs/heads/master
Commit: 38a885776cbab05dba38f8b1a400f73391892026
Parents: a95a9dc
Author: Marcus Sorensen <shadowsor@gmail.com>
Authored: Wed Sep 26 14:03:12 2012 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Sep 26 14:03:12 2012 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/38a88577/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index aadd6dd..22b149f 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2628,11 +2628,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements
         File sshKeysDir = new File(_SSHKEYSPATH);
         String result = null;
         if (!sshKeysDir.exists()) {
-            sshKeysDir.mkdir();
             // Change permissions for the 700
-            Script script = new Script("chmod", _timeout, s_logger);
-            script.add("700", _SSHKEYSPATH);
+            Script script = new Script("mkdir", _timeout, s_logger);
+            script.add("-m","700");
+            script.add(_SSHKEYSPATH);
             script.execute();
+            
+            if(!sshKeysDir.exists()) {
+                s_logger.debug("failed to create directory " + _SSHKEYSPATH);
+            }
         }
 
         File pubKeyFile = new File(_SSHPUBKEYPATH);


Mime
View raw message