diff --git a/awx/main/tasks.py b/awx/main/tasks.py index fd2ecb121b..3a765364a3 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -67,7 +67,7 @@ from awx.main.queue import CallbackQueueDispatcher from awx.main.isolated import manager as isolated_manager from awx.main.dispatch.publish import task from awx.main.dispatch import get_local_queuename, reaper -from awx.main.utils import (get_ssh_version, update_scm_url, +from awx.main.utils import (update_scm_url, ignore_inventory_computed_fields, ignore_inventory_group_removal, extract_ansible_vars, schedule_task_manager, get_awx_version) @@ -897,21 +897,14 @@ class BaseTask(object): private_data = self.build_private_data(instance, private_data_dir) private_data_files = {'credentials': {}} if private_data is not None: - ssh_ver = get_ssh_version() - ssh_too_old = True if ssh_ver == "unknown" else Version(ssh_ver) < Version("6.0") - openssh_keys_supported = ssh_ver != "unknown" and Version(ssh_ver) >= Version("6.5") for credential, data in private_data.get('credentials', {}).items(): - # Bail out now if a private key was provided in OpenSSH format - # and we're running an earlier version (<6.5). - if 'OPENSSH PRIVATE KEY' in data and not openssh_keys_supported: - raise RuntimeError(OPENSSH_KEY_ERROR) # OpenSSH formatted keys must have a trailing newline to be # accepted by ssh-add. if 'OPENSSH PRIVATE KEY' in data and not data.endswith('\n'): data += '\n' # For credentials used with ssh-add, write to a named pipe which # will be read then closed, instead of leaving the SSH key on disk. - if credential and credential.credential_type.namespace in ('ssh', 'scm') and not ssh_too_old: + if credential and credential.credential_type.namespace in ('ssh', 'scm'): try: os.mkdir(os.path.join(private_data_dir, 'env')) except OSError as e: diff --git a/awx/main/tests/conftest.py b/awx/main/tests/conftest.py index 5b660b29ca..f79c3a7b39 100644 --- a/awx/main/tests/conftest.py +++ b/awx/main/tests/conftest.py @@ -107,11 +107,6 @@ def workflow_job_template_factory(): return create_workflow_job_template -@pytest.fixture -def get_ssh_version(mocker): - return mocker.patch('awx.main.tasks.get_ssh_version', return_value='OpenSSH_6.9p1, LibreSSL 2.1.8') - - @pytest.fixture def job_template_with_survey_passwords_unit(job_template_with_survey_passwords_factory): return job_template_with_survey_passwords_factory(persisted=False) diff --git a/awx/main/utils/common.py b/awx/main/utils/common.py index a5e8bccff2..0eb8741d9a 100644 --- a/awx/main/utils/common.py +++ b/awx/main/utils/common.py @@ -43,7 +43,7 @@ logger = logging.getLogger('awx.main.utils') __all__ = [ 'get_object_or_400', 'camelcase_to_underscore', 'underscore_to_camelcase', 'memoize', - 'memoize_delete', 'get_ansible_version', 'get_ssh_version', 'get_licenser', 'get_awx_http_client_headers', + 'memoize_delete', 'get_ansible_version', 'get_licenser', 'get_awx_http_client_headers', 'get_awx_version', 'update_scm_url', 'get_type_for_model', 'get_model_for_type', 'copy_model_by_class', 'region_sorting', 'copy_m2m_relationships', 'prefetch_page_capabilities', 'to_python_boolean', 'ignore_inventory_computed_fields', @@ -190,20 +190,6 @@ def get_ansible_version(): return _get_ansible_version('ansible') -@memoize() -def get_ssh_version(): - ''' - Return SSH version installed. - ''' - try: - proc = subprocess.Popen(['ssh', '-V'], - stderr=subprocess.PIPE) - result = smart_str(proc.communicate()[1]) - return result.split(" ")[0].split("_")[1] - except Exception: - return 'unknown' - - def get_awx_version(): ''' Return AWX version as reported by setuptools.