diff --git a/src/main/groovy/com/urbancode/air/plugin/tool/AirPluginTool.groovy b/src/main/groovy/com/urbancode/air/plugin/tool/AirPluginTool.groovy new file mode 100644 index 0000000..b19c09e --- /dev/null +++ b/src/main/groovy/com/urbancode/air/plugin/tool/AirPluginTool.groovy @@ -0,0 +1,83 @@ +package com.urbancode.air.plugin.tool + +/** + * © Copyright IBM Corporation 2016, 2024. + * This is licensed under the following license. + * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) + * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. + */ + + +class AirPluginTool { + + //************************************************************************** + // CLASS + //************************************************************************** + + //************************************************************************** + // INSTANCE + //************************************************************************** + + final public def isWindows = (System.getProperty('os.name') =~ /(?i)windows/).find() + + def out = System.out; + def err = System.err; + + private def inPropsFile; + private def outPropsFile; + + def outProps; + + public AirPluginTool(def inFile, def outFile){ + inPropsFile = inFile; + outPropsFile = outFile; + outProps = new Properties(); + } + + public Properties getStepProperties() { + def props = new Properties(); + def inputPropsFile = this.inPropsFile; + def inputPropsStream = null; + try { + inputPropsStream = new FileInputStream(inputPropsFile); + props.load(inputPropsStream); + } + catch (IOException e) { + throw new RuntimeException(e); + } + finally { + inputPropsStream.close(); + } + return props; + } + + public void setOutputProperty(String name, String value) { + this.outProps.setProperty(name, value); + } + + public void setOutputProperties() { + OutputStream outputPropsStream = null; + try { + outputPropsStream = new FileOutputStream(this.outPropsFile); + outProps.store(outputPropsStream, ""); + } + finally { + if (outputPropsStream != null) { + outputPropsStream.close(); + } + } + } + + public String getAuthToken() { + String authToken = System.getenv("AUTH_TOKEN"); + return "{\"token\" : \"" + authToken + "\"}"; + } + + public String getAuthTokenUsername() { + return "PasswordIsAuthToken"; + } + + public void storeOutputProperties() { + setOutputProperties(); + } +} diff --git a/src/main/zip/apt.groovy b/src/main/zip/apt.groovy index 09d4813..4672265 100644 --- a/src/main/zip/apt.groovy +++ b/src/main/zip/apt.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/apt_key.groovy b/src/main/zip/apt_key.groovy index 58e771a..f67fcb6 100644 --- a/src/main/zip/apt_key.groovy +++ b/src/main/zip/apt_key.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/ashell.groovy b/src/main/zip/ashell.groovy index fd942d4..39f41ac 100644 --- a/src/main/zip/ashell.groovy +++ b/src/main/zip/ashell.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/command.groovy b/src/main/zip/command.groovy index 3fbb772..f268bba 100644 --- a/src/main/zip/command.groovy +++ b/src/main/zip/command.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/copy.groovy b/src/main/zip/copy.groovy index c0b1da4..788361a 100644 --- a/src/main/zip/copy.groovy +++ b/src/main/zip/copy.groovy @@ -1,11 +1,13 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/file.groovy b/src/main/zip/file.groovy index 8ae0e9b..0767466 100644 --- a/src/main/zip/file.groovy +++ b/src/main/zip/file.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/getBuiltinAnsibleProperties.groovy b/src/main/zip/getBuiltinAnsibleProperties.groovy index 0a5fae1..aee9399 100644 --- a/src/main/zip/getBuiltinAnsibleProperties.groovy +++ b/src/main/zip/getBuiltinAnsibleProperties.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/get_url.groovy b/src/main/zip/get_url.groovy index da6038e..7e981e7 100644 --- a/src/main/zip/get_url.groovy +++ b/src/main/zip/get_url.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/info.xml b/src/main/zip/info.xml index 4bf9fc8..c046812 100644 --- a/src/main/zip/info.xml +++ b/src/main/zip/info.xml @@ -137,5 +137,8 @@ The Ansible Toolkit is now built through Gradle. All Ant and Ivy build pieces have been removed. + + Added support for Groovy 3 version + diff --git a/src/main/zip/lineinfile.groovy b/src/main/zip/lineinfile.groovy index cd8cec5..4ca5a88 100644 --- a/src/main/zip/lineinfile.groovy +++ b/src/main/zip/lineinfile.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/pip.groovy b/src/main/zip/pip.groovy index 5e297da..5ac42ed 100644 --- a/src/main/zip/pip.groovy +++ b/src/main/zip/pip.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/plugin.xml b/src/main/zip/plugin.xml index bfa0fd8..bc0cf67 100644 --- a/src/main/zip/plugin.xml +++ b/src/main/zip/plugin.xml @@ -8,7 +8,7 @@
- + This plug-in includes steps that integrate with Ansible. diff --git a/src/main/zip/service.groovy b/src/main/zip/service.groovy index 0853373..a197986 100644 --- a/src/main/zip/service.groovy +++ b/src/main/zip/service.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/shell.groovy b/src/main/zip/shell.groovy index 08de43c..b788f3c 100644 --- a/src/main/zip/shell.groovy +++ b/src/main/zip/shell.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/unarchive.groovy b/src/main/zip/unarchive.groovy index ad86a2c..e9eaf38 100644 --- a/src/main/zip/unarchive.groovy +++ b/src/main/zip/unarchive.groovy @@ -1,11 +1,12 @@ +import com.urbancode.air.plugin.tool.AirPluginTool + /** - * © Copyright IBM Corporation 2016, 2017. + * © Copyright IBM Corporation 2016, 2024. * This is licensed under the following license. * The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) * U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ -import com.urbancode.air.AirPluginTool; def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file diff --git a/src/main/zip/upgrade.xml b/src/main/zip/upgrade.xml index aab40dc..44fad22 100644 --- a/src/main/zip/upgrade.xml +++ b/src/main/zip/upgrade.xml @@ -27,4 +27,6 @@ + +