6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +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 ## Latest
- [Improvement] Rename "config [non]interactive" command to "config save [--silent]"
- [Improvement] More explicit logging during environment generation - [Improvement] More explicit logging during environment generation
- [Improvement] Configurable docker images (#122) - [Improvement] Configurable docker images (#122)
- [Bugfix] Fix "android pullimage" command - [Bugfix] Fix "android pullimage" command

View File

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

View File

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

View File

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

View File

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