@@ -1446,6 +1446,7 @@ def _cmd_str(self):
14461446OPTIONS.tty = {tty}
14471447OPTIONS.cmd_umask = {cmd_umask}
14481448OPTIONS.code_checksum = {code_checksum}
1449+ OPTIONS.log_level = '{log_level}'
14491450ARGS = {arguments}\n ''' .format (
14501451 config = self .minion_config ,
14511452 delimeter = RSTR ,
@@ -1459,6 +1460,7 @@ def _cmd_str(self):
14591460 cmd_umask = self .cmd_umask ,
14601461 code_checksum = thin_code_digest ,
14611462 arguments = self .argv ,
1463+ log_level = self .opts ["log_level" ],
14621464 )
14631465 py_code = SSH_PY_SHIM .replace ("#%%OPTS" , arg_str )
14641466 py_code_enc = base64 .encodebytes (py_code .encode ("utf-8" )).decode ("utf-8" )
@@ -1501,15 +1503,15 @@ def execute_script(self, script, extension="py", pre_dir="", script_args=None):
15011503
15021504 return ret
15031505
1504- def shim_cmd (self , cmd_str , extension = "py" ):
1506+ def shim_cmd (self , cmd_str , extension = "py" , print_output = False ):
15051507 """
15061508 Run a shim command.
15071509
15081510 If tty is enabled, we must scp the shim to the target system and
15091511 execute it there
15101512 """
15111513 if not self .tty and not self .winrm :
1512- return self .shell .exec_cmd (cmd_str )
1514+ return self .shell .exec_cmd (cmd_str , print_output = print_output )
15131515
15141516 # Write the shim to a temporary file in the default temp directory
15151517 with tempfile .NamedTemporaryFile (mode = "w+b" , delete = False ) as shim_tmp_file :
@@ -1537,7 +1539,7 @@ def shim_cmd(self, cmd_str, extension="py"):
15371539
15381540 return ret
15391541
1540- def cmd_block (self , is_retry = False ):
1542+ def cmd_block (self , is_retry = False , print_output = False ):
15411543 """
15421544 Prepare the pre-check command to send to the subsystem
15431545
@@ -1554,7 +1556,7 @@ def cmd_block(self, is_retry=False):
15541556 " " .join ([str (arg ) for arg in self .argv ]),
15551557 )
15561558 cmd_str = self ._cmd_str ()
1557- stdout , stderr , retcode = self .shim_cmd (cmd_str )
1559+ stdout , stderr , retcode = self .shim_cmd (cmd_str , print_output = print_output )
15581560
15591561 log .trace ("STDOUT %s\n %s" , self .target ["host" ], stdout )
15601562 log .trace ("STDERR %s\n %s" , self .target ["host" ], stderr )
@@ -1564,14 +1566,14 @@ def cmd_block(self, is_retry=False):
15641566 if error :
15651567 if error == "Python environment not found on Windows system" :
15661568 saltwinshell .deploy_python (self )
1567- stdout , stderr , retcode = self .shim_cmd (cmd_str )
1569+ stdout , stderr , retcode = self .shim_cmd (cmd_str , print_output = print_output )
15681570 while re .search (RSTR_RE , stdout ):
15691571 stdout = re .split (RSTR_RE , stdout , 1 )[1 ].strip ()
15701572 while re .search (RSTR_RE , stderr ):
15711573 stderr = re .split (RSTR_RE , stderr , 1 )[1 ].strip ()
15721574 elif error == "Undefined SHIM state" :
15731575 self .deploy ()
1574- stdout , stderr , retcode = self .shim_cmd (cmd_str )
1576+ stdout , stderr , retcode = self .shim_cmd (cmd_str , print_output = print_output )
15751577 if not re .search (RSTR_RE , stdout ) or not re .search (RSTR_RE , stderr ):
15761578 # If RSTR is not seen in both stdout and stderr then there
15771579 # was a thin deployment problem.
@@ -1610,7 +1612,7 @@ def cmd_block(self, is_retry=False):
16101612 and retcode == salt .defaults .exitcodes .EX_THIN_DEPLOY
16111613 ):
16121614 self .deploy ()
1613- stdout , stderr , retcode = self .shim_cmd (cmd_str )
1615+ stdout , stderr , retcode = self .shim_cmd (cmd_str , print_output = print_output )
16141616 if not re .search (RSTR_RE , stdout ) or not re .search (RSTR_RE , stderr ):
16151617 if not self .tty :
16161618 # If RSTR is not seen in both stdout and stderr then there
@@ -1622,7 +1624,7 @@ def cmd_block(self, is_retry=False):
16221624 stderr ,
16231625 retcode ,
16241626 )
1625- return self .cmd_block ()
1627+ return self .cmd_block (print_output = print_output )
16261628 elif not re .search (RSTR_RE , stdout ):
16271629 # If RSTR is not seen in stdout with tty, then there
16281630 # was a thin deployment problem.
@@ -1642,7 +1644,7 @@ def cmd_block(self, is_retry=False):
16421644 stderr = re .split (RSTR_RE , stderr , 1 )[1 ].strip ()
16431645 elif "ext_mods" == shim_command :
16441646 self .deploy_ext ()
1645- stdout , stderr , retcode = self .shim_cmd (cmd_str )
1647+ stdout , stderr , retcode = self .shim_cmd (cmd_str , print_output = print_output )
16461648 if not re .search (RSTR_RE , stdout ) or not re .search (RSTR_RE , stderr ):
16471649 # If RSTR is not seen in both stdout and stderr then there
16481650 # was a thin deployment problem.
0 commit comments