Created
November 17, 2010 15:21
-
-
Save pascaldevink/703496 to your computer and use it in GitHub Desktop.
Add support for custom keyfile names for the SSH command to use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: sfProjectDeployTask.class.php | |
=================================================================== | |
--- sfProjectDeployTask.class.php (revision 79869) | |
+++ sfProjectDeployTask.class.php (working copy) | |
@@ -35,6 +35,7 @@ | |
new sfCommandOption('go', null, sfCommandOption::PARAMETER_NONE, 'Do the deployment'), | |
new sfCommandOption('rsync-dir', null, sfCommandOption::PARAMETER_REQUIRED, 'The directory where to look for rsync*.txt files', 'config'), | |
new sfCommandOption('rsync-options', null, sfCommandOption::PARAMETER_OPTIONAL, 'To options to pass to the rsync executable', '-azC --force --delete --progress'), | |
+ new sfCommandOption('key-file', null, sfCommandOption::PARAMETER_OPTIONAL, 'Path to the key you want to use for the SSH connection (if not the standard key)'), | |
)); | |
$this->namespace = 'project'; | |
@@ -83,6 +84,9 @@ | |
[rsync-options|INFO] option (defaults are [-azC --force --delete --progress|INFO]): | |
[./symfony project:deploy --go --rsync-options=-avz|INFO] | |
+ | |
+You can specifiy a different public key with --key-file: | |
+ [./symfony project:deploy --go --key-file=~/.ssh/jobeet.key] | |
EOF; | |
} | |
@@ -127,14 +131,23 @@ | |
$dir .= '/'; | |
} | |
- $ssh = 'ssh'; | |
+ $ssh = '"ssh'; | |
+ // Add support for key files | |
+ if (isset($options['key-file'])) | |
+ { | |
+ $keyfile = $options['key-file']; | |
+ $ssh .= ' -i '.$keyfile; | |
+ } | |
+ | |
if (isset($properties['port'])) | |
{ | |
$port = $properties['port']; | |
- $ssh = '"ssh -p'.$port.'"'; | |
+ $ssh .= ' -p'.$port; | |
} | |
+ $ssh .= '"'; | |
+ | |
if (isset($properties['parameters'])) | |
{ | |
$parameters = $properties['parameters']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment