mirror of https://github.com/ansible/ansible.git
Remove py2 support from urls.py (#81880)
parent
858a3dbaad
commit
92d2c66db2
@ -0,0 +1,2 @@
|
||||
major_changes:
|
||||
- urls.py - Removed support for Python 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
- when: ansible_facts.distribution not in ['MacOSX']
|
||||
block:
|
||||
- name: install socat
|
||||
package:
|
||||
name: socat
|
||||
state: present
|
||||
register: socat_install_package
|
||||
when: ansible_facts.distribution not in ['Alpine']
|
||||
|
||||
- name: install socat for alpine
|
||||
command: apk add --virtual .socat socat
|
||||
register: socat_install_alpine
|
||||
when: ansible_facts.distribution == 'Alpine'
|
||||
|
||||
- include_tasks: unix-socket.yml
|
||||
always:
|
||||
- name: uninstall socat
|
||||
package:
|
||||
name: socat
|
||||
state: absent
|
||||
when: socat_install_package|default({}) is changed
|
||||
|
||||
- name: uninstall socat for alpine
|
||||
command: apk del .socat
|
||||
when: socat_install_alpine|default({}) is changed and 'Installing socat' in socat_install_alpine.stdout
|
@ -0,0 +1,36 @@
|
||||
- name: Bind socat to socket
|
||||
command: socat UNIX-LISTEN:{{ remote_tmp_dir }}/{{ item.name }}.sock,fork,reuseaddr TCP4:{{ httpbin_host }}:{{ item.port }}
|
||||
loop:
|
||||
- port: 80
|
||||
name: http
|
||||
- port: 443
|
||||
name: https
|
||||
async: 10
|
||||
poll: 0
|
||||
|
||||
- name: Test http connection to unix socket
|
||||
uri:
|
||||
url: http://localhost/get
|
||||
unix_socket: '{{ remote_tmp_dir }}/http.sock'
|
||||
register: unix_socket_http
|
||||
|
||||
- name: Test https connection to unix socket with valdiate_certs=false
|
||||
uri:
|
||||
url: https://localhost/get
|
||||
unix_socket: '{{ remote_tmp_dir }}/https.sock'
|
||||
# Ignore ssl verification since we list the host as localhost
|
||||
# to ensure we really are connecting over the socket
|
||||
validate_certs: false
|
||||
register: unix_socket_https_no_validate
|
||||
|
||||
- name: Test https connection to unix socket
|
||||
uri:
|
||||
url: https://{{ httpbin_host }}/get
|
||||
unix_socket: '{{ remote_tmp_dir }}/https.sock'
|
||||
register: unix_socket_https
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- unix_socket_http.json is defined
|
||||
- unix_socket_https_no_validate.json is defined
|
||||
- unix_socket_https.json is defined
|
@ -1,20 +0,0 @@
|
||||
uri_os_packages:
|
||||
RedHat:
|
||||
urllib3: python-urllib3
|
||||
step1:
|
||||
- python-pyasn1
|
||||
- pyOpenSSL
|
||||
- python-urllib3
|
||||
step2:
|
||||
- libffi-devel
|
||||
- openssl-devel
|
||||
- python-devel
|
||||
Debian:
|
||||
step1:
|
||||
- python-pyasn1
|
||||
- python-openssl
|
||||
- python-urllib3
|
||||
step2:
|
||||
- libffi-dev
|
||||
- libssl-dev
|
||||
- python-dev
|
@ -1,21 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2018 Matt Martz <matt@sivel.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from ansible.module_utils.urls import RequestWithMethod
|
||||
|
||||
|
||||
def test_RequestWithMethod():
|
||||
get = RequestWithMethod('https://ansible.com/', 'GET')
|
||||
assert get.get_method() == 'GET'
|
||||
|
||||
post = RequestWithMethod('https://ansible.com/', 'POST', data='foo', headers={'Bar': 'baz'})
|
||||
assert post.get_method() == 'POST'
|
||||
assert post.get_full_url() == 'https://ansible.com/'
|
||||
assert post.data == 'foo'
|
||||
assert post.headers == {'Bar': 'baz'}
|
||||
|
||||
none = RequestWithMethod('https://ansible.com/', '')
|
||||
assert none.get_method() == 'GET'
|
Loading…
Reference in New Issue