1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixes usage of popen in bigip iapplx package (#41612)

This functionality is superceeded by the run_command method in the
ansible module class.
This commit is contained in:
Tim Rupp 2018-06-15 15:41:57 -07:00 committed by GitHub
parent 5c614a59a6
commit 16466f3171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -148,11 +148,10 @@ class Parameters(AnsibleF5Parameters):
:return:
"""
cmd = ['rpm', '-qp', '--queryformat', '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}', self.package]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
if not stdout:
rc, out, err = self._module.run_command(cmd)
if not out:
return str(self.package_file)
return stdout.decode('utf-8')
return out
@property
def package_root(self):
@ -177,7 +176,7 @@ class ModuleManager(object):
def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None)
self.want = Parameters(params=self.module.params)
self.want = Parameters(module=self.module, params=self.module.params)
self.changes = Parameters()
def exec_module(self):

View file

@ -84,7 +84,7 @@ class TestManager(unittest.TestCase):
set_module_args(dict(
content='fixtures/MyApp-0.1.0-0001.noarch.rpm',
state='present',
password='passsword',
password='password',
server='localhost',
user='admin'
))