diff --git a/CHANGELOG.md b/CHANGELOG.md index 4391b4f..7eb19b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Latest +- [Improvement] Rename `--silent` option to `-y/--yes` - [Bugfix] Fix (again) login from studio when https is activated (#193) ## v3.3.3 (2019-03-29) diff --git a/Makefile b/Makefile index cc22d0b..a4b3019 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ ci-bundle: ## Create bundle and run basic tests cp ./dist/tutor ./releases/tutor-$$(uname -s)_$$(uname -m) ./dist/tutor --version ./dist/tutor config printroot - ./dist/tutor config save --silent --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true + ./dist/tutor config save --yes --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true ci-images: ## Build and push docker images to hub.docker.com python setup.py develop diff --git a/cloud/aws.sh b/cloud/aws.sh index 54f0705..d6a5222 100755 --- a/cloud/aws.sh +++ b/cloud/aws.sh @@ -36,7 +36,7 @@ sudo curl -L "https://github.com/regisb/tutor/releases/download/latest/tutor-$(u sudo chmod +x /usr/local/bin/tutor echo "=============== Pulling vendor docker images" -tutor config save --silent +tutor config save --yes tutor images pull elasticsearch tutor images pull memcached tutor images pull mongodb @@ -64,7 +64,7 @@ docker push localhost:5000/$(tutor config printvalue DOCKER_IMAGE_NGINX) docker push localhost:5000/$(tutor config printvalue DOCKER_IMAGE_RABBITMQ) echo "=============== Building openedx docker images" -tutor config save --silent --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true --set DOCKER_REGISTRY=localhost:5000/ +tutor config save --yes --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true --set DOCKER_REGISTRY=localhost:5000/ tutor images build all echo "=============== Create Web UI script" diff --git a/docs/configuration.rst b/docs/configuration.rst index 95fb699..933b73b 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -13,7 +13,7 @@ By default, this file contains only the required configuration parameters for ru Alternatively, you can set each parameter from the command line:: - tutor config save --silent --set PARAM1=VALUE1 --set PARAM2=VALUE2 + tutor config save -y --set PARAM1=VALUE1 --set PARAM2=VALUE2 Or from the system environment:: diff --git a/docs/customise.rst b/docs/customise.rst index 8d421ac..c2e4394 100644 --- a/docs/customise.rst +++ b/docs/customise.rst @@ -75,7 +75,7 @@ Running a different ``openedx`` Docker image By default, Tutor runs the `regis/openedx `_ docker image from Docker Hub. If you have an account on `hub.docker.com `_ or you have a private image registry, you can build your image and push it to your registry with:: - tutor config save --silent --set DOCKER_IMAGE_OPENEDX=myusername/openedx:mytag + tutor config save -y --set DOCKER_IMAGE_OPENEDX=myusername/openedx:mytag tutor images build openedx tutor images push openedx diff --git a/docs/local.rst b/docs/local.rst index e021f22..3b5b07d 100644 --- a/docs/local.rst +++ b/docs/local.rst @@ -127,7 +127,7 @@ Running Open edX behind a web proxy The containerized web server (nginx) needs to listen to ports 80 and 443 on the host. If there is already a webserver running on the host, such as Apache or Nginx, the nginx container will not be able to start. Tutor supports running behind a web proxy. To do so, add the following configuration:: - tutor config save --silent --set WEB_PROXY=true --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=444 + tutor config save -y --set WEB_PROXY=true --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=444 In this example, the nginx container ports would be mapped to 81 and 444, instead of 80 and 443. You must then configure the web proxy on the host. Basic configuration files are provided by Tutor which can be used directly by your web proxy. diff --git a/tutor/config.py b/tutor/config.py index 59b8fd2..118fa0f 100644 --- a/tutor/config.py +++ b/tutor/config.py @@ -21,12 +21,18 @@ def config(): @click.command(help="Create and save configuration interactively") @opts.root -@click.option("--silent", is_flag=True, help="Run non-interactively") +@click.option("-y", "--yes", "silent1", is_flag=True, help="Run non-interactively") +@click.option("--silent", "silent2", is_flag=True, hidden=True) @opts.key_value -def save(root, silent, set_): +def save_command(root, silent1, silent2, set_): + silent = silent1 or silent2 + save(root, silent=silent, keyvalues=set_) + +def save(root, silent=False, keyvalues=None): + keyvalues = keyvalues or [] config = {} load_current(config, root) - for k, v in set_: + for k, v in keyvalues: config[k] = v if not silent: load_interactive(config) @@ -225,6 +231,6 @@ def save_env(root, config): def config_path(root): return os.path.join(root, "config.yml") -config.add_command(save) +config.add_command(save_command, name="save") config.add_command(printroot) config.add_command(printvalue) diff --git a/tutor/k8s.py b/tutor/k8s.py index dbda5ab..c64c1d1 100644 --- a/tutor/k8s.py +++ b/tutor/k8s.py @@ -20,7 +20,7 @@ def k8s(): @opts.root def quickstart(root): click.echo(fmt.title("Interactive platform configuration")) - tutor_config.save.callback(root, False, []) + tutor_config.save(root) click.echo(fmt.title("Stopping any existing platform")) stop.callback() click.echo(fmt.title("Starting the platform")) diff --git a/tutor/local.py b/tutor/local.py index 60b7fd4..9fdd949 100644 --- a/tutor/local.py +++ b/tutor/local.py @@ -25,7 +25,7 @@ def local(): @opts.root def quickstart(pullimages_, root): click.echo(fmt.title("Interactive platform configuration")) - tutor_config.save.callback(root, False, []) + tutor_config.save(root) click.echo(fmt.title("Stopping any existing platform")) stop.callback(root) if pullimages_: @@ -167,8 +167,7 @@ def https_create(root): script = scripts.render_template(config, 'https_create.sh') if config['WEB_PROXY']: - click.echo(fmt.info( -"""You are running Tutor behind a web proxy (WEB_PROXY=true): SSL/TLS + click.echo(fmt.info("""You are running Tutor behind a web proxy (WEB_PROXY=true): SSL/TLS certificates must be generated on the host. For instance, to generate certificates with Let's Encrypt, run: @@ -193,8 +192,7 @@ def https_renew(root): click.echo(fmt.info("HTTPS is not activated: certificate renewal skipped")) return if config['WEB_PROXY']: - click.echo(fmt.info( -"""You are running Tutor behind a web proxy (WEB_PROXY=true): SSL/TLS + click.echo(fmt.info("""You are running Tutor behind a web proxy (WEB_PROXY=true): SSL/TLS certificates must be renewed on the host. For instance, to renew Let's Encrypt certificates, run: