mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
fix some isolated py3 bugs
This commit is contained in:
committed by
Ryan Petrello
parent
af4234556e
commit
2c5bdf3611
@@ -54,9 +54,8 @@ class IsolatedFileWrite:
|
|||||||
filename = '{}-partial.json'.format(event_uuid)
|
filename = '{}-partial.json'.format(event_uuid)
|
||||||
dropoff_location = os.path.join(self.private_data_dir, 'artifacts', 'job_events', filename)
|
dropoff_location = os.path.join(self.private_data_dir, 'artifacts', 'job_events', filename)
|
||||||
write_location = '.'.join([dropoff_location, 'tmp'])
|
write_location = '.'.join([dropoff_location, 'tmp'])
|
||||||
partial_data = json.dumps(value)
|
|
||||||
with os.fdopen(os.open(write_location, os.O_WRONLY | os.O_CREAT, stat.S_IRUSR | stat.S_IWUSR), 'w') as f:
|
with os.fdopen(os.open(write_location, os.O_WRONLY | os.O_CREAT, stat.S_IRUSR | stat.S_IWUSR), 'w') as f:
|
||||||
f.write(partial_data)
|
f.write(value)
|
||||||
os.rename(write_location, dropoff_location)
|
os.rename(write_location, dropoff_location)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ class IsolatedManager(object):
|
|||||||
|
|
||||||
path = self.path_to('artifacts', 'stdout')
|
path = self.path_to('artifacts', 'stdout')
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
with open(path, 'r') as f:
|
with codecs.open(path, 'r', encoding='utf-8') as f:
|
||||||
f.seek(seek)
|
f.seek(seek)
|
||||||
for line in f:
|
for line in f:
|
||||||
self.stdout_handle.write(line)
|
self.stdout_handle.write(line)
|
||||||
@@ -419,7 +419,7 @@ class IsolatedManager(object):
|
|||||||
env['ANSIBLE_CACHE_PLUGIN'] = 'jsonfile'
|
env['ANSIBLE_CACHE_PLUGIN'] = 'jsonfile'
|
||||||
env['ANSIBLE_CACHE_PLUGIN_CONNECTION'] = facts_path
|
env['ANSIBLE_CACHE_PLUGIN_CONNECTION'] = facts_path
|
||||||
|
|
||||||
buff = StringIO.StringIO()
|
buff = StringIO()
|
||||||
timeout = max(60, 2 * settings.AWX_ISOLATED_CONNECTION_TIMEOUT)
|
timeout = max(60, 2 * settings.AWX_ISOLATED_CONNECTION_TIMEOUT)
|
||||||
status, rc = IsolatedManager.run_pexpect(
|
status, rc = IsolatedManager.run_pexpect(
|
||||||
args, cls.awx_playbook_path(), env, buff,
|
args, cls.awx_playbook_path(), env, buff,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2015 Ansible, Inc.
|
# Copyright (c) 2015 Ansible, Inc.
|
||||||
# All Rights Reserved
|
# All Rights Reserved
|
||||||
import datetime
|
import datetime
|
||||||
|
from django.utils.encoding import smart_str
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
@@ -35,10 +36,10 @@ class Command(BaseCommand):
|
|||||||
).save()
|
).save()
|
||||||
pemfile = Setting.objects.create(
|
pemfile = Setting.objects.create(
|
||||||
key='AWX_ISOLATED_PUBLIC_KEY',
|
key='AWX_ISOLATED_PUBLIC_KEY',
|
||||||
value=key.public_key().public_bytes(
|
value=smart_str(key.public_key().public_bytes(
|
||||||
encoding=serialization.Encoding.OpenSSH,
|
encoding=serialization.Encoding.OpenSSH,
|
||||||
format=serialization.PublicFormat.OpenSSH
|
format=serialization.PublicFormat.OpenSSH
|
||||||
) + " generated-by-awx@%s" % datetime.datetime.utcnow().isoformat()
|
)) + " generated-by-awx@%s" % datetime.datetime.utcnow().isoformat()
|
||||||
)
|
)
|
||||||
pemfile.save()
|
pemfile.save()
|
||||||
print(pemfile.value)
|
print(pemfile.value)
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ ADD Makefile /tmp/Makefile
|
|||||||
RUN mkdir /tmp/requirements
|
RUN mkdir /tmp/requirements
|
||||||
ADD requirements/requirements_ansible.txt requirements/requirements_ansible_git.txt requirements/requirements_ansible_uninstall.txt requirements/requirements_isolated.txt /tmp/requirements/
|
ADD requirements/requirements_ansible.txt requirements/requirements_ansible_git.txt requirements/requirements_ansible_uninstall.txt requirements/requirements_isolated.txt /tmp/requirements/
|
||||||
RUN yum -y update && yum -y install curl epel-release
|
RUN yum -y update && yum -y install curl epel-release
|
||||||
RUN yum -y update && yum -y install openssh-server ansible mg vim tmux git python-devel python-psycopg2 make python-psutil libxml2-devel libxslt-devel libstdc++.so.6 gcc cyrus-sasl-devel cyrus-sasl openldap-devel libffi-devel zeromq-devel python-pip xmlsec1-devel swig krb5-devel xmlsec1-openssl xmlsec1 xmlsec1-openssl-devel libtool-ltdl-devel bubblewrap zanata-python-client gettext gcc-c++ libcurl-devel python-pycurl bzip2
|
RUN yum -y update && yum -y install openssh-server ansible mg vim tmux git python-devel python36 python36-devel python-psycopg2 make python-psutil libxml2-devel libxslt-devel libstdc++.so.6 gcc cyrus-sasl-devel cyrus-sasl openldap-devel libffi-devel zeromq-devel python-pip xmlsec1-devel swig krb5-devel xmlsec1-openssl xmlsec1 xmlsec1-openssl-devel libtool-ltdl-devel bubblewrap zanata-python-client gettext gcc-c++ libcurl-devel python-pycurl bzip2
|
||||||
RUN pip install virtualenv
|
|
||||||
|
RUN ln -s /usr/bin/python36 /usr/bin/python3
|
||||||
|
RUN python36 -m ensurepip
|
||||||
|
RUN pip3 install virtualenv
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
RUN make requirements_ansible
|
RUN make requirements_ansible
|
||||||
RUN make requirements_isolated
|
RUN make requirements_isolated
|
||||||
|
|||||||
Reference in New Issue
Block a user