-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't try to edit client_max_body_size
- Loading branch information
1 parent
3508c88
commit 160906b
Showing
6 changed files
with
13 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters