1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

onepassword_info: replace subprocess.Popen() with run_command() (#11193)

* onepassword_info: replace subprocess.Popen() with run_command()

* add changelog frag

* Update plugins/modules/onepassword_info.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2025-11-25 09:11:24 +13:00 committed by GitHub
parent 64dc009ea7
commit f2731e1dac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- onepassword_info - execute external commands using Ansible construct (https://github.com/ansible-collections/community.general/pull/11193).

View file

@ -159,8 +159,6 @@ import json
import os
import re
from subprocess import Popen, PIPE
from ansible.module_utils.common.text.converters import to_bytes, to_native
from ansible.module_utils.basic import AnsibleModule
@ -193,9 +191,7 @@ class OnePasswordInfo:
args += [to_bytes("--session=") + self.token]
command = [self.cli_path] + args
p = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE)
out, err = p.communicate(input=command_input)
rc = p.wait()
rc, out, err = module.run_command(command, data=command_input, check_rc=False, binary_data=True, encoding=None)
if not ignore_errors and rc != expected_rc:
raise AnsibleModuleError(to_native(err))
return rc, out, err