Skip to content

Commit

Permalink
Merge pull request nuxeo#86 from anentropic/worker-ssh-key
Browse files Browse the repository at this point in the history
Worker ssh key support via conf file
  • Loading branch information
bdelbosc committed Mar 27, 2013
2 parents 091b20d + 516627c commit c5c7a17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions doc/source/faq.rst
Expand Up @@ -198,6 +198,14 @@ There are many ways:
username = user
password = password

When defining workers in the conf file you can alternatively specify a path to a private key file
instead of using a password::

[worker1]
host = worker1
username = user
ssh_key = /path/to/my_key_name.pub

Then run adding just the --distribute option::

$ fl-run-bench -c 1:2:3 -D 5 -f --simple-fetch test_Simple.py Simple.test_simple --distribute -u http://target/
Expand Down
7 changes: 5 additions & 2 deletions src/funkload/Distributed.py
Expand Up @@ -95,7 +95,7 @@ class SSHDistributor(DistributorBase):
"""
def __init__(self, name, host, username=None, password=None,
channel_timeout=None):
key_filename=None, channel_timeout=None):
"""
performs authentication and tries to connect to the
`host`.
Expand All @@ -111,6 +111,8 @@ def __init__(self, name, host, username=None, password=None,
credentials = {}
if username and password:
credentials = {"username": username, "password": password}
if username and key_filename:
credentials = {"username": username, "key_filename": key_filename}
elif username:
credentials = {"username": username}
host_port = host.split(':')
Expand Down Expand Up @@ -376,9 +378,10 @@ def __init__(self, module_name, class_name, method_name, options,
host = host.strip()
workers.append({
"name": host,
"host": test.conf_get(host, "host",host),
"host": test.conf_get(host, "host", host),
"password": test.conf_get(host, 'password', ''),
"username": test.conf_get(host, 'username', ''),
"key_filename": test.conf_get(host, 'ssh_key', ''),
"channel_timeout": self.channel_timeout})

self._workers = []
Expand Down

0 comments on commit c5c7a17

Please sign in to comment.