Improve arg handling in ant script
This commit is a spinn-off from #12710 which improves the handling of process arguments ot play nice with spaces etc.
This commit is contained in:
parent
9c6ed8c238
commit
a8580d11f5
|
@ -12,7 +12,6 @@
|
||||||
<!-- runs an OS script -->
|
<!-- runs an OS script -->
|
||||||
<macrodef name="run-script">
|
<macrodef name="run-script">
|
||||||
<attribute name="script"/>
|
<attribute name="script"/>
|
||||||
<attribute name="args"/>
|
|
||||||
<attribute name="spawn" default="false"/>
|
<attribute name="spawn" default="false"/>
|
||||||
<element name="nested" optional="true"/>
|
<element name="nested" optional="true"/>
|
||||||
<sequential>
|
<sequential>
|
||||||
|
@ -22,23 +21,23 @@
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<!-- create a temp CWD, to enforce that commands don't rely on CWD -->
|
<!-- create a temp CWD, to enforce that commands don't rely on CWD -->
|
||||||
<mkdir dir="${integ.temp}"/>
|
<local name="temp.cwd"/>
|
||||||
|
<tempfile property="temp.cwd" destDir="${integ.temp}"/>
|
||||||
|
<mkdir dir="${temp.cwd}"/>
|
||||||
|
|
||||||
<!-- print commands we run -->
|
<!-- print commands we run -->
|
||||||
<local name="script.base"/>
|
<local name="script.base"/>
|
||||||
<basename file="@{script}" property="script.base"/>
|
<basename file="@{script}" property="script.base"/>
|
||||||
<echo>execute: ${script.base} @{args}</echo>
|
<!-- crappy way to output, but we need it. make it nice later -->
|
||||||
|
<echoxml><exec script="${script.base}"><nested/></exec></echoxml>
|
||||||
<exec executable="cmd" osfamily="winnt" dir="${integ.temp}" failonerror="${failonerror}" spawn="@{spawn}" taskname="${script.base}">
|
<exec executable="cmd" osfamily="winnt" dir="${temp.cwd}" failonerror="${failonerror}" spawn="@{spawn}" taskname="${script.base}">
|
||||||
<arg value="/c"/>
|
<arg value="/c"/>
|
||||||
<arg value="@{script}.bat"/>
|
<arg value="@{script}.bat"/>
|
||||||
<arg line="@{args}"/>
|
|
||||||
<nested/>
|
<nested/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec executable="sh" osfamily="unix" dir="${integ.temp}" failonerror="${failonerror}" spawn="@{spawn}" taskname="${script.base}">
|
<exec executable="sh" osfamily="unix" dir="${temp.cwd}" failonerror="${failonerror}" spawn="@{spawn}" taskname="${script.base}">
|
||||||
<arg value="@{script}"/>
|
<arg value="@{script}"/>
|
||||||
<arg line="@{args}"/>
|
|
||||||
<nested/>
|
<nested/>
|
||||||
</exec>
|
</exec>
|
||||||
</sequential>
|
</sequential>
|
||||||
|
@ -85,7 +84,14 @@
|
||||||
|
|
||||||
<!-- install plugin -->
|
<!-- install plugin -->
|
||||||
<echo>Installing plugin @{name}...</echo>
|
<echo>Installing plugin @{name}...</echo>
|
||||||
<run-script script="@{home}/bin/plugin" args="install @{name} -u ${url}"/>
|
<run-script script="@{home}/bin/plugin">
|
||||||
|
<nested>
|
||||||
|
<arg value="install"/>
|
||||||
|
<arg value="@{name}"/>
|
||||||
|
<arg value="-u"/>
|
||||||
|
<arg value="${url}"/>
|
||||||
|
</nested>
|
||||||
|
</run-script>
|
||||||
|
|
||||||
<!-- check that plugin was installed into correct place -->
|
<!-- check that plugin was installed into correct place -->
|
||||||
<local name="longname"/>
|
<local name="longname"/>
|
||||||
|
@ -148,39 +154,28 @@
|
||||||
<attribute name="es.http.port" default="${integ.http.port}"/>
|
<attribute name="es.http.port" default="${integ.http.port}"/>
|
||||||
<attribute name="es.transport.tcp.port" default="${integ.transport.port}"/>
|
<attribute name="es.transport.tcp.port" default="${integ.transport.port}"/>
|
||||||
<attribute name="es.pidfile" default="${integ.pidfile}"/>
|
<attribute name="es.pidfile" default="${integ.pidfile}"/>
|
||||||
<attribute name="additional.args" default=""/>
|
|
||||||
<attribute name="jvm.args" default="${tests.jvm.argline}"/>
|
<attribute name="jvm.args" default="${tests.jvm.argline}"/>
|
||||||
<sequential>
|
<sequential>
|
||||||
|
|
||||||
<!-- build args to pass to es -->
|
|
||||||
<local name="integ.args"/>
|
|
||||||
<property name="integ.args" value="
|
|
||||||
-Des.cluster.name=@{es.cluster.name}
|
|
||||||
-Des.http.port=@{es.http.port}
|
|
||||||
-Des.transport.tcp.port=@{es.transport.tcp.port}
|
|
||||||
-Des.pidfile=@{es.pidfile}
|
|
||||||
-Des.path.repo=@{home}/repo
|
|
||||||
-Des.discovery.zen.ping.multicast.enabled=false
|
|
||||||
-Des.discovery.zen.ping.unicast.enabled=@{es.unicast.enabled}
|
|
||||||
-Des.discovery.zen.ping.unicast.hosts=@{es.unicast.hosts}
|
|
||||||
-Des.script.inline=on
|
|
||||||
-Des.script.indexed=on
|
|
||||||
-Des.repositories.url.allowed_urls=http://snapshot.test*
|
|
||||||
@{additional.args}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- run bin/elasticsearch with args -->
|
<!-- run bin/elasticsearch with args -->
|
||||||
<echo>Starting up external cluster...</echo>
|
<echo>Starting up external cluster...</echo>
|
||||||
<echo>JAVA=${java.home}</echo>
|
|
||||||
<echo>ARGS=@{jvm.args}</echo>
|
|
||||||
|
|
||||||
<run-script script="@{home}/bin/elasticsearch"
|
<run-script script="@{home}/bin/elasticsearch"
|
||||||
spawn="@{spawn}"
|
spawn="@{spawn}">
|
||||||
args="${integ.args}">
|
|
||||||
<nested>
|
<nested>
|
||||||
<env key="JAVA_HOME" value="${java.home}"/>
|
<env key="JAVA_HOME" value="${java.home}"/>
|
||||||
<!-- we pass these as gc options, even if they arent, to avoid conflicting gc options -->
|
<!-- we pass these as gc options, even if they arent, to avoid conflicting gc options -->
|
||||||
<env key="ES_GC_OPTS" value="@{jvm.args}"/>
|
<env key="ES_GC_OPTS" value="@{jvm.args}"/>
|
||||||
|
<arg value="-Des.cluster.name=@{es.cluster.name}"/>
|
||||||
|
<arg value="-Des.http.port=@{es.http.port}"/>
|
||||||
|
<arg value="-Des.transport.tcp.port=@{es.transport.tcp.port}"/>
|
||||||
|
<arg value="-Des.pidfile=@{es.pidfile}"/>
|
||||||
|
<arg value="-Des.discovery.zen.ping.unicast.enabled=@{es.unicast.enabled}"/>
|
||||||
|
<arg value="-Des.discovery.zen.ping.unicast.hosts=@{es.unicast.hosts}"/>
|
||||||
|
<arg value="-Des.path.repo=@{home}/repo"/>
|
||||||
|
<arg value="-Des.discovery.zen.ping.multicast.enabled=false"/>
|
||||||
|
<arg value="-Des.script.inline=on"/>
|
||||||
|
<arg value="-Des.script.indexed=on"/>
|
||||||
|
<arg value="-Des.repositories.url.allowed_urls=http://snapshot.test*"/>
|
||||||
</nested>
|
</nested>
|
||||||
</run-script>
|
</run-script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue