Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2014 19:02:54 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r363753 - in head/databases/leofs: . files
Message-ID:  <201408011902.s71J2sid053830@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Fri Aug  1 19:02:54 2014
New Revision: 363753
URL: http://svnweb.freebsd.org/changeset/ports/363753
QAT: https://qat.redports.org/buildarchive/r363753/

Log:
  - make cowboy correctly parse target URI that has method in uppercase;
  - sbin/leofs script improvements: on start wait for a node to begin
    responding to ping, white-space cleanup;
  - rc script cleanup.

Added:
  head/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl   (contents, props changed)
Modified:
  head/databases/leofs/Makefile
  head/databases/leofs/files/leofs.in
  head/databases/leofs/files/sbin-leofs.in

Modified: head/databases/leofs/Makefile
==============================================================================
--- head/databases/leofs/Makefile	Fri Aug  1 18:53:34 2014	(r363752)
+++ head/databases/leofs/Makefile	Fri Aug  1 19:02:54 2014	(r363753)
@@ -3,7 +3,7 @@
 
 PORTNAME=	leofs
 PORTVERSION=	1.0.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases
 
 MAINTAINER=	trociny@FreeBSD.org

Modified: head/databases/leofs/files/leofs.in
==============================================================================
--- head/databases/leofs/files/leofs.in	Fri Aug  1 18:53:34 2014	(r363752)
+++ head/databases/leofs/files/leofs.in	Fri Aug  1 19:02:54 2014	(r363753)
@@ -13,7 +13,7 @@
 # leofs_servers (list):	Specify servers to run as a space separated
 # 			list of possible values:
 # 				gateway,
-# 				manager_master,
+# 				manager,
 # 				manager_slave,
 #				storage.
 #			The aliase ALL may be used to run all servers.
@@ -53,7 +53,7 @@ leofs_start()
     local s
 
     for s in ${leofs_servers}; do
-	echo -n "Starting ${s}... "
+	echo -n "Starting leofs ${s}... "
 	%%PREFIX%%/sbin/leofs ${s} start
 	if [ $? = 0 ]; then
 	    echo "done."
@@ -70,7 +70,7 @@ leofs_stop()
     local status=0
 
     for s in ${leofs_servers}; do
-	echo -n "Stopping ${s}... "
+	echo -n "Stopping leofs ${s}... "
 	%%PREFIX%%/sbin/leofs ${s} stop
 	if [ $? = 0 ]; then
 	    echo "done."
@@ -89,10 +89,10 @@ leofs_status()
     for s in ${leofs_servers}; do
 	%%PREFIX%%/sbin/leofs ${s} ping > /dev/null 2>&1
 	if [ $? != 0 ]; then
-	    echo "${s} is not running."
+	    echo "leofs ${s} is not running."
 	    status=1
 	else
-	    echo "${s} is running."
+	    echo "leofs ${s} is running."
 	fi
     done
 
@@ -114,7 +114,7 @@ for s in ${leofs_servers}; do
 	gateway|manager|manager_slave|storage)
 	    ;;
 	*)
-	    warn "unknown leo server: ${s}"
+	    warn "unknown leofs server: ${s}"
 	    exit 1
 	    ;;
     esac

Added: head/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/leofs/files/patch-deps-cowboy-src-cowboy_protocol.erl	Fri Aug  1 19:02:54 2014	(r363753)
@@ -0,0 +1,17 @@
+Make cowboy correctly parse target URI that has method in uppercase.
+
+--- deps/cowboy/src/cowboy_protocol.erl.orig	2013-06-20 19:44:36.000000000 +0300
++++ deps/cowboy/src/cowboy_protocol.erl	2014-07-31 23:10:11.000000000 +0300
+@@ -214,8 +214,12 @@
+ 	parse_version(Rest, State, Method, <<"*">>, <<>>);
+ parse_uri(<< "http://", Rest/bits >>, State, Method) ->
+ 	parse_uri_skip_host(Rest, State, Method);
++parse_uri(<< "HTTP://", Rest/bits >>, State, Method) ->
++	parse_uri_skip_host(Rest, State, Method);
+ parse_uri(<< "https://", Rest/bits >>, State, Method) ->
+ 	parse_uri_skip_host(Rest, State, Method);
++parse_uri(<< "HTTPS://", Rest/bits >>, State, Method) ->
++	parse_uri_skip_host(Rest, State, Method);
+ parse_uri(Buffer, State, Method) ->
+ 	parse_uri_path(Buffer, State, Method, <<>>).
+ 

Modified: head/databases/leofs/files/sbin-leofs.in
==============================================================================
--- head/databases/leofs/files/sbin-leofs.in	Fri Aug  1 18:53:34 2014	(r363752)
+++ head/databases/leofs/files/sbin-leofs.in	Fri Aug  1 19:02:54 2014	(r363753)
@@ -153,13 +153,13 @@ setusercontext()
 
     if [ ${user} = ${LEOFS_USER} ]
     then
-	return
+        return
     fi
 
     if [ ${user} != root ]
     then
-	echo "Must be run as ${LEOFS_USER} user or root (or set LEOFS_USER)" >&2
-	exit 1
+        echo "Must be run as ${LEOFS_USER} user or root (or set LEOFS_USER)" >&2
+        exit 1
     fi
 
     # Restart as LEOFS_USER
@@ -187,17 +187,17 @@ gen_config()
 
     args=`PATH=${ERTS_PATH}:${PATH} \
         ${LEOFS_BASEDIR}/bin/cuttlefish \
-	-i ${LEOFS_BASEDIR}/etc/${LEOFS_SERVER}.schema \
-	-c ${LEOFS_ETCDIR}/${LEOFS_SERVER}.conf \
-	-d ${cfg_dir}`
+        -i ${LEOFS_BASEDIR}/etc/${LEOFS_SERVER}.schema \
+        -c ${LEOFS_ETCDIR}/${LEOFS_SERVER}.conf \
+        -d ${cfg_dir}`
 
     app_config=`echo ${args} | sed -nEe 's/^.*(app\.[0-9.]*\.config).*$/\1/p'`
     vm_args=`echo ${args} | sed -nEe 's/^.*(vm\.[0-9.]*\.args).*$/\1/p'`
 
     if [ -z "${app_config}" -o  -z "${vm_args}" ]
     then
-	echo "Failed to parse ${LEOFS_SERVER}.conf" >&2
-	exit 1
+        echo "Failed to parse ${LEOFS_SERVER}.conf" >&2
+        exit 1
     fi
 
     # Sanity check the app.config file
@@ -248,10 +248,10 @@ make_env()
     snmp_cfg=`sed -nEe 's/^-config *(.*)$/\1.config/p' ${LEOFS_DBDIR}/etc/vm.args`
 
     sed -nEe 's:^.*dir, *"((%%LEOFS_DBDIR%%|%%LEOFS_LOGDIR%%)[^"]*)".*$:\1:p' \
-	${LEOFS_DBDIR}/etc/app.config ${snmp_cfg} | sort -u |
+        ${LEOFS_DBDIR}/etc/app.config ${snmp_cfg} | sort -u |
     while read dir
     do
-	mkdir -p "${dir}"
+        mkdir -p "${dir}"
     done
 }
 
@@ -268,15 +268,15 @@ nodetool()
     name_arg=`egrep '^-s?name' ${vmargs_path}`
     if [ -z "${name_arg}" ]
     then
-	echo "vm.args needs either -name or -sname parameter" >&2 
-	exit 1
+        echo "vm.args needs either -name or -sname parameter" >&2 
+        exit 1
     fi
 
     cookie_arg=`grep '^-setcookie' ${vmargs_path}`
     if [ -z "${cookie_arg}" ]
     then
-	echo "vm.args needs a -setcookie parameter" 2>&2
-	exit 1
+        echo "vm.args needs a -setcookie parameter" 2>&2
+        exit 1
     fi
 
     ${ERTS_PATH}/escript ${ERTS_PATH}/nodetool ${name_arg} ${cookie_arg} ${cmd}
@@ -293,17 +293,17 @@ check_node()
      
     if [ "${expected_state}" = DOWN ]
     then
-	if [ ${status} -eq 0 ]
-	then
-	    echo "Node is already running" >&2
-	    exit 1
-	fi
+        if [ ${status} -eq 0 ]
+        then
+            echo "Node is already running" >&2
+            exit 1
+        fi
     else
-	if [ ${status} -ne 0 ]
-	then
-	    echo "Node is not running" >&2
-	    exit 1
-	fi
+        if [ ${status} -ne 0 ]
+        then
+            echo "Node is not running" >&2
+            exit 1
+        fi
     fi
 }
 
@@ -318,15 +318,15 @@ remsh()
     name_arg=`egrep '^-s?name' ${vmargs_path}`
     if [ -z "${name_arg}" ]
     then
-	echo "vm.args needs either -name or -sname parameter" >&2 
-	exit 1
+        echo "vm.args needs either -name or -sname parameter" >&2 
+        exit 1
     fi
 
     cookie_arg=`grep '^-setcookie' ${vmargs_path}`
     if [ -z "${cookie_arg}" ]
     then
-	echo "vm.args needs a -setcookie parameter" 2>&2
-	exit 1
+        echo "vm.args needs a -setcookie parameter" 2>&2
+        exit 1
     fi
 
     # Extract the name type and name from the name_arg for remsh
@@ -558,6 +558,8 @@ register_cmd restart
 #-------------------------------------------------------------------------------
 cmd_start()
 {
+    local i res
+
     case "$1" in
         help_summary)
             echo "Launch the application"
@@ -577,7 +579,21 @@ cmd_start()
     export HEART_COMMAND="${PROGPATH} ${LEOFS_SERVER} start"
 
     ${ERTS_PATH}/run_erl -daemon ${LEOFS_PIPE} ${LEOFS_LOGDIR} \
-	"exec ${PROGPATH} ${LEOFS_SERVER} console $@" 2>&1
+        "exec ${PROGPATH} ${LEOFS_SERVER} console $@" 2>&1
+    res=$?
+
+    if [ "${res}" -ne 0 ]
+    then
+        exit ${res}
+    fi
+
+    # Wait up to 1 minute for the node to start responding on ping.
+    for i in `jot 60`
+    do
+        nodetool ping >/dev/null 2>&1 || exit 0
+        sleep 1
+    done
+    exit 1
 }
 
 register_cmd start
@@ -610,19 +626,19 @@ cmd_stop()
 
     if [ "${res}" -ne 0 ]
     then
-	if [ -z "${pid}" ]
-	then
-	    echo "${LEOFS_SERVER} is not running"
-	else
-	    echo "Failed to stop ${LEOFS_SERVER}"
-	fi
+        if [ -z "${pid}" ]
+        then
+            echo "${LEOFS_SERVER} is not running"
+        else
+            echo "Failed to stop ${LEOFS_SERVER}"
+        fi
         exit ${res}
     fi
 
     # Wait up to 1 minute for the process to terminate.
     for i in `jot 60`
     do
-	kill -0 ${pid} 2>/dev/null || exit 0
+        kill -0 ${pid} 2>/dev/null || exit 0
         sleep 1
     done
     echo "Failed to terminate the ${LEOFS_SERVER} process (pid ${pid})"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408011902.s71J2sid053830>