Refactor meta patch for openstack-panko
Use openstack-panko-config package to package config file for openstack-panko package. The StarlingX common logrotate config file includes panko log files. To avoid conflict with the logrotate config file from openstack-panko, we're overwriting this file with just a comment to clear its config. Deployment test pass and config file check pass! Story: 2003768 Task: 28362 Change-Id: I09b0f6ae93b915e10ff3d8cdf6fc9cbd5fe9426e Signed-off-by: zhipengl <zhipengs.liu@intel.com>
This commit is contained in:
parent
9893164a9a
commit
9d46723d4f
@ -160,6 +160,7 @@ openstack-aodh-config
|
|||||||
python-panko
|
python-panko
|
||||||
openstack-panko-api
|
openstack-panko-api
|
||||||
openstack-panko-common
|
openstack-panko-common
|
||||||
|
openstack-panko-config
|
||||||
|
|
||||||
# rabbitmq-server
|
# rabbitmq-server
|
||||||
rabbitmq-server
|
rabbitmq-server
|
||||||
|
@ -10,6 +10,7 @@ openstack/openstack-magnum
|
|||||||
openstack/openstack-magnum-ui
|
openstack/openstack-magnum-ui
|
||||||
openstack/openstack-ras
|
openstack/openstack-ras
|
||||||
openstack/openstack-panko
|
openstack/openstack-panko
|
||||||
|
openstack/openstack-panko-config
|
||||||
openstack/openstack-os-vif
|
openstack/openstack-os-vif
|
||||||
openstack/python-aodhclient
|
openstack/python-aodhclient
|
||||||
openstack/python-ceilometer
|
openstack/python-ceilometer
|
||||||
|
2
openstack/openstack-panko-config/centos/build_srpm.data
Normal file
2
openstack/openstack-panko-config/centos/build_srpm.data
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
SRC_DIR="files"
|
||||||
|
TIS_PATCH_VER=0
|
@ -0,0 +1,35 @@
|
|||||||
|
Summary: openstack-panko-config
|
||||||
|
Name: openstack-panko-config
|
||||||
|
Version: 1.0
|
||||||
|
Release: %{tis_patch_ver}%{?_tis_dist}
|
||||||
|
License: Apache-2.0
|
||||||
|
Group: openstack
|
||||||
|
Packager: StarlingX
|
||||||
|
URL: unknown
|
||||||
|
BuildArch: noarch
|
||||||
|
Source: %name-%version.tar.gz
|
||||||
|
|
||||||
|
Requires: openstack-panko-common
|
||||||
|
Requires: openstack-panko-api
|
||||||
|
|
||||||
|
Summary: package StarlingX configuration files of openstack-panko to system folder.
|
||||||
|
|
||||||
|
%description
|
||||||
|
package StarlingX configuration files of openstack-panko to system folder.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{__install} -d %{buildroot}%{_bindir}
|
||||||
|
%{__install} -m 0755 panko-expirer-active %{buildroot}%{_bindir}/panko-expirer-active
|
||||||
|
|
||||||
|
%post
|
||||||
|
if test -s %{_sysconfdir}/logrotate.d/openstack-panko ; then
|
||||||
|
echo '#See /etc/logrotate.d/syslog for panko rules' > %{_sysconfdir}/logrotate.d/openstack-panko
|
||||||
|
fi
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_bindir}/panko-expirer-active
|
60
openstack/openstack-panko-config/files/panko-expirer-active
Normal file
60
openstack/openstack-panko-config/files/panko-expirer-active
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Wrapper script to run panko-expirer when on active controller only
|
||||||
|
#
|
||||||
|
PANKO_EXPIRER_INFO="/var/run/panko-expirer.info"
|
||||||
|
PANKO_EXPIRER_CMD="/usr/bin/nice -n 2 /usr/bin/panko-expirer"
|
||||||
|
|
||||||
|
function is_active_pgserver()
|
||||||
|
{
|
||||||
|
# Determine whether we're running on the same controller as the service.
|
||||||
|
local service=postgres
|
||||||
|
local enabledactive=$(/usr/bin/sm-query service $service| grep enabled-active)
|
||||||
|
if [ "x$enabledactive" == "x" ]
|
||||||
|
then
|
||||||
|
# enabled-active not found for that service on this controller
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
# enabled-active found for that resource
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_active_pgserver
|
||||||
|
then
|
||||||
|
if [ ! -f ${PANKO_EXPIRER_INFO} ]
|
||||||
|
then
|
||||||
|
echo skip_count=0 > ${PANKO_EXPIRER_INFO}
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ${PANKO_EXPIRER_INFO}
|
||||||
|
sudo -u postgres psql -d sysinv -c "SELECT alarm_id, entity_instance_id from i_alarm;" | grep -P "^(?=.*100.101)(?=.*${HOSTNAME})" &>/dev/null
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
source /etc/platform/platform.conf
|
||||||
|
if [ "${system_type}" = "All-in-one" ]
|
||||||
|
then
|
||||||
|
source /etc/init.d/task_affinity_functions.sh
|
||||||
|
idle_core=$(get_most_idle_core)
|
||||||
|
if [ "$idle_core" -ne "0" ]
|
||||||
|
then
|
||||||
|
sh -c "exec taskset -c $idle_core ${PANKO_EXPIRER_CMD}"
|
||||||
|
sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$skip_count" -lt "3" ]
|
||||||
|
then
|
||||||
|
newval=$(($skip_count+1))
|
||||||
|
sed -i "/skip_count/s/=.*/=$newval/" ${PANKO_EXPIRER_INFO}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval ${PANKO_EXPIRER_CMD}
|
||||||
|
sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
@ -1 +1 @@
|
|||||||
TIS_PATCH_VER=5
|
TIS_PATCH_VER=6
|
||||||
|
@ -5,9 +5,8 @@ Subject: [PATCH 1/1] panko config
|
|||||||
|
|
||||||
---
|
---
|
||||||
SOURCES/panko-dist.conf | 2 +-
|
SOURCES/panko-dist.conf | 2 +-
|
||||||
SOURCES/panko-expirer-active | 27 +++++++++++++++++++++++++++
|
SPECS/openstack-panko.spec | 17 ++++++++++++++++-
|
||||||
SPECS/openstack-panko.spec | 22 +++++++++++++++++-----
|
2 files changed, 17 insertions(+), 2 deletions(-)
|
||||||
3 files changed, 45 insertions(+), 6 deletions(-)
|
|
||||||
create mode 100644 SOURCES/panko-expirer-active
|
create mode 100644 SOURCES/panko-expirer-active
|
||||||
|
|
||||||
diff --git a/SOURCES/panko-dist.conf b/SOURCES/panko-dist.conf
|
diff --git a/SOURCES/panko-dist.conf b/SOURCES/panko-dist.conf
|
||||||
@ -19,142 +18,66 @@ index c33a2ee..ac6f79f 100644
|
|||||||
-log_dir = /var/log/panko
|
-log_dir = /var/log/panko
|
||||||
+#log_dir = /var/log/panko
|
+#log_dir = /var/log/panko
|
||||||
use_stderr = False
|
use_stderr = False
|
||||||
|
|
||||||
diff --git a/SOURCES/panko-expirer-active b/SOURCES/panko-expirer-active
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..7d526e0
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/SOURCES/panko-expirer-active
|
|
||||||
@@ -0,0 +1,60 @@
|
|
||||||
+#!/bin/bash
|
|
||||||
+
|
|
||||||
+#
|
|
||||||
+# Wrapper script to run panko-expirer when on active controller only
|
|
||||||
+#
|
|
||||||
+PANKO_EXPIRER_INFO="/var/run/panko-expirer.info"
|
|
||||||
+PANKO_EXPIRER_CMD="/usr/bin/nice -n 2 /usr/bin/panko-expirer"
|
|
||||||
+
|
|
||||||
+function is_active_pgserver()
|
|
||||||
+{
|
|
||||||
+ # Determine whether we're running on the same controller as the service.
|
|
||||||
+ local service=postgres
|
|
||||||
+ local enabledactive=$(/usr/bin/sm-query service $service| grep enabled-active)
|
|
||||||
+ if [ "x$enabledactive" == "x" ]
|
|
||||||
+ then
|
|
||||||
+ # enabled-active not found for that service on this controller
|
|
||||||
+ return 1
|
|
||||||
+ else
|
|
||||||
+ # enabled-active found for that resource
|
|
||||||
+ return 0
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+if is_active_pgserver
|
|
||||||
+then
|
|
||||||
+ if [ ! -f ${PANKO_EXPIRER_INFO} ]
|
|
||||||
+ then
|
|
||||||
+ echo skip_count=0 > ${PANKO_EXPIRER_INFO}
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ source ${PANKO_EXPIRER_INFO}
|
|
||||||
+ sudo -u postgres psql -d sysinv -c "SELECT alarm_id, entity_instance_id from i_alarm;" | grep -P "^(?=.*100.101)(?=.*${HOSTNAME})" &>/dev/null
|
|
||||||
+ if [ $? -eq 0 ]
|
|
||||||
+ then
|
|
||||||
+ source /etc/platform/platform.conf
|
|
||||||
+ if [ "${system_type}" = "All-in-one" ]
|
|
||||||
+ then
|
|
||||||
+ source /etc/init.d/task_affinity_functions.sh
|
|
||||||
+ idle_core=$(get_most_idle_core)
|
|
||||||
+ if [ "$idle_core" -ne "0" ]
|
|
||||||
+ then
|
|
||||||
+ sh -c "exec taskset -c $idle_core ${PANKO_EXPIRER_CMD}"
|
|
||||||
+ sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
|
||||||
+ exit 0
|
|
||||||
+ fi
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ if [ "$skip_count" -lt "3" ]
|
|
||||||
+ then
|
|
||||||
+ newval=$(($skip_count+1))
|
|
||||||
+ sed -i "/skip_count/s/=.*/=$newval/" ${PANKO_EXPIRER_INFO}
|
|
||||||
+ exit 0
|
|
||||||
+ fi
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ eval ${PANKO_EXPIRER_CMD}
|
|
||||||
+ sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+exit 0
|
|
||||||
diff --git a/SPECS/openstack-panko.spec b/SPECS/openstack-panko.spec
|
diff --git a/SPECS/openstack-panko.spec b/SPECS/openstack-panko.spec
|
||||||
index d12da57..90471d9 100644
|
index d12da57..90471d9 100644
|
||||||
--- a/SPECS/openstack-panko.spec
|
--- a/SPECS/openstack-panko.spec
|
||||||
+++ b/SPECS/openstack-panko.spec
|
+++ b/SPECS/openstack-panko.spec
|
||||||
@@ -4,20 +4,26 @@
|
@@ -4,20 +4,27 @@
|
||||||
|
|
||||||
Name: openstack-panko
|
Name: openstack-panko
|
||||||
Version: 3.0.0
|
Version: 3.0.0
|
||||||
-Release: 1%{?dist}
|
-Release: 1%{?dist}
|
||||||
+Release: 1%{?_tis_dist}.%{tis_patch_ver}
|
+Release: 1%{?_tis_dist}.%{tis_patch_ver}
|
||||||
Summary: Panko provides Event storage and REST API
|
Summary: Panko provides Event storage and REST API
|
||||||
|
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
URL: http://github.com/openstack/panko
|
URL: http://github.com/openstack/panko
|
||||||
Source0: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz
|
Source0: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz
|
||||||
Source1: %{pypi_name}-dist.conf
|
Source1: %{pypi_name}-dist.conf
|
||||||
-Source2: %{pypi_name}.logrotate
|
Source2: %{pypi_name}.logrotate
|
||||||
+# WRS
|
|
||||||
+Source2: panko-expirer-active
|
|
||||||
+
|
+
|
||||||
+# WRS: Include patches here
|
+# WRS: Include patches here
|
||||||
+Patch1: 0001-modify-panko-api.patch
|
+Patch1: 0001-modify-panko-api.patch
|
||||||
|
+Patch2: 0002-Change-event-list-descending.patch
|
||||||
|
+Patch3: 0003-Fix-event-query-to-sqlalchemy-with-non-admin-user.patch
|
||||||
+
|
+
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
BuildRequires: python-pbr
|
BuildRequires: python-pbr
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
BuildRequires: openstack-macros
|
BuildRequires: openstack-macros
|
||||||
+BuildRequires: python-tenacity >= 3.1.0
|
+BuildRequires: python-tenacity >= 3.1.0
|
||||||
|
|
||||||
%description
|
%description
|
||||||
HTTP API to store events.
|
HTTP API to store events.
|
||||||
@@ -116,6 +122,9 @@ This package contains documentation files for panko.
|
@@ -116,6 +123,11 @@ This package contains documentation files for panko.
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{pypi_name}-%{upstream_version}
|
%setup -q -n %{pypi_name}-%{upstream_version}
|
||||||
|
|
||||||
+# WRS: Apply patches here
|
+# WRS: Apply patches here
|
||||||
+%patch1 -p1
|
+%patch1 -p1
|
||||||
|
+%patch2 -p1
|
||||||
|
+%patch3 -p1
|
||||||
+
|
+
|
||||||
find . \( -name .gitignore -o -name .placeholder \) -delete
|
find . \( -name .gitignore -o -name .placeholder \) -delete
|
||||||
|
|
||||||
find panko -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
|
find panko -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
|
||||||
@@ -158,6 +167,8 @@ mkdir -p %{buildroot}/%{_var}/log/%{name}
|
@@ -158,6 +170,8 @@ mkdir -p %{buildroot}/%{_var}/log/%{name}
|
||||||
install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/panko/panko-dist.conf
|
install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/panko/panko-dist.conf
|
||||||
install -p -D -m 640 etc/panko/panko.conf %{buildroot}%{_sysconfdir}/panko/panko.conf
|
install -p -D -m 640 etc/panko/panko.conf %{buildroot}%{_sysconfdir}/panko/panko.conf
|
||||||
install -p -D -m 640 etc/panko/api_paste.ini %{buildroot}%{_sysconfdir}/panko/api_paste.ini
|
install -p -D -m 640 etc/panko/api_paste.ini %{buildroot}%{_sysconfdir}/panko/api_paste.ini
|
||||||
+# WRS
|
+# WRS
|
||||||
+install -p -D -m 640 panko/api/panko-api.py %{buildroot}%{_datadir}/panko/panko-api.py
|
+install -p -D -m 640 panko/api/panko-api.py %{buildroot}%{_datadir}/panko/panko-api.py
|
||||||
|
|
||||||
#TODO(prad): build the docs at run time, once the we get rid of postgres setup dependency
|
#TODO(prad): build the docs at run time, once the we get rid of postgres setup dependency
|
||||||
|
|
||||||
@@ -169,8 +180,8 @@ install -d -m 755 %{buildroot}%{_sharedstatedir}/panko
|
@@ -201,14 +215,15 @@ exit 0
|
||||||
install -d -m 755 %{buildroot}%{_sharedstatedir}/panko/tmp
|
|
||||||
install -d -m 755 %{buildroot}%{_localstatedir}/log/panko
|
|
||||||
|
|
||||||
-# Install logrotate
|
|
||||||
-install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
|
|
||||||
+# WRS
|
|
||||||
+install -p -D -m 755 %{SOURCE2} %{buildroot}%{_bindir}/panko-expirer-active
|
|
||||||
|
|
||||||
# Remove all of the conf files that are included in the buildroot/usr/etc dir since we installed them above
|
|
||||||
rm -f %{buildroot}/usr/etc/panko/*
|
|
||||||
@@ -201,14 +212,15 @@ exit 0
|
|
||||||
%{_bindir}/panko-api
|
%{_bindir}/panko-api
|
||||||
%{_bindir}/panko-dbsync
|
%{_bindir}/panko-dbsync
|
||||||
%{_bindir}/panko-expirer
|
%{_bindir}/panko-expirer
|
||||||
+%{_bindir}/panko-expirer-active
|
|
||||||
|
|
||||||
%files common
|
%files common
|
||||||
%dir %{_sysconfdir}/panko
|
%dir %{_sysconfdir}/panko
|
||||||
+%{_datadir}/panko/panko-api.*
|
+%{_datadir}/panko/panko-api.*
|
||||||
@ -162,10 +85,10 @@ index d12da57..90471d9 100644
|
|||||||
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/policy.json
|
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/policy.json
|
||||||
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/panko.conf
|
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/panko.conf
|
||||||
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/api_paste.ini
|
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/api_paste.ini
|
||||||
-%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/logrotate.d/%{name}
|
%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/logrotate.d/%{name}
|
||||||
%dir %attr(0755, panko, root) %{_localstatedir}/log/panko
|
%dir %attr(0755, panko, root) %{_localstatedir}/log/panko
|
||||||
|
|
||||||
%defattr(-, panko, panko, -)
|
%defattr(-, panko, panko, -)
|
||||||
--
|
--
|
||||||
1.8.3.1
|
1.8.3.1
|
||||||
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
From 4e791be412662ae1f97cfd4ff5a90ea6337e49a4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Angie Wang <angie.Wang@windriver.com>
|
|
||||||
Date: Thu, 16 Nov 2017 15:25:08 -0500
|
|
||||||
Subject: [PATCH 1/1] spec change event list descending
|
|
||||||
|
|
||||||
---
|
|
||||||
SPECS/openstack-panko.spec | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/SPECS/openstack-panko.spec b/SPECS/openstack-panko.spec
|
|
||||||
index 90471d9..95497b4 100644
|
|
||||||
--- a/SPECS/openstack-panko.spec
|
|
||||||
+++ b/SPECS/openstack-panko.spec
|
|
||||||
@@ -16,6 +16,7 @@ Source2: panko-expirer-active
|
|
||||||
|
|
||||||
# WRS: Include patches here
|
|
||||||
Patch1: 0001-modify-panko-api.patch
|
|
||||||
+Patch2: 0002-Change-event-list-descending.patch
|
|
||||||
|
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ This package contains documentation files for panko.
|
|
||||||
|
|
||||||
# WRS: Apply patches here
|
|
||||||
%patch1 -p1
|
|
||||||
+%patch2 -p1
|
|
||||||
|
|
||||||
find . \( -name .gitignore -o -name .placeholder \) -delete
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From aad89aa79de1e9f0b35afa1ba587c10591a889e0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Angie Wang <angie.Wang@windriver.com>
|
|
||||||
Date: Mon, 11 Dec 2017 16:29:23 -0500
|
|
||||||
Subject: [PATCH 1/1] spec fix event query to sqlalchemy with non admin user
|
|
||||||
|
|
||||||
---
|
|
||||||
SPECS/openstack-panko.spec | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/SPECS/openstack-panko.spec b/SPECS/openstack-panko.spec
|
|
||||||
index 95497b4..87a6a5a 100644
|
|
||||||
--- a/SPECS/openstack-panko.spec
|
|
||||||
+++ b/SPECS/openstack-panko.spec
|
|
||||||
@@ -17,6 +17,7 @@ Source2: panko-expirer-active
|
|
||||||
# WRS: Include patches here
|
|
||||||
Patch1: 0001-modify-panko-api.patch
|
|
||||||
Patch2: 0002-Change-event-list-descending.patch
|
|
||||||
+Patch3: 0003-Fix-event-query-to-sqlalchemy-with-non-admin-user.patch
|
|
||||||
|
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
@@ -126,6 +127,7 @@ This package contains documentation files for panko.
|
|
||||||
# WRS: Apply patches here
|
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
+%patch3 -p1
|
|
||||||
|
|
||||||
find . \( -name .gitignore -o -name .placeholder \) -delete
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
@ -1,3 +1 @@
|
|||||||
0001-panko-config.patch
|
0001-panko-config.patch
|
||||||
0002-spec-change-event-list-descending.patch
|
|
||||||
0003-spec-fix-event-query-to-sqlalchemy-with-non-admin-us.patch
|
|
||||||
|
Loading…
Reference in New Issue
Block a user