Change in osmo-sgsn[master]: manuals: Regenerate counters/VTY through docker

laforge gerrit-no-reply at lists.osmocom.org
Fri Mar 12 07:27:25 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/23305 )

Change subject: manuals: Regenerate counters/VTY through docker
......................................................................

manuals: Regenerate counters/VTY through docker

Change-Id: I09b01d2e4bc7b1c17588100b16ac9f04cf72cf99
---
M doc/manuals/regen_doc.sh
1 file changed, 11 insertions(+), 65 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/doc/manuals/regen_doc.sh b/doc/manuals/regen_doc.sh
index 9fcebb8..5c84a23 100755
--- a/doc/manuals/regen_doc.sh
+++ b/doc/manuals/regen_doc.sh
@@ -1,71 +1,17 @@
-#!/bin/sh -e
+#!/bin/sh -x
 
-require_osmo_interact_vty() {
-	if command -v osmo_interact_vty.py >/dev/null 2>&1; then
-		return
-	fi
-	echo "ERROR: osmo_interact_vty.py not found. Are osmo-python-tests in PATH?"
+if [ -z "$DOCKER_PLAYGROUND" ]; then
+	echo "You need to set DOCKER_PLAYGROUND"
 	exit 1
-}
+fi
 
-# $1: "update_vty_reference" or "update_counters"
-# $2: output file
-# $3: port
-# $4-$n: command
-interact_vty() {
-	action="$1"
-	output="$2"
-	port="$3"
-	log="/tmp/$4.log"
-	shift 3
+SCRIPT=$(realpath "$0")
+MANUAL_DIR=$(dirname "$SCRIPT")
 
-	echo "Starting in background: $@"
-	"$@" > "$log" 2>&1 &
-	pid="$!"
+COMMIT=${COMMIT:-$(git log -1 --format=format:%H)}
 
-	sleep 0.5
-	if ! kill -0 "$pid" 2>/dev/null; then
-		echo "ERROR: start failed!"
-		cat "$log"
-		exit 1
-	fi
+cd "$DOCKER_PLAYGROUND/scripts" || exit 1
 
-	case "$action" in
-		"update_vty_reference")
-			echo "Updating VTY reference: $output"
-			osmo_interact_vty.py -X -p "$port" -H 127.0.0.1 -O "$output"
-			;;
-		"update_counters")
-			echo "Updating asciidoc counters: $output"
-			osmo_interact_vty.py -c "enable;show asciidoc counters" -p "$port" -H 127.0.0.1 -O "$output"
-			;;
-		*)
-			echo "ERROR: invalid argument: $action"
-			exit 1
-			;;
-	esac
-
-	kill "$pid"
-	echo "Done (killed $1)"
-	echo
-}
-
-DIR="$(cd "$(dirname "$0")"; pwd)"
-cd "$DIR"
-
-require_osmo_interact_vty
-
-interact_vty \
-	"update_vty_reference" \
-	"vty/sgsn_vty_reference.xml" \
-	4245 \
-	osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg"
-
-interact_vty \
-	"update_counters" \
-	"chapters/counters_generated.adoc" \
-	4245 \
-	osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg"
-
-
-echo "Done with all"
+OSMO_BSC_BRANCH=$COMMIT ./regen_doc.sh osmo-sgsn 4245 \
+	"$MANUAL_DIR/chapters/counters_generated.adoc" \
+	"$MANUAL_DIR/vty/sgsn_vty_reference.xml"

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/23305
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I09b01d2e4bc7b1c17588100b16ac9f04cf72cf99
Gerrit-Change-Number: 23305
Gerrit-PatchSet: 2
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210312/c0e1e8ee/attachment.htm>


More information about the gerrit-log mailing list