Project

General

Profile

Bug #32309

Installing foreman from certain directories will fail on Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]

Added by Ian Ballou 2 months ago. Updated 30 days ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Foreman modules
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1937024

Description of problem:

Try to install foreman from the /root/ or /root/somedir directory. the important part is that the pulpcore user should not be able to read it. (its unclear if just /root will reproduce the problem or if it has to be /root/somedir)

you will get:

Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]

Version-Release number of selected component (if applicable):
Katello 3.18

Steps to Reproduce:
1. as root: mkdir /root/somedir
2. cd /root/somedir
3. run the installer for the first time: foreman-installer

Actual results:

Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]

upon deeper investigation we see:

Exec[pulpcore-manager collectstatic --noinput]/returns: Traceback (most recent call last):
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/bin/pulpcore-manager", line 11, in <module>
Exec[pulpcore-manager collectstatic --noinput]/returns: load_entry_point('pulpcore==3.7.3', 'console_scripts', 'pulpcore-manager')()
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/pulpcore/app/manage.py", line 11, in manage
Exec[pulpcore-manager collectstatic --noinput]/returns: execute_from_command_line(sys.argv)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
Exec[pulpcore-manager collectstatic --noinput]/returns: utility.execute()
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 325, in execute
Exec[pulpcore-manager collectstatic --noinput]/returns: settings.INSTALLED_APPS
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in getattr
Exec[pulpcore-manager collectstatic --noinput]/returns: self._setup(name)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in setup
Exec[pulpcore-manager collectstatic --noinput]/returns: self._wrapped = Settings(settings_module)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/conf/
_init__.py", line 157, in init
Exec[pulpcore-manager collectstatic --noinput]/returns: mod = importlib.import_module(self.SETTINGS_MODULE)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
Exec[pulpcore-manager collectstatic --noinput]/returns: return _bootstrap._gcd_import(name[level:], package, level)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
Exec[pulpcore-manager collectstatic --noinput]/returns: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/pulpcore/app/settings.py", line 248, in <module>
Exec[pulpcore-manager collectstatic --noinput]/returns: ENVVAR_FOR_DYNACONF="PULP_SETTINGS",
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/contrib/django_dynaconf_v2.py", line 76, in load
Exec[pulpcore-manager collectstatic --noinput]/returns: lazy_settings.populate_obj(django_settings_module)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/base.py", line 141, in getattr
Exec[pulpcore-manager collectstatic --noinput]/returns: self._setup()
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/base.py", line 186, in _setup
Exec[pulpcore-manager collectstatic --noinput]/returns: default_settings.reload(self._kwargs.get("load_dotenv"))
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/default_settings.py", line 67, in reload
Exec[pulpcore-manager collectstatic --noinput]/returns: start_dotenv(*args, **kwargs)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/default_settings.py", line 53, in start_dotenv
Exec[pulpcore-manager collectstatic --noinput]/returns: or _find_file(".env", project_root=root_path)
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/utils/files.py", line 60, in find_file
Exec[pulpcore-manager collectstatic --noinput]/returns: search_tree.extend(_walk_to_root(work_dir))
Exec[pulpcore-manager collectstatic --noinput]/returns: File "/usr/lib/python3.6/site-packages/dynaconf/utils/files.py", line 13, in _walk_to_root
Exec[pulpcore-manager collectstatic --noinput]/returns: raise IOError("Starting path not found")
Exec[pulpcore-manager collectstatic --noinput]/returns: OSError: Starting path not found
Exec[pulpcore-manager collectstatic --noinput]: Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]
Exec[pulpcore-manager collectstatic --noinput]: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]
Exec[pulpcore-manager collectstatic --noinput]: Evaluated in 0.65 seconds

Associated revisions

Revision 951a2f82 (diff)
Added by Ian Ballou 2 months ago

Fixes #32309 - Run admin commands from Pulp's home

  • Dynaconf seems to always be using the current directory. As such, the
    cwd could be a directory that is unreadable by the pulp user. Pulp's
    user home must always be readable by the pulp user.

History

#1 Updated by The Foreman Bot 2 months ago

  • Assignee set to Ian Ballou
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/puppet-pulpcore/pull/181 added

#2 Updated by Ewoud Kohl van Wijngaarden 2 months ago

  • Triaged changed from No to Yes
  • Target version set to 2.3.4
  • Category set to Foreman modules
  • Subject changed from Installing foreman from certain directories will fail on Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0] to Installing foreman from certain directories will fail on Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]

For what it's worth, the actual results part is highly misleading. In Pulpcore 3.7.4 a cherry pick was made that disabled .env loading. That means that the shown stack trace is irrelevant. However, even in 3.7.4 it can fail.

#3 Updated by Ian Ballou 2 months ago

  • Status changed from Ready For Testing to Closed

#4 Updated by The Foreman Bot about 1 month ago

  • Pull request https://github.com/theforeman/puppet-pulpcore/pull/191 added

#5 Updated by Ewoud Kohl van Wijngaarden about 1 month ago

The workaround is to execute the installer from a path that is readable by Pulp, like /.

#6 Updated by Amit Upadhye 30 days ago

  • Fixed in Releases 2.3.4 added

Also available in: Atom PDF