Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES/7574.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Added option to `pulpcore-content` to configure the gunicorn control socket path.
The default path could cause permission errors on certain deployments setups.

This feature was added in gunicorn>=25.1 and is ignored for lower version.
2 changes: 1 addition & 1 deletion pulpcore/app/entrypoint.py
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My local flake8 keeps complaining about those

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def load(self):


@click.option(
"--bind", "-b", default=[f"{ '[::]' if has_ipv6() else '0.0.0.0' }:24817"], multiple=True
"--bind", "-b", default=[f"{'[::]' if has_ipv6() else '0.0.0.0'}:24817"], multiple=True
)
@click.option("--workers", "-w", type=int)
# @click.option("--threads", "-w", type=int) # We don't use a threaded worker...
Expand Down
24 changes: 23 additions & 1 deletion pulpcore/content/entrypoint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys

import click
from importlib.metadata import version as pkg_version
from pulpcore.app.netutil import has_ipv6
from pulpcore.app.pulpcore_gunicorn_application import PulpcoreGunicornApplication
from django.conf import settings
Expand All @@ -22,8 +23,23 @@ def load(self):
return pulpcore.content.server


def _handle_control_interface_feature(options):
"""Drop control_socket from options if gunicorn<25.1, which introduced the feature."""
# TODO: remove this function when gunicorn lowerbound>=25.1
if options.get("control_socket") is None:
return

gunicorn_version = tuple(int(x) for x in pkg_version("gunicorn").split(".")[:2])
if gunicorn_version < (25, 1):
sys.stderr.write(
"Warning: --control-socket requires gunicorn>=25.1, ignoring "
f"(installed: {'.'.join(str(x) for x in gunicorn_version)}).\n"
)
options["control_socket"] = None


@click.option(
"--bind", "-b", default=[f"{ '[::]' if has_ipv6() else '0.0.0.0' }:24816"], multiple=True
"--bind", "-b", default=[f"{'[::]' if has_ipv6() else '0.0.0.0'}:24816"], multiple=True
)
@click.option("--workers", "-w", type=int)
# @click.option("--threads", "-w", type=int) # We don't use a threaded worker...
Expand All @@ -50,6 +66,11 @@ def load(self):
@click.option("--chdir")
@click.option("--user", "-u")
@click.option("--group", "-g")
@click.option(
"--control-socket",
"control_socket",
help="Path to the gunicorn control socket (requires gunicorn>=25.1).",
)
@click.option(
"--name-template",
type=str,
Expand All @@ -61,5 +82,6 @@ def main(bind, name_template, **options):
if name_template:
settings.set("WORKER_NAME_TEMPLATE", name_template)
options["bind"] = list(bind)
_handle_control_interface_feature(options)
sys.argv = sys.argv[:1]
PulpcoreContentApplication(options).run()
Loading