From 7162c74c2458287c7022c6bc4538a2147e7f84fb Mon Sep 17 00:00:00 2001 From: Nicholas Wiltsie Date: Mon, 11 Mar 2024 13:24:36 -0700 Subject: [PATCH] Add defs to incorrectly-global variables --- CHANGELOG.md | 1 + config/retry/retry.config | 2 +- config/schema/schema.config | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e3a84..71e69b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Allow `set_resources_allocation` to use maximum allocation values defined in params +- Add `def`s to multiple variables that should not be globally defined --- diff --git a/config/retry/retry.config b/config/retry/retry.config index f3f225d..0503ced 100644 --- a/config/retry/retry.config +++ b/config/retry/retry.config @@ -29,7 +29,7 @@ retry { def proc_params = [:] for (i in process) { if (i.key.startsWith('withName:')) { - proc_names = i.key.split('withName:')[1].split("\\|") + def proc_names = i.key.split('withName:')[1].split("\\|") for (proc_name in proc_names) { proc_params = [:] for (j in i.value) { diff --git a/config/schema/schema.config b/config/schema/schema.config index bc7856f..bb1f23e 100644 --- a/config/schema/schema.config +++ b/config/schema/schema.config @@ -25,7 +25,7 @@ schema { load_schema = { String file_path -> def schema_file = new File(file_path) Yaml parser = new Yaml() - yaml = parser.load(schema_file.text) + def yaml = parser.load(schema_file.text) return yaml } @@ -244,7 +244,7 @@ schema { * Main validation to call, to validate the params from config file(s) against the schema. */ validate = { String file_path="${projectDir}/config/schema.yaml" -> - params_schema = schema.load_schema(file_path) + def params_schema = schema.load_schema(file_path) params_schema.each { key, val -> schema.validate_parameter(params, key, val) } @@ -257,7 +257,7 @@ schema { * keys_to_exclude: params to skip during validation */ validate_specific = { String file_path, Map params_to_validate, List keys_to_exclude=[] -> - params_schema = schema.load_schema(file_path) + def params_schema = schema.load_schema(file_path) params_schema.removeAll{ key, val -> keys_to_exclude.contains(key) } params_schema.each { key, val -> schema.validate_parameter(params_to_validate, key, val)