Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ansible-runner for openSUSE:Factory 
checked in at 2024-03-02 23:24:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ansible-runner (Old)
 and      /work/SRC/openSUSE:Factory/.ansible-runner.new.1770 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ansible-runner"

Sat Mar  2 23:24:05 2024 rev:7 rq:1154264 version:2.3.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/ansible-runner/ansible-runner.changes    
2023-09-07 21:14:52.409879201 +0200
+++ /work/SRC/openSUSE:Factory/.ansible-runner.new.1770/ansible-runner.changes  
2024-03-02 23:24:27.865539527 +0100
@@ -1,0 +2,7 @@
+Wed Feb 14 20:22:04 UTC 2024 - Johannes Kastl 
<opensuse_buildserv...@ojkastl.de>
+
+- update to 2.3.5:
+  * fix pexpect child shutdown race (#1331) by @TheRealHaoLiu in
+    #1336
+
+-------------------------------------------------------------------

Old:
----
  ansible-runner-2.3.4.tar.gz

New:
----
  ansible-runner-2.3.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ansible-runner.spec ++++++
--- /var/tmp/diff_new_pack.b2xfin/_old  2024-03-02 23:24:28.329556335 +0100
+++ /var/tmp/diff_new_pack.b2xfin/_new  2024-03-02 23:24:28.329556335 +0100
@@ -39,7 +39,7 @@
 %endif
 
 Name:           ansible-runner
-Version:        2.3.4
+Version:        2.3.5
 Release:        0
 Summary:        Run ansible-playbook inside an execution environment
 License:        Apache-2.0

++++++ ansible-runner-2.3.4.tar.gz -> ansible-runner-2.3.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-runner-2.3.4/ChangeLog 
new/ansible-runner-2.3.5/ChangeLog
--- old/ansible-runner-2.3.4/ChangeLog  2023-08-29 21:06:25.000000000 +0200
+++ new/ansible-runner-2.3.5/ChangeLog  2024-02-13 20:16:52.000000000 +0100
@@ -1,6 +1,11 @@
 CHANGES
 =======
 
+2.3.5
+-----
+
+* fix pexpect child shutdown race (#1331) (#1336)
+
 2.3.4
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-runner-2.3.4/PKG-INFO 
new/ansible-runner-2.3.5/PKG-INFO
--- old/ansible-runner-2.3.4/PKG-INFO   2023-08-29 21:06:26.759010000 +0200
+++ new/ansible-runner-2.3.5/PKG-INFO   2024-02-13 20:16:52.580576700 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ansible-runner
-Version: 2.3.4
+Version: 2.3.5
 Summary: "Consistent Ansible Python API and CLI with container and process 
isolation runtime capabilities"
 Home-page: https://ansible-runner.readthedocs.io
 Author: Ansible, Inc.
@@ -26,6 +26,12 @@
 Requires-Python: >=3.8
 Description-Content-Type: text/markdown
 License-File: LICENSE.md
+Requires-Dist: pexpect>=4.5
+Requires-Dist: packaging
+Requires-Dist: python-daemon
+Requires-Dist: pyyaml
+Requires-Dist: six
+Requires-Dist: importlib-metadata<6.3,>=4.6; python_version < "3.10"
 
 Ansible Runner
 ==============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-runner-2.3.4/ansible_runner/runner.py 
new/ansible-runner-2.3.5/ansible_runner/runner.py
--- old/ansible-runner-2.3.4/ansible_runner/runner.py   2023-08-29 
21:05:37.000000000 +0200
+++ new/ansible-runner-2.3.5/ansible_runner/runner.py   2024-02-13 
20:16:26.000000000 +0100
@@ -294,10 +294,11 @@
                 child.logfile_read = stdout_handle
             except pexpect.exceptions.ExceptionPexpect as e:
                 child = collections.namedtuple(
-                    'MissingProcess', 'exitstatus isalive close'
+                    'MissingProcess', 'exitstatus isalive expect close'
                 )(
                     exitstatus=127,
                     isalive=lambda: False,
+                    expect=lambda *args, **kwargs: None,
                     close=lambda: None,
                 )
 
@@ -339,9 +340,17 @@
                     Runner.handle_termination(child.pid, is_cancel=False)
                     self.timed_out = True
 
+            # fix for https://github.com/ansible/ansible-runner/issues/1330
+            # Since we're (ab)using pexpect's logging callback as our source 
of stdout data, we need to pump the stream one last
+            # time, in case any new output was written by the child between 
the last return from expect and its termination. Ideally
+            # this would have an arbitrarily large timeout value as well, in 
case a ridiculous amount of data was written, but just
+            # invoking one last pump should cover the vast majority of 
real-world cases.
+            child.expect(pexpect.EOF, timeout=5)
+
+            # close the child to ensure no more output will be written before 
we close the stream interposers
+            child.close()
             stdout_handle.close()
             stderr_handle.close()
-            child.close()
             self.rc = child.exitstatus if not (self.timed_out or 
self.canceled) else 254
 
         if self.canceled:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-runner-2.3.4/ansible_runner.egg-info/PKG-INFO 
new/ansible-runner-2.3.5/ansible_runner.egg-info/PKG-INFO
--- old/ansible-runner-2.3.4/ansible_runner.egg-info/PKG-INFO   2023-08-29 
21:06:25.000000000 +0200
+++ new/ansible-runner-2.3.5/ansible_runner.egg-info/PKG-INFO   2024-02-13 
20:16:52.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ansible-runner
-Version: 2.3.4
+Version: 2.3.5
 Summary: "Consistent Ansible Python API and CLI with container and process 
isolation runtime capabilities"
 Home-page: https://ansible-runner.readthedocs.io
 Author: Ansible, Inc.
@@ -26,6 +26,12 @@
 Requires-Python: >=3.8
 Description-Content-Type: text/markdown
 License-File: LICENSE.md
+Requires-Dist: pexpect>=4.5
+Requires-Dist: packaging
+Requires-Dist: python-daemon
+Requires-Dist: pyyaml
+Requires-Dist: six
+Requires-Dist: importlib-metadata<6.3,>=4.6; python_version < "3.10"
 
 Ansible Runner
 ==============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-runner-2.3.4/ansible_runner.egg-info/SOURCES.txt 
new/ansible-runner-2.3.5/ansible_runner.egg-info/SOURCES.txt
--- old/ansible-runner-2.3.4/ansible_runner.egg-info/SOURCES.txt        
2023-08-29 21:06:26.000000000 +0200
+++ new/ansible-runner-2.3.5/ansible_runner.egg-info/SOURCES.txt        
2024-02-13 20:16:52.000000000 +0100
@@ -146,6 +146,7 @@
 test/fixtures/projects/job_env/inventory/hosts
 test/fixtures/projects/job_env/project/printenv.yml
 
test/fixtures/projects/music/project/roles/Into_The_Mystic/meta/argument_specs.yml
+test/fixtures/projects/pexpect_timeout_data_loss/project/pb.yml
 test/fixtures/projects/printenv/env/envvars
 test/fixtures/projects/printenv/inventory/hosts
 test/fixtures/projects/printenv/project/get_environment.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-runner-2.3.4/ansible_runner.egg-info/pbr.json 
new/ansible-runner-2.3.5/ansible_runner.egg-info/pbr.json
--- old/ansible-runner-2.3.4/ansible_runner.egg-info/pbr.json   2023-08-29 
21:06:25.000000000 +0200
+++ new/ansible-runner-2.3.5/ansible_runner.egg-info/pbr.json   2024-02-13 
20:16:52.000000000 +0100
@@ -1 +1 @@
-{"git_version": "c311e81", "is_release": false}
\ No newline at end of file
+{"git_version": "c129775", "is_release": false}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-runner-2.3.4/test/fixtures/projects/pexpect_timeout_data_loss/project/pb.yml
 
new/ansible-runner-2.3.5/test/fixtures/projects/pexpect_timeout_data_loss/project/pb.yml
--- 
old/ansible-runner-2.3.4/test/fixtures/projects/pexpect_timeout_data_loss/project/pb.yml
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/ansible-runner-2.3.5/test/fixtures/projects/pexpect_timeout_data_loss/project/pb.yml
    2024-02-13 20:16:26.000000000 +0100
@@ -0,0 +1,9 @@
+# part of the regression test for 
https://github.com/ansible/ansible-runner/issues/1330
+
+- hosts: localhost
+  gather_facts: no
+  tasks:
+    # sleep significantly longer than the configured pexpect timeout; the 
cancel callback will inject
+    # additional delay before the next process status sampling interval that 
can cause further output to be lost;
+    # if all is well, we'll do another loop over the child output until it's 
all been consumed...
+    - raw: sleep 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-runner-2.3.4/test/integration/test_runner.py 
new/ansible-runner-2.3.5/test/integration/test_runner.py
--- old/ansible-runner-2.3.4/test/integration/test_runner.py    2023-08-29 
21:05:37.000000000 +0200
+++ new/ansible-runner-2.3.5/test/integration/test_runner.py    2024-02-13 
20:16:26.000000000 +0100
@@ -3,15 +3,16 @@
 import json
 import os
 import re
-import pytest
 import six
 import sys
+import time
 
-from ansible_runner import Runner
+from test.utils.common import iterate_timeout
 
-from ansible_runner.exceptions import AnsibleRunnerException
+import pytest
 
-from test.utils.common import iterate_timeout
+from ansible_runner import Runner, run
+from ansible_runner.exceptions import AnsibleRunnerException
 
 
 @pytest.mark.xfail(reason='Test is unstable')
@@ -281,3 +282,16 @@
         with open(os.path.join(rc.artifact_dir, 'stdout')) as f:
             if 'hello there' in f.read():
                 break
+
+
+# regression test for https://github.com/ansible/ansible-runner/issues/1330
+def test_pexpect_timeout(project_fixtures):
+    r = run(
+        private_data_dir=str(project_fixtures / 'pexpect_timeout_data_loss'),
+        playbook='pb.yml',
+        settings={"pexpect_timeout": 0.1},  # set the pexpect timeout very low
+        cancel_callback=lambda: time.sleep(3) or False,  # induce enough delay 
in the child polling loop that the child will exit before being polled again
+    )
+
+    # ensure we got playbook_on_stats; if pexpect ate it, we won't...
+    assert any(ev for ev in r.events if ev.get('event', None) == 
'playbook_on_stats')

Reply via email to