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

Test for the existance of a file that might not be present on older RHEL.

This commit is contained in:
Michael DeHaan 2013-04-30 09:26:04 -04:00
parent 627a84387e
commit 2cf30148ba

View file

@ -1096,7 +1096,9 @@ class LinuxNetwork(Network):
primary = open(os.path.join(path, 'bonding', 'primary')).read() primary = open(os.path.join(path, 'bonding', 'primary')).read()
if primary: if primary:
interfaces[device]['primary'] = primary interfaces[device]['primary'] = primary
interfaces[device]['all_slaves_active'] = open(os.path.join(path, 'bonding', 'all_slaves_active')).read() == '1' path = os.path.join(path, 'bonding', 'all_slaves_active')
if os.path.exists(path):
interfaces[device]['all_slaves_active'] = open(path).read() == '1'
output = subprocess.Popen(['/sbin/ip', 'addr', 'show', device], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] output = subprocess.Popen(['/sbin/ip', 'addr', 'show', device], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
for line in output.split('\n'): for line in output.split('\n'):