Project

Profile

Help

Issue #5474

For all processes launched by systemd ensure the PATH includes the virtualenv if installed in a virtualenv

Added by bmbouter 29 days ago. Updated 11 days ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 3 installer
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 59

Description

Problem

The pulp_ansible plugin uses some dependencies in its task code that use subprocess to call other Python code. Regardless of if that's a good idea or not, a plugin writer expects that a its code is running in a virtualenv if the Installer created one.

The systemd unit definitions do not add the binary areas of the virtualenv to be part of the PATH. Because of this you can import Python code that was installed because the import path is modified, but you couldn't call a binary tool installed by one of those Python packages.

Here's an example of the error in pulp_ansible's functional tests at commit 03ebfbc7cd5da98056c5efb24c091ffdf316ff0a

Traceback (most recent call last):
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/worker.py", line 822, in perform_job
    rv = job.perform()
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/job.py", line 605, in perform
    self._result = self._execute()
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/job.py", line 611, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/home/vagrant/devel/pulp_ansible/pulp_ansible/app/tasks/collections.py", line 133, in import_collection
    artifact_file, filename=filename, logger=import_logger
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/collection.py", line 44, in import_collection
    return _import_collection(file, filename, logger)
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/collection.py", line 52, in _import_collection
    data = CollectionLoader(extract_dir, filename, logger=logger).load()
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/collection.py", line 80, in load 
    self.content_objs = list(self._load_contents())
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/collection.py", line 121, in _load_contents
    content_obj = loader.load()
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/loaders.py", line 157, in load
    for line in self._lint_role(self.rel_path):
  File "/usr/local/lib/pulp/lib64/python3.7/site-packages/galaxy_importer/loaders.py", line 185, in _lint_role
    stdout=PIPE,
  File "/usr/lib64/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ansible-lint': 'ansible-lint'

Solution

Check the Installer's systemd scripts to ensure they are manipulating the PATH correctly to include the shell areas of the virutalenv also.

Associated revisions

Revision 5a161582 View on GitHub
Added by bmbouter 29 days ago

Add virtualenv /bin/ to systemd PATH

The systemd files did not manipulate the binary, so the Python import
would be inside the virtualenv a call to `subprocess` would not.

https://pulp.plan.io/issues/5474
closes #5474

History

#1 Updated by bmbouter 29 days ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to bmbouter
  • Sprint set to Sprint 59

Adding as an AnsibleFest blocker.

#2 Updated by bmbouter 29 days ago

  • Status changed from ASSIGNED to POST

#3 Updated by fabricio.aguiar 27 days ago

  • Triaged changed from No to Yes

#4 Updated by bmbouter 24 days ago

  • Status changed from POST to MODIFIED

Please register to edit this issue

Also available in: Atom PDF