diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/guni_config.py b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/guni_config.py
deleted file mode 100644
index 57a0727..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/guni_config.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import datetime
-import fnmatch
-import os
-import resource
-import subprocess
-from django.conf import settings
-
-
-errorlog = "/var/log/horizon/gunicorn.log"
-capture_output = True
-
-# maxrss ceiling in kbytes
-MAXRSS_CEILING = 512000
-
-
-def worker_abort(worker):
- path = ("/proc/%s/fd") % os.getpid()
- contents = os.listdir(path)
- upload_dir = getattr(settings, 'FILE_UPLOAD_TEMP_DIR', '/tmp')
- pattern = os.path.join(upload_dir, '*.upload')
-
- for i in contents:
- f = os.path.join(path, i)
- if os.path.exists(f):
- try:
- link = os.readlink(f)
- if fnmatch.fnmatch(link, pattern):
- worker.log.info(link)
- os.remove(link)
- except OSError:
- pass
-
-
-def when_ready(server):
- subprocess.check_call(["/usr/bin/horizon-assets-compress"])
-
-
-def post_worker_init(worker):
- worker.nrq = 0
- worker.restart = False
-
-
-def pre_request(worker, req):
- worker.nrq += 1
- if worker.restart:
- worker.nr = worker.max_requests - 1
- maxrss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
- msg = "%(date)s %(uri)s %(rss)u" % ({'date': datetime.datetime.now(),
- 'uri': getattr(req, "uri"),
- 'rss': maxrss})
- worker.log.info(msg)
-
-
-def post_request(worker, req, environ, resp):
- worker.nrq -= 1
- if not worker.restart:
- maxrss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
- if maxrss > MAXRSS_CEILING and worker.nrq == 0:
- worker.restart = True
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-assets-compress b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-assets-compress
deleted file mode 100644
index 8b17d31..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-assets-compress
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2017 Wind River Systems, Inc.
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-PYTHON=`which python`
-MANAGE="/usr/share/openstack-dashboard/manage.py"
-STATICDIR="/www/pages/static"
-BRANDDIR="/opt/branding"
-APPLIEDDIR="/opt/branding/applied"
-
-# Handle custom horizon branding
-rm -rf ${APPLIEDDIR}
-if ls ${BRANDDIR}/*.tgz 1> /dev/null 2>&1; then
- LATESTBRANDING=$(ls $BRANDDIR |grep '\.tgz$' | tail -n 1)
- mkdir -p ${APPLIEDDIR}
- tar zxf ${BRANDDIR}/${LATESTBRANDING} -C ${APPLIEDDIR} 2>/dev/null 1>/dev/null
- RETVAL=$?
- if [ $RETVAL -ne 0 ]; then
- echo "Failed to extract ${BRANDDIR}/${LATESTBRANDING}"
- fi
-fi
-
-echo "Dumping static assets"
-if [ -d ${STATICDIR} ]; then
- COLLECTARGS=--clear
-fi
-${PYTHON} -- ${MANAGE} collectstatic -v0 --noinput ${COLLECTARGS}
-
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
- echo "Failed to dump static assets."
- exit $RETVAL
-fi
-
-nice -n 20 ionice -c Idle ${PYTHON} -- ${MANAGE} compress -v0
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
- echo "Failed to compress assets."
- exit $RETVAL
-fi
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-clearsessions b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-clearsessions
deleted file mode 100644
index 33e0736..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-clearsessions
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-/usr/bin/nice -n 2 /usr/bin/python /usr/share/openstack-dashboard/manage.py clearsessions
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-patching-restart b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-patching-restart
deleted file mode 100644
index 9fc15df..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-patching-restart
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2017 Wind River Systems, Inc.
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-#
-# The patching subsystem provides a patch-functions bash source file
-# with useful function and variable definitions.
-#
-. /etc/patching/patch-functions
-
-#
-# We can now check to see what type of node we're on, if it's locked, etc,
-# and act accordingly
-#
-
-#
-# Declare an overall script return code
-#
-declare -i GLOBAL_RC=$PATCH_STATUS_OK
-
-#
-# handle restarting horizon.
-#
-if is_controller
-then
- # Horizon only runs on the controller
-
- if [ ! -f $PATCH_FLAGDIR/horizon.restarted ]
- then
- # Check SM to see if Horizon is running
- sm-query service horizon | grep -q 'enabled-active'
- if [ $? -eq 0 ]
- then
- loginfo "$0: Logging out all horizon sessions"
-
- # Remove sessions
- rm -f /var/tmp/sessionid*
-
- loginfo "$0: Restarting horizon"
-
- # Ask SM to restart Horizon
- sm-restart service horizon
- touch $PATCH_FLAGDIR/horizon.restarted
-
- # Wait up to 30 seconds for service to recover
- let -i UNTIL=$SECONDS+30
- while [ $UNTIL -ge $SECONDS ]
- do
- # Check to see if it's running
- sm-query service horizon | grep -q 'enabled-active'
- if [ $? -eq 0 ]
- then
- break
- fi
-
- # Still not running? Let's wait 5 seconds and check again
- sleep 5
- done
-
- sm-query service horizon | grep -q 'enabled-active'
- if [ $? -ne 0 ]
- then
- # Still not running! Clear the flag and mark the RC as failed
- loginfo "$0: Failed to restart horizon"
- rm -f $PATCH_FLAGDIR/horizon.restarted
- GLOBAL_RC=$PATCH_STATUS_FAILED
- sm-query service horizon
- fi
- fi
- fi
-fi
-
-#
-# Exit the script with the overall return code
-#
-exit $GLOBAL_RC
-
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon.init b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon.init
deleted file mode 100755
index a2b15bc..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon.init
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/bin/sh
-
-### BEGIN INIT INFO
-# Provides: OpenStack Dashboard
-# Required-Start: networking
-# Required-Stop: networking
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: OpenStack Dashboard
-# Description: Web based user interface to OpenStack services including
-# Nova, Swift, Keystone, etc.
-### END INIT INFO
-
-RETVAL=0
-DESC="openstack-dashboard"
-PIDFILE="/var/run/$DESC.pid"
-PYTHON=`which python`
-# Centos packages openstack_dashboard under /usr/share
-#MANAGE="@PYTHON_SITEPACKAGES@/openstack_dashboard/manage.py"
-MANAGE="/usr/share/openstack-dashboard/manage.py"
-EXEC="/usr/bin/gunicorn"
-BIND="localhost"
-PORT="8008"
-WORKER="eventlet"
-WORKERS=`grep workers /etc/openstack-dashboard/horizon-config.ini | cut -f3 -d' '`
-# Increased timeout to facilitate large image uploads
-TIMEOUT="200"
-STATICDIR="/www/pages/static"
-BRANDDIR="/opt/branding"
-APPLIEDDIR="/opt/branding/applied"
-TMPUPLOADDIR="/scratch/horizon"
-
-source /usr/bin/tsconfig
-
-start()
-{
- # Change workers if combined controller/compute
- . /etc/platform/platform.conf
- if [ "${WORKERS}" -lt "2" ]; then
- WORKERS=2
- fi
-
- if [ -e $PIDFILE ]; then
- PIDDIR=/proc/$(cat $PIDFILE)
- if [ -d ${PIDDIR} ]; then
- echo "$DESC already running."
- return
- else
- echo "Removing stale PID file $PIDFILE"
- rm -f $PIDFILE
- fi
- fi
-
- # Clean up any possible orphaned worker threads
- if lsof -t -i:${PORT} 1> /dev/null 2>&1; then
- kill $(lsof -t -i:${PORT}) > /dev/null 2>&1
- fi
-
- rm -rf ${TMPUPLOADDIR}
- mkdir -p ${TMPUPLOADDIR}
-
- echo -n "Starting $DESC..."
-
- start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} \
- --make-pidfile --exec ${PYTHON} -- ${EXEC} --bind ${BIND}:${PORT} \
- --worker-class ${WORKER} --workers ${WORKERS} --timeout ${TIMEOUT} \
- --log-syslog \
- --config '/usr/share/openstack-dashboard/guni_config.py' \
- --pythonpath '/usr/share/openstack-dashboard' \
- openstack_dashboard.wsgi
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- echo "done."
- else
- echo "failed."
- fi
-
- # now copy customer branding file to CONFIG_PATH/branding if anything updated
- sm-query service drbd-platform | grep enabled-active > /dev/null 2>&1
- IS_ACTIVE=$?
-
- if ls ${BRANDDIR}/*.tgz 1> /dev/null 2>&1; then
- LATESTBRANDING=$(ls $BRANDDIR |grep '\.tgz$' | tail -n 1)
- if [ $IS_ACTIVE -eq 0 ]; then
- # Only do the copy if the tarball has changed
- if ! cmp --silent ${BRANDDIR}/${LATESTBRANDING} ${CONFIG_PATH}/branding/${LATESTBRANDING} ; then
- mkdir -p ${CONFIG_PATH}/branding
- rm -rf ${CONFIG_PATH}/branding/*.tgz
- cp -r ${BRANDDIR}/${LATESTBRANDING} ${CONFIG_PATH}/branding
- fi
- fi
- fi
-
- # As part of starting horizon we should kill containerized horizon so that it
- # will pickup branding changes
- kubectl --kubeconfig=/etc/kubernetes/admin.conf delete pods -n openstack -l application=horizon 1>/dev/null
-}
-
-stop()
-{
- if [ ! -e $PIDFILE ]; then return; fi
-
- echo -n "Stopping $DESC..."
-
- start-stop-daemon --stop --quiet --pidfile $PIDFILE
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- echo "done."
- else
- echo "failed."
- fi
- rm -rf ${TMPUPLOADDIR}
- rm -f $PIDFILE
-}
-
-status()
-{
- pid=`cat $PIDFILE 2>/dev/null`
- if [ -n "$pid" ]; then
- if ps -p $pid &> /dev/null ; then
- echo "$DESC is running"
- RETVAL=0
- return
- else
- RETVAL=1
- fi
- fi
- echo "$DESC is not running"
- RETVAL=3
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|force-reload|reload)
- stop
- start
- ;;
- status)
- status
- ;;
- *)
- echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
- RETVAL=1
- ;;
-esac
-
-exit $RETVAL
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-2.4.conf b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-2.4.conf
deleted file mode 100644
index ea89c9f..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-2.4.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-
-WSGIDaemonProcess dashboard
-WSGIProcessGroup dashboard
-WSGISocketPrefix run/wsgi
-
-WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
-Alias /dashboard/static /usr/share/openstack-dashboard/static
-
-
- Options All
- AllowOverride All
- Require all granted
-
-
-
- Options All
- AllowOverride All
- Require all granted
-
-
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-logging.conf b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-logging.conf
deleted file mode 100644
index 7118e9a..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/openstack-dashboard-httpd-logging.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# if you want logging to a separate file, please update your config
-# according to the last 4 lines in this snippet, and also take care
-# to introduce a directive.
-#
-
-WSGISocketPrefix run/wsgi
-
-
- WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
- Alias /static /usr/share/openstack-dashboard/static
-
- WSGIDaemonProcess dashboard
- WSGIProcessGroup dashboard
-
- #DocumentRoot %HORIZON_DIR%/.blackhole/
-
-
- Options FollowSymLinks
- AllowOverride None
-
-
-
- Options Indexes FollowSymLinks MultiViews
- AllowOverride None
- Order allow,deny
- allow from all
-
-
- ErrorLog logs/openstack_dashboard_error.log
- LogLevel warn
- CustomLog logs/openstack_dashboard_access.log combined
-
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-logrotate.conf b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-logrotate.conf
deleted file mode 100644
index 64b18a7..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-logrotate.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-
-/var/log/horizon/*.log {
- weekly
- rotate 4
- missingok
- compress
- minsize 100k
-}
-
diff --git a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-systemd.conf b/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-systemd.conf
deleted file mode 100644
index bf9918d..0000000
--- a/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/python-django-horizon-systemd.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-[Service]
-ExecStartPre=/usr/bin/python /usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear
-ExecStartPre=/usr/bin/python /usr/share/openstack-dashboard/manage.py compress --force
diff --git a/meta-stx-cloud/recipes-devtools/python/python-django-horizon_15.1.0.bbappend b/meta-stx-cloud/recipes-devtools/python/python-django-horizon_15.1.0.bbappend
index 2ed2704..8a95dbc 100644
--- a/meta-stx-cloud/recipes-devtools/python/python-django-horizon_15.1.0.bbappend
+++ b/meta-stx-cloud/recipes-devtools/python/python-django-horizon_15.1.0.bbappend
@@ -1,15 +1,10 @@
+inherit stx-metadata
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI += " \
- file://${BPN}/guni_config.py \
- file://${BPN}/horizon-assets-compress \
- file://${BPN}/horizon-clearsessions \
- file://${BPN}/horizon.init \
- file://${BPN}/horizon-patching-restart \
- file://${BPN}/openstack-dashboard-httpd-2.4.conf \
- file://${BPN}/openstack-dashboard-httpd-logging.conf \
- file://${BPN}/python-django-horizon-logrotate.conf \
- file://${BPN}/python-django-horizon-systemd.conf \
+STX_REPO = "upstream"
+STX_SUBPATH = "openstack/python-horizon/centos/files"
+
+SRC_URI_STX += " \
+ file://0001-Remove-the-hard-coded-internal-URL-for-keystone.patch \
"
do_configure_prepend () {
@@ -23,8 +18,8 @@ do_configure_prepend () {
rm -rf horizon.egg-info
# drop config snippet
- cp -p ${WORKDIR}/${BPN}/openstack-dashboard-httpd-logging.conf .
- cp -p ${WORKDIR}/${BPN}/guni_config.py .
+ cp -p ${STX_METADATA_PATH}/openstack-dashboard-httpd-logging.conf .
+ cp -p ${STX_METADATA_PATH}/guni_config.py .
# customize default settings
# WAS [PATCH] disable debug, move web root
@@ -56,20 +51,20 @@ do_install_append () {
# STX
install -d -m 755 ${D}/opt/branding
mkdir -p ${D}${sysconfdir}/rc.d/init.d
- install -m 755 -D -p ${WORKDIR}/${BPN}/horizon.init ${D}${sysconfdir}/rc.d/init.d/horizon
- install -m 755 -D -p ${WORKDIR}/${BPN}/horizon.init ${D}${sysconfdir}/init.d/horizon
- install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-clearsessions ${D}/${bindir}/horizon-clearsessions
- install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-patching-restart ${D}/${bindir}/horizon-patching-restart
- install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-assets-compress ${D}/${bindir}/horizon-assets-compress
+ install -m 755 -D -p ${STX_METADATA_PATH}/horizon.init ${D}${sysconfdir}/rc.d/init.d/horizon
+ install -m 755 -D -p ${STX_METADATA_PATH}/horizon.init ${D}${sysconfdir}/init.d/horizon
+ install -m 755 -D -p ${STX_METADATA_PATH}/horizon-clearsessions ${D}/${bindir}/horizon-clearsessions
+ install -m 755 -D -p ${STX_METADATA_PATH}/horizon-patching-restart ${D}/${bindir}/horizon-patching-restart
+ install -m 755 -D -p ${STX_METADATA_PATH}/horizon-assets-compress ${D}/${bindir}/horizon-assets-compress
# drop httpd-conf snippet
- install -m 0644 -D -p ${WORKDIR}/${BPN}/openstack-dashboard-httpd-2.4.conf ${D}${sysconfdir}/httpd/conf.d/openstack-dashboard.conf
+ install -m 0644 -D -p ${STX_METADATA_PATH}/openstack-dashboard-httpd-2.4.conf ${D}${sysconfdir}/httpd/conf.d/openstack-dashboard.conf
install -d -m 755 ${D}${datadir}/openstack-dashboard
install -d -m 755 ${D}${sysconfdir}/openstack-dashboard
# create directory for systemd snippet
mkdir -p ${D}${systemd_system_unitdir}/httpd.service.d/
- cp ${WORKDIR}/${BPN}/python-django-horizon-systemd.conf ${D}${systemd_system_unitdir}/httpd.service.d/openstack-dashboard.conf
+ cp ${STX_METADATA_PATH}/python-django-horizon-systemd.conf ${D}${systemd_system_unitdir}/httpd.service.d/openstack-dashboard.conf
# Copy everything to /usr/share
mv ${D}${libdir}/python2.7/site-packages/openstack_dashboard \
@@ -88,7 +83,6 @@ do_install_append () {
mv ${D}${datadir}/openstack-dashboard/openstack_dashboard/local/local_settings.py.example ${D}${sysconfdir}/openstack-dashboard/local_settings
mv ${D}${datadir}/openstack-dashboard/openstack_dashboard/conf/*.json ${D}${sysconfdir}/openstack-dashboard
- cp -a ${S}/openstack_dashboard/conf/cinder_policy.d ${D}${sysconfdir}/openstack-dashboard
cp -a ${S}/openstack_dashboard/conf/nova_policy.d ${D}${sysconfdir}/openstack-dashboard
# copy static files to ${datadir}/openstack-dashboard/static
@@ -103,7 +97,7 @@ do_install_append () {
# place logrotate config:
mkdir -p ${D}${sysconfdir}/logrotate.d
- cp -a ${WORKDIR}/${BPN}/python-django-horizon-logrotate.conf ${D}${sysconfdir}/logrotate.d/openstack-dashboard
+ cp -a ${STX_METADATA_PATH}/python-django-horizon-logrotate.conf ${D}${sysconfdir}/logrotate.d/openstack-dashboard
chown -R root:root ${D}
}