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

View file

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