ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14k stars 3.42k forks source link

Permission issue while using the custom-awx-ee in the job template #10285

Closed trinesh17 closed 3 years ago

trinesh17 commented 3 years ago
ISSUE TYPE

Getting permission issue error while executing the job template on custom awx-ee image as execution environment

SUMMARY

Traceback (most recent call last): File "/usr/lib64/python3.8/distutils/file_util.py", line 29, in _copy_file_contents fsrc = open(src, 'rb') PermissionError: [Errno 13] Permission denied: '/var/lib/awx/projects/root/anaconda-ks.cfg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1285, in run self.pre_run_hook(self.instance, private_data_dir) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1797, in pre_run_hook RunProjectUpdate.make_local_copy(job.project, private_data_dir, scm_revision=job_revision) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2219, in make_local_copy copy_tree(project_path, destination_folder, preserve_symlinks=1) File "/usr/lib64/python3.8/distutils/dir_util.py", line 161, in copy_tree copy_file(src_name, dst_name, preserve_mode, File "/usr/lib64/python3.8/distutils/file_util.py", line 151, in copy_file _copy_file_contents(src, dst) File "/usr/lib64/python3.8/distutils/file_util.py", line 31, in _copy_file_contents raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror)) distutils.errors.DistutilsFileError: could not open '/var/lib/awx/projects/root/anaconda-ks.c

ENVIRONMENT
STEPS TO REPRODUCE

Run the job template

EXPECTED RESULTS

Job template should execute successfully

ACTUAL RESULTS

Traceback (most recent call last): File "/usr/lib64/python3.8/distutils/file_util.py", line 29, in _copy_file_contents fsrc = open(src, 'rb') PermissionError: [Errno 13] Permission denied: '/var/lib/awx/projects/root/anaconda-ks.cfg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1285, in run self.pre_run_hook(self.instance, private_data_dir) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1797, in pre_run_hook RunProjectUpdate.make_local_copy(job.project, private_data_dir, scm_revision=job_revision) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2219, in make_local_copy copy_tree(project_path, destination_folder, preserve_symlinks=1) File "/usr/lib64/python3.8/distutils/dir_util.py", line 161, in copy_tree copy_file(src_name, dst_name, preserve_mode, File "/usr/lib64/python3.8/distutils/file_util.py", line 151, in copy_file _copy_file_contents(src, dst) File "/usr/lib64/python3.8/distutils/file_util.py", line 31, in _copy_file_contents raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror)) distutils.errors.DistutilsFileError: could not open '/var/lib/awx/projects/root/anaconda-ks.c

ADDITIONAL INFORMATION

This is my docker file for awx-ee and build the image through cri-o buildah RUN yum -y install \ ca-certificates \ gcc \ git \ git-lfs \ krb5-devel \ krb5-libs \ krb5-workstation \ libcurl-devel \ libxml2-devel \ openssl-devel \ python3-jmespath \ python3-netaddr \ python3-passlib \ python3-pycurl \ python38-devel \ python38-pytz \ python38-pyyaml \ python38-requests \ qemu-img

RUN /usr/bin/python3 -m pip install --upgrade pip

RUN ansible-galaxy collection install dellemc.openmanage --collections-path /usr/share/ansible/collections

RUN ansible-galaxy collection install dellemc.os10 --collections-path /usr/share/ansible/collections

RUN ansible-galaxy collection install community.general --collections-path /usr/share/ansible/collections

RUN update-ca-trust force-enable RUN chmod -R 0777 /usr/share/ansible/collections

USER 1000

trinesh17 commented 3 years ago

FROM quay.io/ansible/awx-ee:0.2.0

USER root

install OS binaries

RUN yum -y install \ ca-certificates \ gcc \ git \ git-lfs \ krb5-devel \ krb5-libs \ krb5-workstation \ libcurl-devel \ libxml2-devel \ openssl-devel \ python3-jmespath \ python3-netaddr \ python3-passlib \ python3-pycurl \ python38-devel \ python38-pytz \ python38-pyyaml \ python38-requests \ qemu-img

RUN /usr/bin/python3 -m pip install --upgrade pip

RUN ansible-galaxy collection install dellemc.openmanage --collections-path /usr/share/ansible/collections

RUN ansible-galaxy collection install dellemc.os10 --collections-path /usr/share/ansible/collections

RUN ansible-galaxy collection install community.general --collections-path /usr/share/ansible/collections

RUN update-ca-trust force-enable RUN chmod -R 0777 /usr/share/ansible/collections

USER 1000

wenottingham commented 3 years ago

... do you have an unreadable file in your project?

trinesh17 commented 3 years ago

Yeah..i found one unreadable file in my project and it worked after deleting that file.. Thanks!