Skip to content

Commit

Permalink
Rename --silent option to -y/--yes
Browse files Browse the repository at this point in the history
  • Loading branch information
regisb committed Apr 9, 2019
1 parent 6c13710 commit 3b9880e
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cloud/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
2 changes: 1 addition & 1 deletion docs/customise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Running a different ``openedx`` Docker image

By default, Tutor runs the `regis/openedx <https://hub.docker.com/r/regis/openedx/>`_ docker image from Docker Hub. If you have an account on `hub.docker.com <https://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

Expand Down
2 changes: 1 addition & 1 deletion docs/local.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
14 changes: 10 additions & 4 deletions tutor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion tutor/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
8 changes: 3 additions & 5 deletions tutor/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 3b9880e

Please sign in to comment.