Github user kavinderd commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1102#discussion_r98058834
--- Diff: pxf/pxf-service/src/scripts/pxf-service ---
@@ -193,39 +210,83 @@ function doInit()
return 0
fi
- createInstance || return 1
+ createInstance || return 1
configureInstance || return 1
deployWebapp || return 1
}
+#
+# patchWebapp patches the webapp config files
+# patch applied only if PXF_HOME is defined
+#
+function patchWebapp()
+{
+ if [ -z $PXF_HOME ]; then
+ # webapp doesn't require patch
+ return 0
+ fi
+ pushd $instance_root/$instance_name/webapps || return 1
+ rm -rf pxf
+ mkdir pxf
+ cd pxf
+ unzip -q ../pxf.war
+ popd
+
+
context_file=$instance_root/$instance_name/webapps/pxf/META-INF/context.xml
+ cat $context_file | \
+ sed -e
"s:classpathFiles=\"[a-zA-Z0-9\/\;.-]*\":classpathFiles=\"$PXF_HOME\/conf\/pxf-private.classpath\":"
\
+ -e
"s:secondaryClasspathFiles=\"[a-zA-Z0-9\/\;.-]*\":secondaryClasspathFiles=\"$PXF_HOME\/conf\/pxf-public.classpath\":"
> context.xml.tmp
+ mv context.xml.tmp $context_file
+
+ web_file=$instance_root/$instance_name/webapps/pxf/WEB-INF/web.xml
+ cat $web_file | \
+ sed
"s:<param-value>.*pxf-log4j.properties<\/param-value>:<param-value>$PXF_HOME\/conf\/pxf-log4j.properties<\/param-value>:"
> web.xml.tmp
+ mv web.xml.tmp $web_file
+}
+
+function commandWebapp()
+{
+ command=$1
+ pushd $instance_root
+ su $pxf_user -c "$instance_root/$instance_name/bin/catalina.sh
$command"
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+ popd
+}
+
#
-# doStartStop handles start/stop commands
-# commands are executed as the user $pxf_user
+# doStart handles start command
+# command is executed as the user $pxf_user
#
# after start, uses checkWebapp to verify the PXF webapp was loaded
# successfully
#
-function doStartStop()
+function doStart()
{
- command=$1
-
instanceExists
if [ $? -ne 0 ]; then
echo ERROR: cant find PXF instance, maybe call init?
return 1
fi
+ patchWebapp || return 1
+ commandWebapp start || return 1
+ checkWebapp 300 || return 1
+}
- pushd $instance_root
- su $pxf_user -c "$instance_root/$instance_name/bin/catalina.sh $command"
+#
+# doStart handles stop command
+# command is executed as the user $pxf_user
+#
+#
+function doStop()
+{
+ instanceExists
if [ $? -ne 0 ]; then
+ echo ERROR: cant find PXF instance, maybe call init?
--- End diff --
quote the string just to be safe
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---