diff --git a/files/heartbeat/heat-engine b/files/heartbeat/heat-engine
index 79992e17..53e1a0a5 100644
--- a/files/heartbeat/heat-engine
+++ b/files/heartbeat/heat-engine
@@ -1,952 +1,381 @@
+#!/bin/sh
+#
+#
+# OpenStack Orchestration Engine Service (heat-engine)
+#
+# Description: Manages an OpenStack Orchestration Engine Service (heat-engine) process as an HA resource
+#
+# Authors: Emilien Macchi
+#
+# Support: openstack@lists.launchpad.net
+# License: Apache Software License (ASL) 2.0
+#
+#
+# See usage() function below for more details ...
+#
+# OCF instance parameters:
+# OCF_RESKEY_binary
+# OCF_RESKEY_config
+# OCF_RESKEY_user
+# OCF_RESKEY_pid
+# OCF_RESKEY_monitor_binary
+# OCF_RESKEY_database_server_port
+# OCF_RESKEY_amqp_server_port
+# OCF_RESKEY_zeromq
+# OCF_RESKEY_additional_parameters
+#######################################################################
+# Initialization:
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+#######################################################################
-
-
-
-
-
- openstack-resource-agents/ocf/heat-engine at master · madkiss/openstack-resource-agents · GitHub
-
-
-
-
-
-
-
-
-
-
-
-
-
+# Fill in some defaults if no values are specified
+
+OCF_RESKEY_binary_default="heat-engine"
+OCF_RESKEY_config_default="/etc/heat/heat.conf"
+OCF_RESKEY_user_default="heat"
+OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
+OCF_RESKEY_database_server_port_default="3306"
+OCF_RESKEY_amqp_server_port_default="5672"
+OCF_RESKEY_zeromq_default="false"
+
+: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
+: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
+: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
+: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
+: ${OCF_RESKEY_database_server_port=${OCF_RESKEY_database_server_port_default}}
+: ${OCF_RESKEY_amqp_server_port=${OCF_RESKEY_amqp_server_port_default}}
+: ${OCF_RESKEY_zeromq=${OCF_RESKEY_zeromq_default}}
+
+#######################################################################
+
+usage() {
+ cat <
+
+
+1.0
+
+
+Resource agent for the OpenStack Orchestration Engine Service (heat-engine)
+May manage a heat-engine instance or a clone set that
+creates a distributed heat-engine cluster.
+
+Manages the OpenStack Orchestration Engine Service (heat-engine)
+
+
+
+
+Location of the OpenStack Orchestration Engine server binary (heat-engine)
+
+OpenStack Orchestration Engine server binary (heat-engine)
+
+
+
+
+
+Location of the OpenStack Orchestration Engine Service (heat-engine) configuration file
+
+OpenStack Orchestration Engine (heat-engine) config file
+
+
+
+
+
+User running OpenStack Orchestration Engine Service (heat-engine)
+
+OpenStack Orchestration Engine Service (heat-engine) user
+
+
+
+
+
+The pid file to use for this OpenStack Orchestration Engine Service (heat-engine) instance
+
+OpenStack Orchestration Engine Service (heat-engine) pid file
+
+
+
+
+
+The listening port number of the database server. Use for monitoring purposes
+
+Database listening port
+
+
+
+
+
+The listening port number of the AMQP server. Use for monitoring purposes
+
+AMQP listening port
+
+
+
+
+
+If zeromq is used, this will disable the connection test to the AMQP server. Use for monitoring purposes
+
+Zero-MQ usage
+
+
+
+
+
+Additional parameters to pass on to the OpenStack Orchestration Engine Service (heat-engine)
+
+Additional parameters for heat-engine
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+END
+}
+
+#######################################################################
+# Functions invoked by resource manager actions
+
+heat_engine_check_port() {
+# This function has been taken from the squid RA and improved a bit
+# The length of the integer must be 4
+# Examples of valid port: "1080", "0080"
+# Examples of invalid port: "1080bad", "0", "0000", ""
+
+ local int
+ local cnt
+ int="$1"
+ cnt=${#int}
+ echo $int |egrep -qx '[0-9]+(:[0-9]+)?(,[0-9]+(:[0-9]+)?)*'
+ if [ $? -ne 0 ] || [ $cnt -ne 4 ]; then
+ ocf_log err "Invalid port number: $1"
+ exit $OCF_ERR_CONFIGURED
+ fi
+}
-
-
-
-
+heat_engine_validate() {
+ local rc
+
+ check_binary $OCF_RESKEY_binary
+ check_binary netstat
+ heat_engine_check_port $OCF_RESKEY_database_server_port
+ heat_engine_check_port $OCF_RESKEY_amqp_server_port
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
ocf_log err "Heat Engine is not connected to the AMQP server and/or the database server: AMQP connection test returned $rc_amqp and database connection test returned $rc_db"