1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 17:55:10 +03:00

Make HTTPConnection import python 2,3 agnostic

This commit is contained in:
Wander Boessenkool 2019-10-17 23:36:33 +02:00
parent 00c9d756e8
commit c49e64e62c

View File

@ -273,12 +273,15 @@ spec:
- /usr/bin/python
- -c
- |
import httplib
try:
from http.client import HTTPConnection
except ImportError:
from httplib import HTTPConnection
import sys
import os
import base64
authsecret = base64.b64encode(os.getenv('RABBITMQ_USER') + ':' + os.getenv('RABBITMQ_PASSWORD'))
conn=httplib.HTTPConnection('localhost:15672')
conn=HTTPConnection('localhost:15672')
conn.request('GET', '/api/healthchecks/node', headers={'Authorization': 'Basic %s' % authsecret})
r1 = conn.getresponse()
if r1.status != 200:
@ -297,12 +300,15 @@ spec:
- /usr/bin/python
- -c
- |
import httplib
try:
from http.client import HTTPConnection
except ImportError:
from httplib import HTTPConnection
import sys
import os
import base64
authsecret = base64.b64encode(os.getenv('RABBITMQ_USER') + ':' + os.getenv('RABBITMQ_PASSWORD'))
conn=httplib.HTTPConnection('localhost:15672')
conn=HTTPConnection('localhost:15672')
conn.request('GET', '/api/healthchecks/node', headers={'Authorization': 'Basic %s' % authsecret})
r1 = conn.getresponse()
if r1.status != 200: