6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-05 21:07:50 +00:00

fix: "unexpected args" error on k8s

`kubectl_apply` was missing a "root" argument.

Close #611.
This commit is contained in:
Régis Behmo 2022-03-17 10:34:17 +01:00 committed by Régis Behmo
parent 8e052f703f
commit f13c3db833
3 changed files with 13 additions and 22 deletions

View File

@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Fix "Unexpected args" error during service initialization on Kubernetes (#611).
## v13.1.6 (2022-03-15)
- [Bugfix] Fix `local/k8s quickstart` commands when upgrading from an older release (#595).

View File

@ -113,6 +113,7 @@ class K8sJobRunner(jobs.BaseJobRunner):
# We cannot use the k8s API to create the job: configMap and volume names need
# to be found with the right suffixes.
kubectl_apply(
self.root,
"--selector",
f"app.kubernetes.io/name={job_name}",
)
@ -232,27 +233,21 @@ def start(context: Context, names: List[str]) -> None:
for name in names:
if name == "all":
# Create volumes
utils.kubectl(
"apply",
"--kustomize",
tutor_env.pathjoin(context.root),
kubectl_apply(
context.root,
"--wait",
"--selector",
"app.kubernetes.io/component=volume",
)
# Create everything else except jobs
utils.kubectl(
"apply",
"--kustomize",
tutor_env.pathjoin(context.root),
kubectl_apply(
context.root,
"--selector",
"app.kubernetes.io/component notin (job,volume,namespace)",
)
else:
utils.kubectl(
"apply",
"--kustomize",
tutor_env.pathjoin(context.root),
kubectl_apply(
context.root,
"--selector",
f"app.kubernetes.io/name={name}",
)

View File

@ -56,24 +56,20 @@ def initialise(runner: BaseJobRunner, limit_to: Optional[str] = None) -> None:
if limit_to is None or limit_to == plugin_name:
for service in hook:
fmt.echo_info(
"Plugin {}: running pre-init for service {}...".format(
plugin_name, service
)
f"Plugin {plugin_name}: running pre-init for service {service}..."
)
runner.run_job_from_template(
service, plugin_name, "hooks", service, "pre-init"
)
for service in ["lms", "cms"]:
if limit_to is None or limit_to == service:
fmt.echo_info("Initialising {}...".format(service))
fmt.echo_info(f"Initialising {service}...")
runner.run_job_from_template(service, "hooks", service, "init")
for plugin_name, hook in runner.iter_plugin_hooks("init"):
if limit_to is None or limit_to == plugin_name:
for service in hook:
fmt.echo_info(
"Plugin {}: running init for service {}...".format(
plugin_name, service
)
f"Plugin {plugin_name}: running init for service {service}..."
)
runner.run_job_from_template(
service, plugin_name, "hooks", service, "init"
@ -136,9 +132,7 @@ site.themes.create(theme_dir_name='{theme_name}')
""".format(
theme_name=theme_name, domain_name=domain_name
)
command = BASE_OPENEDX_COMMAND + './manage.py lms shell -c "{python_code}"'.format(
python_code=python_code
)
command = BASE_OPENEDX_COMMAND + f'./manage.py lms shell -c "{python_code}"'
runner.run_job("lms", command)