Skip to content

Commit

Permalink
fix: don't try to edit client_max_body_size
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 2, 2024
1 parent 3508c88 commit 160906b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
checks:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: "3.8"
- name: Install flake8 dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: "3.9"
- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.11.7
- fix: don't try to edit client_max_body_size
0.11.6
- fix: update scripts not working with new pyproject.toml installs
0.11.5
Expand Down
2 changes: 1 addition & 1 deletion dcor_control/cli/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def inspect(assume_yes=False, dcor_site_config_dir=None):
cn += inspect_mod.check_supervisord(autocorrect=assume_yes)

click.secho("Checking nginx configuration...", bold=True)
cn += inspect_mod.check_nginx(cmbs="100G", autocorrect=assume_yes)
cn += inspect_mod.check_nginx(autocorrect=assume_yes)

click.secho("Checking uploader symlink patch...", bold=True)
cn += inspect_mod.check_ckan_uploader_patch_to_support_symlinks(
Expand Down
24 changes: 5 additions & 19 deletions dcor_control/inspect/config_nginx.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
from dcor_shared.paths import get_nginx_config_path

from .common import ask


def check_nginx(cmbs, autocorrect=False):
def check_nginx(autocorrect=False):
did_something = 0
path_nginx = get_nginx_config_path()
with open(path_nginx) as fd:
lines = fd.readlines()
for ii, line in enumerate(lines):
if not line.strip() or line.startswith("#"):
continue
elif line.strip().startswith("client_max_body_size"):
cur = line.strip().split()[1].strip(";")
if cur != cmbs:
if autocorrect:
print("Setting client_max_body_size to {}".format(cmbs))
correct = True
else:
correct = ask("'client_max_body_size' should be "
+ "'{}', but is '{}'".format(cmbs, cur))
if correct:
did_something += 1
lines[ii] = line.replace(cur, cmbs)
path_nginx.write_text("\n".join(lines))
break
else:
raise ValueError("'client_max_body_size' not set!")
else:
# TODO:
# - check for DCOR-Aid client version
pass

return did_something
3 changes: 1 addition & 2 deletions dcor_control/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import pathlib
import subprocess as sp
import sys

import click
# replace this import when dropping support for Python 3.8
Expand Down Expand Up @@ -108,7 +107,7 @@ def update_package(name):
# in editable mode. Import the package to identify its
# location.
mod_name = (name.replace("-", ".", 1)
if name.startswith("ckanext-") else name)
if name.startswith("ckanext-") else name)
mod = importlib.import_module(mod_name)
for pp in pathlib.Path(mod.__file__).parents:
if (pp / ".git").exists():
Expand Down

0 comments on commit 160906b

Please sign in to comment.