Skip to content

Commit

Permalink
need to change the executor function to support remote execute (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgold1234 authored Apr 12, 2021
1 parent 9a583ce commit 341ddcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rrmngmnt/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ def executor(self, user=None, pkey=False, sudo=False):
"Parameter 'pkey' is deprecated and will be removed in future."
"Please use ssh.RemoteExecutorFactory to set this parameter."
)
ef = copy.copy(ssh.RemoteExecutorFactory)
ef = copy.copy(self.executor_factory)
ef.use_pkey = pkey
return ef(self.ip, user)
return ef.build(self, user, self.sudo)
return self.executor_factory.build(self, user, sudo=self.sudo)

def run_command(
Expand Down
8 changes: 8 additions & 0 deletions tests/test_host.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-


from rrmngmnt import Host, User, RootUser
from rrmngmnt.executor import Executor
import pytest


Expand Down Expand Up @@ -31,6 +34,11 @@ def test_executor_user(self):
e = h.executor()
e.user.name == 'lukas'

def test_executor_with_pkey(self):
user = User('core', '12')
e = get_host().executor(user, pkey=True)
assert isinstance(e, Executor)


class TestHostFqdnIp(object):

Expand Down

0 comments on commit 341ddcf

Please sign in to comment.