commit
ccceae6835
@ -0,0 +1,3 @@
|
|||||||
|
SOURCES/ansible-collection-ansible-posix-1.3.0.tar.gz
|
||||||
|
SOURCES/ansible-collection-community-general-4.4.0.tar.gz
|
||||||
|
SOURCES/rhc-worker-playbook-0.1.8.tar.gz
|
@ -0,0 +1,3 @@
|
|||||||
|
7027d309191f35d3dafb3fc37d9fe25b195ef769 SOURCES/ansible-collection-ansible-posix-1.3.0.tar.gz
|
||||||
|
1f333c73866dd59f120a3576ab701555d0e9bdf5 SOURCES/ansible-collection-community-general-4.4.0.tar.gz
|
||||||
|
e1db71388a14032b902941426a0ab0dda71b2f43 SOURCES/rhc-worker-playbook-0.1.8.tar.gz
|
@ -0,0 +1,49 @@
|
|||||||
|
From 332d28d1bb636a5dc8ff5ddf3da8359a9a78b297 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Link Dupont <link@sub-pop.net>
|
||||||
|
Date: Wed, 5 May 2021 14:10:49 -0400
|
||||||
|
Subject: [PATCH] fix: Execute playbook asynchronously
|
||||||
|
|
||||||
|
Run the playbook code in a coroutine that's scheduled onto a new event loop. Return a protobuf.Receipt message in the WorkerService Send implementation.
|
||||||
|
---
|
||||||
|
rhc_worker_playbook/server.py | 10 +++++++---
|
||||||
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rhc_worker_playbook/server.py b/rhc_worker_playbook/server.py
|
||||||
|
index 985ea98..8fa393f 100644
|
||||||
|
--- a/rhc_worker_playbook/server.py
|
||||||
|
+++ b/rhc_worker_playbook/server.py
|
||||||
|
@@ -16,6 +16,7 @@ import time
|
||||||
|
import json
|
||||||
|
import uuid
|
||||||
|
import atexit
|
||||||
|
+import asyncio
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
from requests import Request
|
||||||
|
from concurrent import futures
|
||||||
|
@@ -135,9 +136,13 @@ class WorkerService(yggdrasil_pb2_grpc.WorkerServicer):
|
||||||
|
'''
|
||||||
|
Act on messages sent to the WorkerService
|
||||||
|
'''
|
||||||
|
- # we have received it
|
||||||
|
- yggdrasil_pb2.Receipt()
|
||||||
|
|
||||||
|
+ loop = asyncio.new_event_loop()
|
||||||
|
+ loop.run_until_complete(self._run_data(request))
|
||||||
|
+
|
||||||
|
+ return yggdrasil_pb2.Receipt()
|
||||||
|
+
|
||||||
|
+ async def _run_data(self, request):
|
||||||
|
# load configuration
|
||||||
|
config = _loadConfig()
|
||||||
|
|
||||||
|
@@ -256,7 +261,6 @@ class WorkerService(yggdrasil_pb2_grpc.WorkerServicer):
|
||||||
|
_log("Posting events...")
|
||||||
|
response = self.dispatcher.Send(returnedEvents)
|
||||||
|
_log("Post complete.")
|
||||||
|
- return
|
||||||
|
|
||||||
|
def serve():
|
||||||
|
# load config to get directive
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,149 @@
|
|||||||
|
%define debug_package %{nil}
|
||||||
|
%define community_general_version 4.4.0
|
||||||
|
%define ansible_posix_version 1.3.0
|
||||||
|
|
||||||
|
Name: rhc-worker-playbook
|
||||||
|
Version: 0.1.8
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Python worker for Red Hat connector that launches Ansible Runner
|
||||||
|
License: GPLv2+
|
||||||
|
URL: https://github.com/redhatinsights/rhc-worker-playbook
|
||||||
|
Source: rhc-worker-playbook-0.1.8.tar.gz
|
||||||
|
Source1: https://github.com/ansible-collections/community.general/archive/%{community_general_version}/ansible-collection-community-general-%{community_general_version}.tar.gz
|
||||||
|
Source2: https://github.com/ansible-collections/ansible.posix/archive/%{ansible_posix_version}/ansible-collection-ansible-posix-%{ansible_posix_version}.tar.gz
|
||||||
|
|
||||||
|
# Fixed upstream https://github.com/RedHatInsights/rhc-worker-playbook/commit/332d28d1bb636a5dc8ff5ddf3da8359a9a78b297
|
||||||
|
Patch0001: 0001-fix-Execute-playbook-asynchronously.patch
|
||||||
|
|
||||||
|
%{?__python3:Requires: %{__python3}}
|
||||||
|
Requires: insights-client
|
||||||
|
Requires: python3dist(requests)
|
||||||
|
Requires: python3dist(pyyaml)
|
||||||
|
Requires: ansible-core
|
||||||
|
BuildRequires: rhc
|
||||||
|
BuildRequires: pkgconfig
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3dist(pip)
|
||||||
|
BuildRequires: python3dist(wheel)
|
||||||
|
BuildRequires: python3dist(setuptools)
|
||||||
|
BuildRequires: openssl-devel
|
||||||
|
BuildRequires: c-ares-devel
|
||||||
|
BuildRequires: zlib-devel
|
||||||
|
BuildRequires: python3dist(cython)
|
||||||
|
BuildRequires: gcc
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
|
||||||
|
ExclusiveArch: x86_64 s390x ppc64 ppc64le
|
||||||
|
|
||||||
|
%description
|
||||||
|
Python-based worker for Red Hat connect, used to launch Ansible playbooks via Ansible Runner.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -a1 -a2 -n %{name}-%{version}
|
||||||
|
%patch0001 -p1
|
||||||
|
pushd community.general-%{community_general_version}
|
||||||
|
rm -vr .github .azure-pipelines
|
||||||
|
rm -rvf tests/ hacking/
|
||||||
|
find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
|
||||||
|
find -type f -name '.gitignore' -print -delete
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd ansible.posix-%{ansible_posix_version}
|
||||||
|
rm -vr tests/{integration,utils} .github changelogs/fragments/.keep {test-,}requirements.txt shippable.yml
|
||||||
|
rm -vr .azure-pipelines
|
||||||
|
rm -rvf tests/
|
||||||
|
find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
|
||||||
|
find -type f -name '.gitignore' -print -delete
|
||||||
|
popd
|
||||||
|
|
||||||
|
%build
|
||||||
|
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
|
||||||
|
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
|
||||||
|
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
|
||||||
|
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
|
||||||
|
export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=True
|
||||||
|
# TODO(gchamoul): Remove workaround
|
||||||
|
# once https://bugzilla.redhat.com/show_bug.cgi?id=2056959 is fixed
|
||||||
|
#%define rhc_config_dir $(pkg-config rhc --variable workerconfdir)
|
||||||
|
%define rhc_config_dir /etc/rhc/workers
|
||||||
|
|
||||||
|
%define _lto_cflags %{nil}
|
||||||
|
%set_build_flags
|
||||||
|
%{__make} PREFIX=%{_prefix} LIBDIR=%{_libdir} CONFIG_DIR=%{rhc_config_dir} PYTHON_PKGDIR=%{python3_sitelib} installed-lib-dir
|
||||||
|
%{make_build} build
|
||||||
|
|
||||||
|
# Building the Ansible Collections
|
||||||
|
pushd community.general-%{community_general_version}
|
||||||
|
tar -cf %{_tmppath}/community-general-%{community_general_version}.tar.gz .
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd ansible.posix-%{ansible_posix_version}
|
||||||
|
tar -cf %{_tmppath}/ansible-posix-%{ansible_posix_version}.tar.gz .
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{make_install} PREFIX=%{_prefix} LIBDIR=%{_libdir} CONFIG_DIR=%{rhc_config_dir} PYTHON_PKGDIR=%{python3_sitelib}
|
||||||
|
|
||||||
|
# Installing the Ansible Collections
|
||||||
|
mkdir -p %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general
|
||||||
|
mkdir -p %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix
|
||||||
|
|
||||||
|
pushd %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general
|
||||||
|
tar -xf %{_tmppath}/community-general-%{community_general_version}.tar.gz
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix
|
||||||
|
tar -xf %{_tmppath}/ansible-posix-%{ansible_posix_version}.tar.gz
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Creating the logs directory for ansible-runner
|
||||||
|
mkdir -p %{buildroot}%{_localstatedir}/log/rhc-worker-playbook/ansible/
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_libexecdir}/rhc/rhc-worker-playbook.worker
|
||||||
|
%{python3_sitelib}/rhc_worker_playbook/
|
||||||
|
%{python3_sitelib}/rhc_worker_playbook*.egg-info/
|
||||||
|
%{_libdir}/rhc-worker-playbook/
|
||||||
|
%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/
|
||||||
|
%{_localstatedir}/log/rhc-worker-playbook/ansible/
|
||||||
|
%config(noreplace) %{_sysconfdir}/rhc/workers/rhc-worker-playbook.toml
|
||||||
|
|
||||||
|
%doc
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Mar 15 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 0.1.8-1
|
||||||
|
- Rebuilt for MSVSphere 9.1.
|
||||||
|
|
||||||
|
* Mon Feb 21 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 0.1.8-1
|
||||||
|
- Patch to fix Execute Playbook Asynchronously (RHBZ#2056862)
|
||||||
|
|
||||||
|
* Thu Feb 17 2022 Alba Hita <ahitacat@redhat.com> - 0.1.8-0
|
||||||
|
- Fix: Bump ansible-runner to 2.1.1 and dependencies in vendor (RHBZ#2053212)
|
||||||
|
- Upload new rhc-worker-playbook-0.1.8.tar.gz source
|
||||||
|
|
||||||
|
* Thu Feb 03 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 0.1.7-0
|
||||||
|
- Add Ansible community general and ansible.posix Collections
|
||||||
|
- New Upstream Version
|
||||||
|
|
||||||
|
* Mon Nov 1 2021 Link Dupont <link@redhat.com> - 0.1.6-3
|
||||||
|
- Disable LTO due to RHBZ#1893533
|
||||||
|
|
||||||
|
* Thu Sep 23 2021 Link Dupont <link@redhat.com> - 0.1.6-2
|
||||||
|
- Ensure build flags are exported to the build environment
|
||||||
|
|
||||||
|
* Thu Aug 26 2021 Link Dupont <link@redhat.com> - 0.1.6-1
|
||||||
|
- New upstream version
|
||||||
|
|
||||||
|
* Fri Aug 6 2021 Link Dupont <link@redhat.com> - 0.1.5^0.9ef03b90.wtree.0663ne
|
||||||
|
- New upstream version
|
||||||
|
|
||||||
|
* Mon Apr 19 2021 Jeremy Crafts <jcrafts@redhat.com> - 0.1.5-1
|
||||||
|
- Changes to playbook validation logic
|
||||||
|
- Enhancements for logging to rhcd
|
||||||
|
- Fix for subprocess environment
|
||||||
|
|
||||||
|
* Thu Mar 25 2021 Jeremy Crafts <jcrafts@redhat.com> - 0.1.4-1
|
||||||
|
- Enhancements to playbook validation
|
||||||
|
- Fixes for regular execution status updates
|
||||||
|
- Configuration fixes
|
Loading…
Reference in new issue