Skip to content

Commit

Permalink
Merge pull request #77 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Version 0.3.9
  • Loading branch information
themiszamani authored Feb 1, 2021
2 parents bddc851 + df9f653 commit c536b31
Show file tree
Hide file tree
Showing 21 changed files with 233 additions and 680 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.3.9] - 2021-02-01

### Changed

* ARGO-2929 Let systemd handle runtime directory
* ARGO-2855 ams-publisher py3 switch

## [0.3.8] - 2020-10-08

### Fixed
Expand Down
25 changes: 2 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ pipeline {
stages {
stage ('Build'){
parallel {
stage ('Build Centos 6') {
agent {
docker {
image 'argo.registry:5000/epel-6-ams'
args '-u jenkins:jenkins'
}
}
steps {
echo 'Building Rpm...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos6 -p ${PROJECT_DIR} -s ${REPOKEY}"
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
post{
always {
cleanWs()
}
}
}
stage ('Build Centos 7') {
agent {
docker {
Expand All @@ -54,7 +33,7 @@ pipeline {
cleanWs()
}
}
}
}
}
}
}
Expand All @@ -74,7 +53,7 @@ pipeline {
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) {
slackSend( message: ":rain_cloud: Build Failed for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME")
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rpm: dist

dist:
rm -rf dist
python setup.py sdist
python3 setup.py sdist
mv -f dist/${PKGNAME}-${PKGVERSION}.tar.gz .
rm -rf dist

Expand Down
69 changes: 20 additions & 49 deletions argo-nagios-ams-publisher.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

%define underscore() %(echo %1 | sed 's/-/_/g')
%define stripc() %(echo %1 | sed 's/el7.centos/el7/')

%if 0%{?el7:1}
%define mydist %{stripc %{dist}}
%else
%define mydist %{dist}
%endif

Name: argo-nagios-ams-publisher
Version: 0.3.8
Version: 0.3.9
Release: 1%{mydist}
Summary: Bridge from Nagios to the ARGO Messaging system

Expand All @@ -21,20 +16,17 @@ Source0: %{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel
Requires: argo-ams-library
Requires: avro
Requires: python-argparse
Requires: python-daemon
Requires: python-dirq
Requires: python-messaging
Requires: pytz

%if 0%{?el7:1}
Requires: python2-psutil >= 4.3
%else
Requires: python-psutil >= 4.3
%endif
BuildRequires: python3-devel
Requires: python3-argo-ams-library
Requires: python3-avro
Requires: python3-dirq
Requires: python3-messaging
Requires: python36-pytz

Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd


%description
Bridge from Nagios to the ARGO Messaging system
Expand All @@ -43,58 +35,34 @@ Bridge from Nagios to the ARGO Messaging system
%setup -q

%build
%{__python} setup.py build
%{py3_build}

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT --record=INSTALLED_FILES
%{py3_install "--record=INSTALLED_FILES"}
install --directory --mode 755 $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
install --directory --mode 755 $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}/
install --directory --mode 755 $RPM_BUILD_ROOT/%{_localstatedir}/spool/%{name}/metrics/
install --directory --mode 755 $RPM_BUILD_ROOT/%{_localstatedir}/spool/%{name}/alarms/
install --directory --mode 755 $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}/

%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/ams-publisher.conf
%config(noreplace) %{_sysconfdir}/%{name}/metric_data.avsc
%dir %{python_sitelib}/%{underscore %{name}}
%{python_sitelib}/%{underscore %{name}}/*.py[co]
%dir %{python3_sitelib}/%{underscore %{name}}
%{python3_sitelib}/%{underscore %{name}}/*.py
%defattr(-,nagios,nagios,-)
%dir %{_localstatedir}/log/%{name}/
%attr(0755,nagios,nagios) %dir %{_localstatedir}/run/%{name}/
%dir %{_localstatedir}/spool/%{name}/

%post
%if 0%{?el7:1}
%systemd_postun_with_restart ams-publisher.service
%else
/sbin/chkconfig --add ams-publisher
if [[ "$1" == 2 ]]
then
/sbin/service ams-publisher condrestart > /dev/null 2>&1
fi
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%if 0%{?el7:1}
%systemd_preun ams-publisher.service
%else
if [ "$1" = 0 ]; then
/sbin/service ams-publisher stop > /dev/null 2>&1
/sbin/chkconfig --del ams-publisher
fi
exit 0
%endif

%postun
if [ "$1" = 0 ]; then
test -d %{_localstatedir}/run/%{name}/ && rm -rf %{_localstatedir}/run/%{name}/
fi
exit 0

%pre
if ! /usr/bin/id nagios &>/dev/null; then
Expand All @@ -107,8 +75,11 @@ if ! /usr/bin/getent group nagiocmd &>/dev/null; then
fi

%changelog
* Mon Feb 1 2021 Daniel Vrcic <[email protected]> - 0.3.9-1%{?dist}
- ARGO-2855 ams-publisher py3 switch
- ARGO-2929 Let systemd handle runtime directory
* Thu Oct 8 2020 Daniel Vrcic <[email protected]> - 0.3.8-1%{?dist}
- remove leftovers from erroneous SIGHUP handling
- remove leftovers from erroneous SIGHUP handling
* Wed Jul 8 2020 Daniel Vrcic <[email protected]> - 0.3.7-1%{?dist}
- ARGO-2378 RPM post install should restart service not stop it
- ARGO-844 Complete README for ams-publisher
Expand Down
2 changes: 1 addition & 1 deletion bin/ams-alarm-to-queue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python3

from argo_nagios_ams_publisher import alarmtoqueue

Expand Down
2 changes: 1 addition & 1 deletion bin/ams-metric-to-queue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python3

from argo_nagios_ams_publisher import metrictoqueue

Expand Down
Loading

0 comments on commit c536b31

Please sign in to comment.