7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-05-28 20:00:49 +00:00

Rename "config [non]interactive" command to "config save [--silent]"

This commit is contained in:
Régis Behmo 2019-03-06 17:49:15 +01:00
parent 9b35490449
commit 970ab607b5
7 changed files with 21 additions and 34 deletions

View File

@ -2,6 +2,7 @@
## Latest
- [Improvement] Rename "config [non]interactive" command to "config save [--silent]"
- [Improvement] More explicit logging during environment generation
- [Improvement] Configurable docker images (#122)
- [Bugfix] Fix "android pullimage" command

View File

@ -26,7 +26,7 @@ retag:
git push origin $(TAG)
travis: bundle ## Run tests on travis-ci
./dist/tutor config noninteractive
./dist/tutor config save --silent
./dist/tutor images env
./dist/tutor images build all
./dist/tutor local databases
@ -43,7 +43,7 @@ ci-bundle: ## Create bundle
cp ./dist/tutor ./releases/tutor-$$(uname -s)_$$(uname -m)
ci-test: ## Run basic tests
./dist/tutor config noninteractive
./dist/tutor config save --silent
./dist/tutor images env
./dist/tutor local env

View File

@ -3,7 +3,7 @@
Configuration
=============
With Tutor, all Open edX deployment parameters are stored in a single ``config.yml`` file. This is the file that is generated when you run ``tutor local quickstart`` or ``tutor config interactive``. To view the content of this file, run::
With Tutor, all Open edX deployment parameters are stored in a single ``config.yml`` file. This is the file that is generated when you run ``tutor local quickstart`` or ``tutor config save``. To view the content of this file, run::
cat $(tutor config printroot)/config.yml
@ -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 noninteractive --set PARAM1=VALUE1 --set PARAM2=VALUE2
tutor config save --silent --set PARAM1=VALUE1 --set PARAM2=VALUE2
After changing a configuration parameter, it will be taken into account next time the environment is generated. For instance, in a local installation::

View File

@ -21,9 +21,9 @@ Configuration
::
tutor config interactive
tutor config save
This is the only non-automatic step in the install process. You will be asked various questions about your Open edX platform and appropriate configuration files will be generated. If you would like to automate this step then you should run ``tutor config interactive`` once. After that, there will be a ``config.yml`` file at the root of the project folder: this file contains all the configuration values for your platform, such as randomly generated passwords, domain names, etc.
This is the only non-automatic step in the install process. You will be asked various questions about your Open edX platform and appropriate configuration files will be generated. If you would like to automate this step then you should run ``tutor config save`` once. After that, there will be a ``config.yml`` file at the root of the project folder: this file contains all the configuration values for your platform, such as randomly generated passwords, domain names, etc.
If you want to run a fully automated install, upload the ``config.yml`` file to wherever you want to run Open edX. You can then entirely skip the configuration step.

View File

@ -14,37 +14,24 @@ from . import opts
short_help="Configure Open edX",
help="""Configure Open edX and store configuration values in $TUTOR_ROOT/config.yml"""
)
@opts.root
def config(root):
def config():
pass
@click.command(
help="Create and save configuration interactively",
)
@click.command(help="Create and save configuration interactively")
@opts.root
@click.option("--silent", is_flag=True, help="Run non-interactively")
@opts.key_value
def interactive(root, set_):
def save(root, silent, set_):
config = {}
load_files(config, root)
for k, v in set_:
config[k] = v
load_interactive(config)
save(config, root)
if not silent:
load_interactive(config)
save_config(config, root)
@click.command(
help="Create and save configuration without user interaction",
)
@opts.root
@opts.key_value
def noninteractive(root, set_):
config = {}
load_files(config, root)
for k, v in set_:
config[k] = v
save(config, root)
@click.command(
help="Print the tutor project root",
help="Print the project root",
)
@opts.root
def printroot(root):
@ -60,7 +47,7 @@ def load(root):
if not os.path.exists(config_path(root)):
load_interactive(config)
save(config, root)
save_config(config, root)
load_defaults(config)
@ -156,11 +143,11 @@ def convert_json2yml(root):
)
with open(json_path) as fi:
config = json.load(fi)
save(config, root)
save_config(config, root)
os.remove(json_path)
click.echo(fmt.info("File config.json detected in {} and converted to config.yml".format(root)))
def save(config, root):
def save_config(config, root):
env.render_dict(config)
path = config_path(root)
directory = os.path.dirname(path)
@ -173,6 +160,5 @@ def save(config, root):
def config_path(root):
return os.path.join(root, "config.yml")
config.add_command(interactive)
config.add_command(noninteractive)
config.add_command(save)
config.add_command(printroot)

View File

@ -20,7 +20,7 @@ def k8s():
@opts.root
def quickstart(root):
click.echo(fmt.title("Interactive platform configuration"))
tutor_config.interactive.callback(root, [])
tutor_config.save.callback(root, False, [])
click.echo(fmt.title("Environment generation"))
env.callback(root)
click.echo(fmt.title("Stopping any existing platform"))

View File

@ -27,7 +27,7 @@ def local():
@opts.root
def quickstart(pullimages_, root):
click.echo(fmt.title("Interactive platform configuration"))
tutor_config.interactive.callback(root, [])
tutor_config.save.callback(root, False, [])
click.echo(fmt.title("Environment generation"))
env.callback(root)
click.echo(fmt.title("Stopping any existing platform"))