diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d7779b4b..a48fedec 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ buildConfig = "3.0.3" owasp = "7.1.0.1" jacksonDatabind = "2.14.2" picocli = "4.6.3" -snakeYaml = "1.33" +snakeYaml = "2.0" #used for authz lib integration rundeck = "4.2.0-20220509" testcontainers = "1.17.2" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index c124d053..3be722f7 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -32,6 +32,7 @@ + @@ -4493,6 +4494,14 @@ + + + + + + + + diff --git a/rd-cli-tool/build.gradle b/rd-cli-tool/build.gradle index ba144671..2ed48321 100644 --- a/rd-cli-tool/build.gradle +++ b/rd-cli-tool/build.gradle @@ -105,13 +105,8 @@ set -e RD_CONF=${RD_CONF:-$HOME/.$APP_NAME/$APP_NAME.conf} test -f $RD_CONF && . $RD_CONF export RD_EXT_DIR=${RD_EXT_DIR:-$HOME/.$APP_NAME/extv2} -''' - ) - def setJ11AddOpens=appendConfigData.curry( - '^APP_ARGS=.*$', - ''' -if $JAVACMD --add-opens 2>&1 | grep 'requires modules' >/dev/null; then - JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.lang.invoke=ALL-UNNAMED" +if [ ! -z "$(java --add-opens 2>&1 | grep 'requires modules')" ]; then + export JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.lang.invoke=ALL-UNNAMED" fi ''' ) @@ -126,7 +121,6 @@ fi .readLines() .collect(setE) .collect(setClasspath) - .collect(setJ11AddOpens) .join('\n') } diff --git a/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java b/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java index ede396d0..8011c03c 100644 --- a/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java +++ b/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java @@ -285,7 +285,7 @@ private static void configYamlFormat(final RdBuilder belt, final RdClientConfig DumperOptions.FlowStyle.FLOW ); dumperOptions.setPrettyFlow(config.getBool("RD_YAML_PRETTY", true)); - Representer representer = new Representer(); + Representer representer = new Representer(dumperOptions); representer.addClassTag(JobItem.class, Tag.MAP); representer.addClassTag(ScheduledJobItem.class, Tag.MAP); representer.addClassTag(DateInfo.class, Tag.MAP); diff --git a/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/projects/Configure.java b/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/projects/Configure.java index bdf86954..8162c572 100644 --- a/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/projects/Configure.java +++ b/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/projects/Configure.java @@ -27,6 +27,7 @@ import org.rundeck.client.tool.options.ProjectNameOptions; import org.rundeck.client.tool.options.ProjectRequiredNameOptions; import org.rundeck.client.tool.options.UnparsedConfigOptions; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; import picocli.CommandLine; @@ -157,7 +158,7 @@ public static Map loadConfig(final ConfigFileOptions opts, inputConfig.putAll(map); break; case yaml: - Yaml yaml = new Yaml(new SafeConstructor()); + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); try (FileInputStream fis = new FileInputStream(input)) { Object load = yaml.load(fis); if (load instanceof Map) {