aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/acme/acme-products.json (renamed from bin/acme_sample/acme-products.json_sample)7
-rwxr-xr-xbin/acme/acme-users.json (renamed from bin/acme_sample/acme-users.json_sample)2
-rwxr-xr-xbin/acme/datasource.json_sample (renamed from bin/acme_sample/datasource.json_sample)4
-rwxr-xr-xbin/acme/srtool_acme.py (renamed from bin/acme_sample/srtool_acme.py_sample)0
-rwxr-xr-xbin/acme/srtool_defect.py (renamed from bin/acme_sample/srtool_defect.py_sample)0
-rwxr-xr-xbin/acme/srtool_env.sh4
-rwxr-xr-xbin/acme/srtool_jira.py (renamed from bin/acme_sample/srtool_jira.py_sample)12
-rwxr-xr-xbin/common/srtool_env.sh3
-rwxr-xr-xbin/dev_tools/master_app.sh37
-rwxr-xr-xbin/srt41
-rwxr-xr-x[-rw-r--r--]bin/yp/datasource.json0
-rwxr-xr-xbin/yp/srtool_env.sh3
12 files changed, 90 insertions, 23 deletions
diff --git a/bin/acme_sample/acme-products.json_sample b/bin/acme/acme-products.json
index 78b83665..0d90be7d 100755
--- a/bin/acme_sample/acme-products.json_sample
+++ b/bin/acme/acme-products.json
@@ -2,10 +2,10 @@
"_comment_" : [
{
"_comment_" : "NOTE: _comment_ items are ignored",
- "anything" : "so you can put any internal documentation here",
+ "anything" : "so you can put any internal documentation here"
}
],
- "Product_Items" : [
+ "Product_Items" : [
{
"_comment_" : "NOTE: _comment_ elements are ignored",
"order" : "1",
@@ -16,7 +16,7 @@
"cpe" : "cpe:2.5:o:looneytunes:linux:2.5:*:*:*:*:*:*:*",
"defect_tags" : "{\"key\":\"looney\"}",
"product_tags" : "{\"key\":\"looney\"}"
- },
+ },
{
"order" : "2",
"key" : "mm",
@@ -26,5 +26,6 @@
"cpe" : "cpe:2.5:o:merriemelodies:linux:2.5:*:*:*:*:*:*:*",
"defect_tags" : "{\"key\":\"merrie\"}",
"product_tags" : "{\"key\":\"merrie\"}"
+ }
]
}
diff --git a/bin/acme_sample/acme-users.json_sample b/bin/acme/acme-users.json
index 897072fa..0be340e7 100755
--- a/bin/acme_sample/acme-users.json_sample
+++ b/bin/acme/acme-users.json
@@ -1,5 +1,5 @@
{
- "User_Items" : [
+ "User_Items" : [
{
"name" : "rrunner",
"first_name" : "Road",
diff --git a/bin/acme_sample/datasource.json_sample b/bin/acme/datasource.json_sample
index 4216ccd7..786d1105 100755
--- a/bin/acme_sample/datasource.json_sample
+++ b/bin/acme/datasource.json_sample
@@ -1,7 +1,7 @@
{
"srtsetting" : [
{
- "_comment_" : "NOTE: this is how you replace the default "yp" organization with ACME",
+ "_comment_" : "NOTE: this is how you replace the default 'yp' organization with ACME",
"name" : "datasource_org",
"helptext" : "Bin directory for ACME Corp.",
"value" : "acme"
@@ -17,7 +17,7 @@
"_comment_" : "NOTE: this is how you can insert your organization's logo in the top bar",
"name" : "SRTOOL_LOCAL_LOGO",
"helptext" : "The ACME Corp added logo",
- "value" : "ACME,/static/img/acme/acme_logo.png,https://www.acme.com/"
+ "value" : "ACME,/static/img/acme/acme_logo.png,/acme"
},
{
diff --git a/bin/acme_sample/srtool_acme.py_sample b/bin/acme/srtool_acme.py
index 02750ba5..02750ba5 100755
--- a/bin/acme_sample/srtool_acme.py_sample
+++ b/bin/acme/srtool_acme.py
diff --git a/bin/acme_sample/srtool_defect.py_sample b/bin/acme/srtool_defect.py
index 6178dcaf..6178dcaf 100755
--- a/bin/acme_sample/srtool_defect.py_sample
+++ b/bin/acme/srtool_defect.py
diff --git a/bin/acme/srtool_env.sh b/bin/acme/srtool_env.sh
new file mode 100755
index 00000000..4eac83b0
--- /dev/null
+++ b/bin/acme/srtool_env.sh
@@ -0,0 +1,4 @@
+# Main application shell settings
+
+export SRT_MAIN_APP="acme"
+
diff --git a/bin/acme_sample/srtool_jira.py_sample b/bin/acme/srtool_jira.py
index 04c772b5..4fd9d7bb 100755
--- a/bin/acme_sample/srtool_jira.py_sample
+++ b/bin/acme/srtool_jira.py
@@ -25,10 +25,10 @@
###
-### THIS IS A SAMPLE JIRA INTEGRATION SCRIPT FOR
+### THIS IS A SAMPLE JIRA INTEGRATION SCRIPT FOR
### MANAGING AN ORGANIZATION'S SRTOOL INTEGRATION
###
-### INSTALLATION INSTRUCTIONS AND DOCUMENATION OF THE JIRA PYTHON
+### INSTALLATION INSTRUCTIONS AND DOCUMENATION OF THE JIRA PYTHON
### LIBRARIES CAN BE FOUND HERE:
### https://jira.readthedocs.io
###
@@ -81,15 +81,15 @@ JIRA_TESTSERVER_LINK = 'https://jira.acmetest.com'
### These are example links that you can use to define and populate the respective fields for the SRTool
### These are not defined in the standard Jira schema, and would presumably be custom added
### You can extend and cusomize the Jira integration to SRTool by added additional custom fields using this model
-### The two indicated fields below are part of the SRTool design. They can be present as empty strings if they
+### The two indicated fields below are part of the SRTool design. They can be present as empty strings if they
### do not exist in your schema:
### The 'PUBLISHED' field is used to indicate if and when a Jira defect has been published to the customers
### The 'FIX_VERSION' field is used to indicate which version/release/update/service pack of the product has the fix
###
# Custom Jira fields
-JIRA_PUBLISHED_FIELD = 'customfield_10010' ### REPLACE WITH YOUR CUSTOM FIELD VALUE
-JIRA_FIX_VERSION_FIELD = 'customfield_10011' ### REPLACE WITH YOUR CUSTOM FIELD VALUE
+JIRA_PUBLISHED_FIELD = 'customfield_10010' ### REPLACE WITH YOUR CUSTOM FIELD VALUE
+JIRA_FIX_VERSION_FIELD = 'customfield_10011' ### REPLACE WITH YOUR CUSTOM FIELD VALUE
# ...
#################################
@@ -329,7 +329,7 @@ def translate_resolution(j,r):
return 0,0,0,0
#
-# Update the defect status from the Jira database
+# Update the defect status from the Jira database
#
#handles updating a list of issues for a single product/project
diff --git a/bin/common/srtool_env.sh b/bin/common/srtool_env.sh
new file mode 100755
index 00000000..31ecb6a9
--- /dev/null
+++ b/bin/common/srtool_env.sh
@@ -0,0 +1,3 @@
+# Common shell settings
+
+# none at this time
diff --git a/bin/dev_tools/master_app.sh b/bin/dev_tools/master_app.sh
new file mode 100755
index 00000000..4681e7fc
--- /dev/null
+++ b/bin/dev_tools/master_app.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#
+# Set the master app by:
+# (a) renaming the other master(s) datasource files
+# (b) enabling the master datasource file
+#
+
+master_app=$1
+if [ -z "$master_app" ] ; then
+ master_app="yp"
+fi
+if [ ! -d "./bin/$master_app" ] ; then
+ echo "ERROR: master app directory missing"
+ exit 1
+fi
+
+FS=$'\n' # make newlines the only separator
+for p in $(find bin -name srtool_env.sh -exec grep -l "SRT_MAIN_APP" {} \;) ; do
+ if [ "${p}" != "${p/bin\/yp/}" ] ; then
+ # Always leave the 'yp' directory alone
+ continue
+ fi
+ echo "Check:$p"
+ ds_dir=$(dirname $p)
+ if [ "${p}" != "${p/bin\/$master_app/}" ] ; then
+ echo "SET_MASTER:$p"
+ mv $ds_dir/datasource.json_sample $ds_dir/datasource.json 2> /dev/null
+ else
+ echo "DISABLE_MASTER:$p"
+ mv $ds_dir/datasource.json $ds_dir/datasource.json_sample 2> /dev/null
+ fi
+done
+
+if [ "yp" = "$master_app" ] ; then
+ echo "SET_MASTER:./bin/$master_app"
+fi
diff --git a/bin/srt b/bin/srt
index 06940ee8..7af2491f 100755
--- a/bin/srt
+++ b/bin/srt
@@ -45,17 +45,34 @@ databaseCheck()
return $retval
}
+get_srt_env_settings() {
+ mainapp="yp"
+ # Apply all shell settings except default app 'yp'
+ # Only look in directories with proper 'datasource.json' files
+ for envscript in $(find ./bin -name "datasource.json") ; do
+ envscript=${envscript/datasource.json/srtool_env.sh}
+ if [ -f "$envscript" -a "$envscript" = "${envscript/bin\/yp/}" ] ; then
+ . $envscript
+ fi
+ done
+ # if no main app, default to 'yp'
+ if [ -z "$SRT_MAIN_APP" ] ; then
+ . ./bin/yp/srtool_env.sh
+ fi
+ echo "SRT_MAIN_APP=$SRT_MAIN_APP"
+}
+
webserverKillAll()
{
local pidfile
for pidfile in ${SRT_BASE_DIR}/.srtmain.pid ; do
if [ -f ${pidfile} ] ; then
pid=`cat ${pidfile}`
- while kill -0 $pid 2>/dev/null; do
- echo "KILL:$pid"
- kill -SIGTERM -9 $pid 2>/dev/null
- sleep 1
- done
+ while kill -0 $pid 2>/dev/null; do
+ echo "KILL:$pid"
+ kill -SIGTERM -9 $pid 2>/dev/null
+ sleep 1
+ done
rm ${pidfile}
fi
done
@@ -157,6 +174,9 @@ SRT_BASE_DIR=$(readlink -f $SRT_BASE_DIR)
SRT_BASE_DIR=$(dirname $SRT_BASE_DIR)
MANAGE="python3 $SRT_BASE_DIR/lib/manage.py"
+# Fetch the datasource environent settings
+get_srt_env_settings
+
# insure basic directories are present
mkdir -p $SRT_BASE_DIR/data
mkdir -p $SRT_BASE_DIR/data/cache
@@ -193,7 +213,7 @@ for param in $*; do
;;
*)
if [ "manage" == "$CMD" ] ; then
- cd $SRT_BASE_DIR/lib
+ cd $SRT_BASE_DIR/lib
manage_cmd="$manage_cmd $param"
else
echo "$HELP"
@@ -206,7 +226,6 @@ done
verify_prereq || exit 1
-
# this defines the dir SRTool will use for
# 1) the sqlite db if that is being used.
# 2) pid's we need to clean up on exit/shutdown
@@ -214,9 +233,9 @@ verify_prereq || exit 1
# Determine the action. If specified by arguments, fine, if not, toggle it
if [ "$CMD" = "start" ] ; then
if [ -n "$BBSERVER" ]; then
- echo " SRT is already running. Exiting..."
- exit 1
-fi
+ echo " SRT is already running. Exiting..."
+ exit 1
+ fi
elif [ "$CMD" = "" ]; then
echo "No command specified"
echo "$HELP"
@@ -230,7 +249,7 @@ case $CMD in
start )
# check if addr:port is not in use
if [ "$CMD" == 'start' ] ; then
- $MANAGE checksocket "$ADDR_PORT" || exit 1
+ $MANAGE checksocket "$ADDR_PORT" || exit 1
fi
if ! webserverStartAll; then
diff --git a/bin/yp/datasource.json b/bin/yp/datasource.json
index 694a325e..694a325e 100644..100755
--- a/bin/yp/datasource.json
+++ b/bin/yp/datasource.json
diff --git a/bin/yp/srtool_env.sh b/bin/yp/srtool_env.sh
new file mode 100755
index 00000000..c6c29c12
--- /dev/null
+++ b/bin/yp/srtool_env.sh
@@ -0,0 +1,3 @@
+# Main application shell settings
+
+export SRT_MAIN_APP="yp"