diff --git a/salt/cloud/utils/__init__.py b/salt/cloud/utils/__init__.py index 4fed28326f..648883a701 100644 --- a/salt/cloud/utils/__init__.py +++ b/salt/cloud/utils/__init__.py @@ -969,7 +969,10 @@ def root_cmd(command, tty, sudo, **kwargs): ''' if sudo: if 'sudo_password' in kwargs and kwargs['sudo_password'] is not None: - command = 'echo "{1}" | sudo -S {0}'.format(command, sudo_password) + command = 'echo "{1}" | sudo -S {0}'.format( + command, + kwargs['sudo_password'], + ) else: command = 'sudo {0}'.format(command) log.debug('Using sudo to run command {0}'.format(command))