#20 inventory: Don't send 'yum' output to stdout
Merged 6 years ago by merlinm. Opened 6 years ago by stefw.
stefw/standard-test-roles yum-to-stderr  into  master

@@ -58,7 +58,7 @@ 

      install = [ "/usr/bin/yum", "-y", "install" ] + rpms

  

      try:

-         subprocess.check_call(install)

+         subprocess.check_call(install, stdout=sys.stderr.fileno())

      except subprocess.CalledProcessError:

          raise RuntimeError("could not install rpms: {0}".format(rpms))

  

The 'yum' command writes some output to stdout. This interferes
with the inventory script's output of JSON on its stdout. So
force all yum output to stderr. This is helpful for those invoking
the scripts as well.

[root@falcon gzip]# export TEST_SUBJECTS=gzip.rpm
[root@falcon gzip]# ansible-playbook tests.yml
Package gzip-1.8-2.fc26.x86_64 is already installed, skipping.

ERROR! Attempted to execute "/etc/ansible/inventory/standard-inventory-rpm" as inventory script: failed to parse executable inventory script results from /etc/ansible/inventory/standard-inventory-rpm: Syntax Error while loading YAML.


The error appears to have been in '<string>': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

Pull-Request has been merged by merlinm

6 years ago
Metadata