From 91aeca591ee4ae491a40c5f5e415d477b019fe4d Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Sep 10 2019 18:57:13 +0000 Subject: Revert "Update to 1.1.0" This reverts commit 98e92818e6fe922e272f4f1c5c3b508327c8ea34. Pushed to wrong branch. --- diff --git a/.gitignore b/.gitignore index ada6c69..8a73892 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /ara-0.14.0.tar.gz /ara-0.14.6.tar.gz /ara-0.16.1.tar.gz -/ara-1.1.0.tar.gz diff --git a/ara-0.16.1.tar.gz b/ara-0.16.1.tar.gz new file mode 100644 index 0000000..08dff98 Binary files /dev/null and b/ara-0.16.1.tar.gz differ diff --git a/ara-server.service b/ara-server.service new file mode 100644 index 0000000..ccff451 --- /dev/null +++ b/ara-server.service @@ -0,0 +1,17 @@ +[unit] +Description=ara-server +Documentation=https://github.com/openstack/ara +After=network.target + +[Service] +Type=simple +TimeoutStartSec=0 +Restart=on-failure +RestartSec=10 +RemainAfterExit=yes +User=ara +Environment=ANSIBLE_CONFIG=/etc/ara/ara.cfg +ExecStart=/usr/bin/ara-manage runserver + +[Install] +WantedBy=multi-user.target diff --git a/ara.cfg b/ara.cfg new file mode 100644 index 0000000..9901032 --- /dev/null +++ b/ara.cfg @@ -0,0 +1,11 @@ +[defaults] +# This directory is required to store temporary files for Ansible and ARA +local_tmp = /var/lib/ara/.ansible/tmp + +[ara] +# ARA-specific configuration +# http://ara.readthedocs.io/en/latest/configuration.html +database = sqlite:////var/lib/ara/ansible.sqlite +logconfig = /etc/ara/logging-config.yaml +host = 127.0.0.1 +port = 9191 diff --git a/ara.logrotate b/ara.logrotate new file mode 100644 index 0000000..35c0fd2 --- /dev/null +++ b/ara.logrotate @@ -0,0 +1,7 @@ +/var/log/ara/*.log { + rotate 14 + size 10M + missingok + compress + copytruncate +} diff --git a/ara.spec b/ara.spec index c807243..9351ac8 100644 --- a/ara.spec +++ b/ara.spec @@ -1,83 +1,117 @@ -%global srcname ara +%global package_name ara -Name: %{srcname} -Version: 1.1.0 -Release: 1%{?dist} -Summary: ARA Records Ansible playbooks and makes them easier to understand and troubleshoot. +%global common_desc \ +ARA Records Ansible playbook runs and makes the recorded data available and \ +intuitive for users and systems. + +Name: %{package_name} +Version: 0.16.1 +Release: 4%{?dist} +Summary: ARA Records Ansible playbook runs License: GPLv3 -URL: https://github.com/ansible-community/ara -Source0: https://pypi.io/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz +URL: https://git.openstack.org/cgit/openstack/ara +Source0: https://pypi.io/packages/source/a/%{package_name}/%{package_name}-%{version}.tar.gz +Source1: ara-server.service +Source2: ara.cfg +Source3: logging-config.yaml +Source4: ara.logrotate BuildArch: noarch +%{?systemd_requires} +BuildRequires: systemd BuildRequires: git -Requires: python3-%{srcname} = %{version}-%{release} -Requires: %{srcname}-common = %{version}-%{release} +Requires: python3-%{package_name} = %{version}-%{release} +Requires: %{package_name}-common = %{version}-%{release} %description -%{summary} - -It provides Ansible plugins to record Ansible playbooks to a local or remote -database and an API to query and browse playbook results. +%{common_desc} -%package -n python3-%{srcname} +%package -n python3-%{package_name} Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-pbr +BuildRequires: python3-setuptools +# Test dependencies for check macro +BuildRequires: ansible >= 2.4.0.0 +BuildRequires: python3-cliff +BuildRequires: python3-flask >= 0.12.4 +BuildRequires: python3-flask-migrate +BuildRequires: python3-flask-script +BuildRequires: python3-frozen-flask +BuildRequires: python3-jinja2 >= 2.9 +BuildRequires: python3-junit_xml +BuildRequires: python3-lxml +BuildRequires: python3-mock +BuildRequires: python3-oslo-serialization +BuildRequires: python3-oslo-utils +BuildRequires: python3-pyfakefs +BuildRequires: python3-pygments >= 1.6 +BuildRequires: python3-pytest +BuildRequires: python3-six +BuildRequires: python3-sqlalchemy +BuildRequires: python3-subunit +BuildRequires: python3-XStatic +BuildRequires: python3-XStatic-Bootstrap-SCSS +BuildRequires: python3-XStatic-DataTables +BuildRequires: python3-XStatic-jQuery +BuildRequires: python3-XStatic-Patternfly +BuildRequires: python3-XStatic-Patternfly-Bootstrap-Treeview + +Requires: ansible >= 2.4.0.0 +Requires: python3-cliff +Requires: python3-flask >= 0.12.4 +Requires: python3-flask-migrate +Requires: python3-flask-script +Requires: python3-frozen-flask +Requires: python3-jinja2 >= 2.9 +Requires: python3-junit_xml +Requires: python3-oslo-serialization +Requires: python3-oslo-utils +Requires: python3-pyfakefs +Requires: python3-pygments >= 1.6 +Requires: python3-six +Requires: python3-sqlalchemy +Requires: python3-subunit +Requires: python3-XStatic +Requires: python3-XStatic-Bootstrap-SCSS +Requires: python3-XStatic-DataTables +Requires: python3-XStatic-jQuery +Requires: python3-XStatic-Patternfly +Requires: python3-XStatic-Patternfly-Bootstrap-Treeview + +%{?python_provide:%python_provide python3-%{package_name}} + +%description -n python3-%{package_name} +%{common_desc} -Requires: python3-requests - -%{?python_provide:%python_provide python3-%{srcname}} +%package -n python3-%{package_name}-tests +Summary: Tests for %{package_name} -%description -n python3-%{srcname} -%{summary} +Requires: python3-%{package_name} = %{version}-%{release} +Requires: python3-lxml +Requires: python3-mock +Requires: python3-pytest -This package contains the python files and Ansible plugins for ARA. +%description -n python3-%{package_name}-tests +%{common_desc} -%package -n python3-%{srcname}-server -Summary: %{summary} +This package contains the test files. -# Test dependencies for check macro -BuildRequires: python3-django -BuildRequires: python3-django-cors-headers -BuildRequires: python3-django-filter -BuildRequires: python3-django-rest-framework -BuildRequires: python3-dynaconf -BuildRequires: python3-factory-boy -BuildRequires: python3-faker -BuildRequires: python3-PyYAML -BuildRequires: python3-whitenoise - -Requires: python3-%{srcname} -Requires: python3-django -Requires: python3-django-cors-headers -Requires: python3-django-filter -Requires: python3-django-rest-framework -Requires: python3-dynaconf -Requires: python3-PyYAML -Requires: python3-whitenoise - -%description -n python3-%{srcname}-server -%{summary} - -This package installs the necessary dependencies to run the ARA API server. - -%package -n python3-%{srcname}-tests -Summary: %{summary} +%package common +Summary: Common files for %{package_name} -Requires: python3-%{srcname}-server = %{version}-%{release} -Requires: python3-factory-boy -Requires: python3-faker +Requires(pre): shadow-utils -%description -n python3-%{srcname}-tests -%{summary} +%description common +%{common_desc} -This package installs the necessary test dependencies and contains the test files. +This package contains the common files. %package doc -Summary: %{summary} +Summary: Documentation for %{package_name} BuildRequires: python3-sphinx BuildRequires: python3-sphinx_rtd_theme @@ -85,52 +119,91 @@ BuildRequires: python3-sphinx_rtd_theme %description doc %{common_desc} -This package installs the documentation files. +This package contains the documentation. %prep -%autosetup -n %{srcname}-%{version} -S git +%autosetup -n %{package_name}-%{version} -S git + +# Let RPM handle the requirements +rm -f {,test-}requirements.txt %build %py3_build +# Disable warning detection as failures: https://review.openstack.org/#/c/491202/ +# sphinx-build -W -b html doc/source doc/build/html sphinx-build -b html doc/source doc/build/html %install %py3_install +# Setup directories +install -d -m 755 %{buildroot}%{_sysconfdir}/%{package_name} +install -d -m 755 %{buildroot}%{_sharedstatedir}/%{package_name} +install -d -m 755 %{buildroot}%{_localstatedir}/log/%{package_name} + +# Setup systemd unit file +install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{package_name}-server.service + +# Setup default config +install -p -D -m 640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{package_name}/%{package_name}.cfg +install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{package_name}/logging-config.yaml + +# Setup logrotate +install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{package_name} + %check # Run unit tests -cd %{_builddir}/%{srcname}-%{version} -%{__python3} manage.py test %{srcname} +%{__python3} -m pytest -v + +%pre common +getent group %{package_name} >/dev/null || groupadd -r %{package_name} +getent passwd %{package_name} >/dev/null || \ + useradd -r -g %{package_name} -d %{_sharedstatedir}/%{package_name} \ + -s /sbin/nologin -c "User for ARA" %{package_name} +exit 0 + +%post +%systemd_post %{package_name}-server.service + +%preun +%systemd_preun %{package_name}-server.service + +%postun +%systemd_postun_with_restart %{package_name}-server.service %files %doc README.rst %license LICENSE +%{_bindir}/ara* +%{_unitdir}/%{package_name}-server.service -%files -n python3-%{srcname} +%files -n python3-%{package_name} %doc README.rst %license LICENSE -%{python3_sitelib}/%{srcname} -%{python3_sitelib}/%{srcname}-*.egg-info -%exclude %{python3_sitelib}/%{srcname}/api/tests +%{python3_sitelib}/%{package_name} +%{python3_sitelib}/%{package_name}-*.egg-info +%exclude %{python3_sitelib}/%{package_name}/tests -%files -n python3-%{srcname}-server +%files -n python3-%{package_name}-tests %doc README.rst %license LICENSE -%{_bindir}/ara-manage +%{python3_sitelib}/%{package_name}/tests -%files -n python3-%{srcname}-tests +%files common %doc README.rst %license LICENSE -%{python3_sitelib}/%{srcname}/api/tests +%dir %{_sysconfdir}/%{package_name} +%config(noreplace) %attr(0640, root, %{package_name}) %{_sysconfdir}/%{package_name}/%{package_name}.cfg +%config(noreplace) %attr(0644, root, %{package_name}) %{_sysconfdir}/%{package_name}/logging-config.yaml +%config(noreplace) %{_sysconfdir}/logrotate.d/%{package_name} +%dir %attr(0750, %{package_name}, %{package_name}) %{_localstatedir}/log/%{package_name} +%dir %attr(0750, %{package_name}, %{package_name}) %{_sharedstatedir}/%{package_name} %files doc %doc README.rst doc/build/html %license LICENSE %changelog -* Tue Sep 10 2019 David Moreau Simard - 1.1.0-1 -- Update to latest upstream release - * Wed Jul 24 2019 Fedora Release Engineering - 0.16.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/logging-config.yaml b/logging-config.yaml new file mode 100644 index 0000000..e865d8e --- /dev/null +++ b/logging-config.yaml @@ -0,0 +1,43 @@ +--- +version: 1 +disable_existing_loggers: false +formatters: + ara_standard: + format: '%(asctime)s %(levelname)s %(name)s: %(message)s' +handlers: + ara_console: + class: logging.StreamHandler + formatter: ara_standard + level: INFO + stream: ext://sys.stdout + ara_file: + class: logging.handlers.TimedRotatingFileHandler + formatter: ara_standard + level: INFO + filename: '/var/log/ara/ara.log' + when: 'midnight' + interval: 1 + backupCount: 30 +loggers: + ara: + handlers: + - ara_file + level: INFO + propagate: 0 + alembic: + handlers: + - ara_console + - ara_file + level: WARN + propagate: 0 + sqlalchemy.engine: + handlers: + - ara_file + level: WARN + propagate: 0 + werkzeug: + handlers: + - ara_console + - ara_file + level: INFO + propagate: 0 diff --git a/sources b/sources index 35f4244..b91742d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ara-1.1.0.tar.gz) = 373946b4b743cd033136f30b07bf4907ce6189c6295e4df0aa0154939ae7ff9271cf846c67b9d5a2836c9e73e11041bd603cfce9879f90835ce7dfc7db4a4dfb +SHA512 (ara-0.16.1.tar.gz) = e34077342b47338e87d102ade1cd7e7b3eff1f4c8ff8f88f1736dbb12a302c89a37602bbee6d35ee733afb12e816bc94ed3d55cb08131b543381c63f29b2a17c