[PATCH][Wok 1/2] Issue #116: Suggestion to check spec guidelines
by Ramon Medeiros
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Makefile.am | 5 ++++-
check_spec_errors.sh | 36 ++++++++++++++++++++++++++++++++++++
configure.ac | 1 +
docs/fedora-deps.md | 2 +-
docs/opensuse-deps.md | 2 +-
5 files changed, 43 insertions(+), 3 deletions(-)
create mode 100755 check_spec_errors.sh
diff --git a/Makefile.am b/Makefile.am
index 8b3f508..e7549f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,7 +68,10 @@ check-local:
&& echo "ERROR: Whitespaces found" || echo "Ok"; \
echo "Check IBM license header and copyright date ..." ; \
/bin/bash check-IBM-license-header.sh ; \
- fi
+ fi;
+ @if [ -f $(RPMLINT) ]; then \
+ ./check_spec_errors.sh; \
+ fi;
# Link built mo files in the source tree to enable use of translations from
# within the source tree
diff --git a/check_spec_errors.sh b/check_spec_errors.sh
new file mode 100755
index 0000000..e5f47f4
--- /dev/null
+++ b/check_spec_errors.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#
+# Project Wok
+#
+# Copyright IBM Corp, 2016
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+echo "Checking spec guidelines"
+
+# create links
+cp contrib/wok.spec.fedora contrib/wok_fedora.spec
+cp contrib/wok.spec.suse contrib/wok_suse.spec
+
+# run checking
+rpmlint contrib/wok_fedora.spec
+rpmlint contrib/wok_suse.spec
+
+# remove links
+rm contrib/wok_fedora.spec
+rm contrib/wok_suse.spec
+
+
diff --git a/configure.ac b/configure.ac
index ff41c84..0c27859 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ AM_INIT_AUTOMAKE([-Wno-portability])
AM_PATH_PYTHON([2.6])
AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
AC_PATH_PROG([GIT], [git], [/usr/bin/git])
+AC_PATH_PROG([RPMLINT], [rpmlint], [/usr/bin/rpmlint])
AC_PYTHON_MODULE([unittest])
AC_SUBST([HAVE_PYMOD_UNITTEST])
AC_SUBST([PYTHON_VERSION])
diff --git a/docs/fedora-deps.md b/docs/fedora-deps.md
index e665cdb..260390e 100644
--- a/docs/fedora-deps.md
+++ b/docs/fedora-deps.md
@@ -42,7 +42,7 @@ Packages required for UI development
Packages required for tests
---------------------------
- $ sudo yum install pyflakes python-pep8 python-requests
+ $ sudo yum install pyflakes python-pep8 python-requests rpmlint
# For RHEL systems, install the additional packages:
$ sudo yum install python-unittest2
diff --git a/docs/opensuse-deps.md b/docs/opensuse-deps.md
index 4fe3876..7fe1763 100644
--- a/docs/opensuse-deps.md
+++ b/docs/opensuse-deps.md
@@ -29,4 +29,4 @@ Packages required for UI development
Packages required for tests
---------------------------
- $ sudo zypper install python-pyflakes python-pep8 python-requests
+ $ sudo zypper install python-pyflakes python-pep8 python-requests rpmlint
--
2.7.4
8 years
[PATCH][Wok] Issue #139: Do not generate logrotate config file on the fly
by Ramon Medeiros
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Makefile.am | 2 +-
src/Makefile.am | 1 +
src/wok.conf.in | 8 +++++---
src/wok.logrotate | 9 +++++++++
src/wok/server.py | 28 +---------------------------
5 files changed, 17 insertions(+), 31 deletions(-)
create mode 100644 src/wok.logrotate
diff --git a/Makefile.am b/Makefile.am
index 8b3f508..4deadb1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -155,7 +155,7 @@ install-data-local:
$(INSTALL_DATA) src/dhparams.pem $(DESTDIR)/etc/wok/dhparams.pem
touch $(DESTDIR)/etc/nginx/conf.d/wok.conf
mkdir -p $(DESTDIR)/etc/logrotate.d/
- touch $(DESTDIR)/etc/logrotate.d/wokd
+ $(INSTALL_DATA) $(top_srcdir)/src/wok.logrotate $(DESTDIR)/etc/logrotate.d/wokd
uninstall-local:
@if test -f $(systemdsystemunitdir)/wokd.service; then \
diff --git a/src/Makefile.am b/src/Makefile.am
index f06d755..27e0815 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ SUBDIRS = wok nginx
EXTRA_DIST = wokd.in \
wok.conf.in \
firewalld.xml \
+ wok.logrotate \
$(NULL)
bin_SCRIPTS = wokd
diff --git a/src/wok.conf.in b/src/wok.conf.in
index 5e04b20..254f786 100644
--- a/src/wok.conf.in
+++ b/src/wok.conf.in
@@ -50,14 +50,16 @@
[logging]
# Log directory
+
+# Be aware that editting logging directory, you must change logrotate
+# configuration file to keep logs being compressed.
+# Look /etc/logrotate.d/wokd
+
#log_dir = @localstatedir@/log/wok
# Logging level: debug, info, warning, error or critical
#log_level = debug
-# Log file size (specify size in K, M or G)
-#log_size = 10M
-
[authentication]
# Authentication method, available option: pam, ldap.
# method = pam
diff --git a/src/wok.logrotate b/src/wok.logrotate
new file mode 100644
index 0000000..505c3e7
--- /dev/null
+++ b/src/wok.logrotate
@@ -0,0 +1,9 @@
+/var/log/wok {
+ daily
+ nomail
+ maxsize 10M
+ rotate 10
+ nomissingok
+ compress
+}
+
diff --git a/src/wok/server.py b/src/wok/server.py
index fecca48..9d864df 100644
--- a/src/wok/server.py
+++ b/src/wok/server.py
@@ -30,7 +30,7 @@ from string import Template
from wok import auth
from wok import config
from wok.config import config as configParser
-from wok.config import paths, PluginConfig, WokConfig
+from wok.config import PluginConfig, WokConfig
from wok.control import sub_nodes
from wok.model import model
from wok.proxy import start_proxy
@@ -45,17 +45,6 @@ LOGGING_LEVEL = {"debug": logging.DEBUG,
"warning": logging.WARNING,
"error": logging.ERROR,
"critical": logging.CRITICAL}
-LOGROTATE_TEMPLATE = """
-${log_dir}/*log {
- daily
- nomail
- maxsize ${log_size}
- rotate 10
- nomissingok
- compress
-}
-"""
-
def set_no_cache():
from time import strftime, gmtime
@@ -147,21 +136,6 @@ class Server(object):
# start request logger
self.reqLogger = RequestLogger()
- # only add logrotate if wok is installed
- if paths.installed:
-
- # redefine logrotate configuration according to wok.conf
- data = Template(LOGROTATE_TEMPLATE)
- data = data.safe_substitute(
- log_dir=configParser.get("logging", "log_dir"),
- log_size=configParser.get("logging", "log_size")
- )
-
- # Write file to be used for nginx.
- config_file = open(os.path.join(paths.logrotate_dir, "wokd"), "w")
- config_file.write(data)
- config_file.close()
-
# Handling running mode
if not dev_env:
cherrypy.config.update({'environment': 'production'})
--
2.7.4
8 years