@@ -26,15 +26,15 @@ def is_available(cls, h):
2626 )
2727 return not rc
2828
29- def _run_command_on_host (self , cmd ):
29+ def _execute_cmd (self , cmd ):
3030 """
3131 Run given command on host
3232
3333 Args:
3434 cmd (list): Command to run
3535
3636 Returns:
37- bool : True, if command success, otherwise false
37+ tuple or None : True, if command success, otherwise false
3838 """
3939 self .logger .info (
4040 "Execute command '%s' on host %s" , " " .join (cmd ), self .host
@@ -45,8 +45,40 @@ def _run_command_on_host(self, cmd):
4545 "Failed to execute command '%s' on host %s; out: %s; err: %s" ,
4646 " " .join (cmd ), self .host , out , err
4747 )
48- return False
49- return True
48+ return
49+
50+ return rc , out , err
51+
52+ def _run_command_on_host (self , cmd ):
53+ """
54+ Run given command on host
55+
56+ Args:
57+ cmd (list): Command to run
58+
59+ Returns:
60+ bool: True, if command success, otherwise false
61+ """
62+ res = self ._execute_cmd (cmd = cmd )
63+ return bool (res )
64+
65+ def info (self , package ):
66+ """
67+ Get package info
68+
69+ Args:
70+ package (str): Name of package.
71+
72+ Returns:
73+ str or None: package info or None.
74+ """
75+ if not self .exist_command_d :
76+ raise NotImplementedError ("There is no 'exist' command defined." )
77+
78+ cmd = list (self .exist_command_d )
79+ cmd .append (package )
80+ res = self ._execute_cmd (cmd = cmd )
81+ return res [1 ] if res else res
5082
5183 def exist (self , package ):
5284 """
0 commit comments