mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Revert "Allow for not being prompted to supply a password to deploy keys to a…"
This commit is contained in:
parent
7a166bc58a
commit
0d7180a70e
3 changed files with 3 additions and 61 deletions
|
@ -341,12 +341,12 @@ class SSH(object):
|
|||
'''
|
||||
Deploy the SSH key if the minions don't auth
|
||||
'''
|
||||
if not isinstance(ret[host], dict) or self.opts.get('ssh_key_deploy') is True:
|
||||
if not isinstance(ret[host], dict) or self.opts.get('ssh_key_deploy'):
|
||||
target = self.targets[host]
|
||||
if target.get('passwd', False) or self.opts['ssh_passwd']:
|
||||
self._key_deploy_run(host, target, False)
|
||||
return ret
|
||||
if ret[host].get('stderr', '').count('Permission denied') and not self.opts.get('ssh_key_deploy') is False:
|
||||
if ret[host].get('stderr', '').count('Permission denied'):
|
||||
target = self.targets[host]
|
||||
# permission denied, attempt to auto deploy ssh key
|
||||
print(('Permission denied for host {0}, do you want to deploy '
|
||||
|
|
|
@ -3023,21 +3023,12 @@ class SaltSSHOptionParser(six.with_metaclass(OptionParserMeta,
|
|||
auth_group.add_option(
|
||||
'--key-deploy',
|
||||
dest='ssh_key_deploy',
|
||||
default=None,
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='Set this flag to attempt to deploy the authorized ssh key '
|
||||
'with all minions. This combined with --passwd can make '
|
||||
'initial deployment of keys very fast and easy.'
|
||||
)
|
||||
auth_group.add_option(
|
||||
'--no-key-deploy',
|
||||
dest='ssh_key_deploy',
|
||||
default=None,
|
||||
action='store_false',
|
||||
help='Set this flag to stop salt-ssh from attempting to deploy an authorized ssh key '
|
||||
'with all minions. This is useful to skip the message about deploying to minions '
|
||||
'that cannot be logged into.'
|
||||
)
|
||||
auth_group.add_option(
|
||||
'--identities-only',
|
||||
dest='ssh_identities_only',
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
:codeauthor: :email:`Daniel Wallace (daniel@saltstack.com)`
|
||||
|
||||
|
||||
====================================
|
||||
Test Case for --no-key-deploy
|
||||
====================================
|
||||
'''
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
# Import Python Libs
|
||||
import os
|
||||
import json
|
||||
|
||||
# Import Tests Libs
|
||||
from tests.support.case import SSHCase
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
||||
class SSHKeyDeployQuestionCase(SSHCase):
|
||||
|
||||
def _run_ssh(self, arg_str, with_retcode=False, timeout=25, catch_stderr=False):
|
||||
|
||||
arg_str = '-ldebug -c {0} -i --roster-file {1} --out=json localhost {2}'.format(
|
||||
self.get_config_dir(),
|
||||
os.path.join(RUNTIME_VARS.TMP_CONF_DIR, '_ssh', 'roster'),
|
||||
arg_str,
|
||||
)
|
||||
return self.run_script('salt-ssh',
|
||||
arg_str,
|
||||
with_retcode=with_retcode,
|
||||
catch_stderr=catch_stderr,
|
||||
timeout=timeout,
|
||||
raw=True)
|
||||
|
||||
def test_no_key_deploy(self):
|
||||
exp = {
|
||||
'localhost': {
|
||||
'stdout': '',
|
||||
'stderr': "Permission denied (publickey).\r\n",
|
||||
'retcode': 255,
|
||||
},
|
||||
}
|
||||
assert json.loads(self._run_ssh('--no-key-deploy localhost test.ping')) == exp
|
||||
|
||||
def test_key_deploy(self):
|
||||
exp = ['Process took more than 5 seconds to complete. Process Killed!']
|
||||
assert self._run_ssh('localhost test.ping', timeout=5) == exp
|
Loading…
Add table
Reference in a new issue