diff options
author | Craig Vyvial <cp16net@gmail.com> | 2014-09-18 15:10:24 -0500 |
---|---|---|
committer | Craig Vyvial <cp16net@gmail.com> | 2014-09-19 16:58:21 -0500 |
commit | 518dd2f64743c369451f5cd1fb1ef6f6606acff9 (patch) | |
tree | fe45036f63701c3164b72b62ba6eb2093d22377e | |
parent | 108fbc5ef388e9718e74f9136367f44f4ca375e8 (diff) | |
download | trove-518dd2f64743c369451f5cd1fb1ef6f6606acff9.tar.gz |
loading configuration parameters from trove-manage better
It is a pain to load the configuration parameters when setting up
a new environment. Since theres no way to get the uuid of the
datastore version that is created you must get it by looking in
the database.
Closes-Bug: #1371297
Change-Id: If8cea0aaf38878bb04abe6e27b9bfd77d5684bce
-rwxr-xr-x | trove/cmd/manage.py | 16 | ||||
-rw-r--r-- | trove/configuration/models.py | 9 |
2 files changed, 17 insertions, 8 deletions
diff --git a/trove/cmd/manage.py b/trove/cmd/manage.py index 060097d8..86c00562 100755 --- a/trove/cmd/manage.py +++ b/trove/cmd/manage.py @@ -82,12 +82,13 @@ class Commands(object): self.db_sync(repo_path) def db_load_datastore_config_parameters(self, - datastore_version_id, + datastore, + datastore_version, config_file_location): - print("Loading config parameters for datastore version: %s" - % datastore_version_id) + print("Loading config parameters for datastore (%s) version (%s)" + % (datastore, datastore_version)) config_models.load_datastore_configuration_parameters( - datastore_version_id, config_file_location) + datastore, datastore_version, config_file_location) def params_of(self, command_name): if Commands.has(command_name): @@ -157,8 +158,11 @@ def main(): description='Loads configuration group parameter validation rules ' 'for a datastore version into the database.') parser.add_argument( - 'datastore_version_id', - help='UUID of the datastore version.') + 'datastore', + help='Name of the datastore.') + parser.add_argument( + 'datastore_version', + help='Name of the datastore version.') parser.add_argument( 'config_file_location', help='Fully qualified file path to the configuration group ' diff --git a/trove/configuration/models.py b/trove/configuration/models.py index c1bb39a9..6ad056f7 100644 --- a/trove/configuration/models.py +++ b/trove/configuration/models.py @@ -392,13 +392,18 @@ def create_or_update_datastore_configuration_parameter(name, get_db_api().save(config) -def load_datastore_configuration_parameters(datastore_version_id, config_file): +def load_datastore_configuration_parameters(datastore, + datastore_version, + config_file): + get_db_api().configure_db(CONF) + (ds, ds_v) = dstore_models.get_datastore_version( + type=datastore, version=datastore_version) with open(config_file) as f: config = json.load(f) for param in config['configuration-parameters']: create_or_update_datastore_configuration_parameter( param['name'], - datastore_version_id, + ds_v.id, param['restart_required'], param['type'], param.get('max'), |