Fix config parser warning

/usr/lib/python3.6/site-packages/tripleo_common/actions/ansible.py:154:
DeprecationWarning: This method will be removed in future versions.  Use
'parser.read_file()' instead.
  config.readfp(sio_cfg)

Note: this backport has been adjusted to work on python2 as well; which
is still very well supported in stable/train.

Change-Id: Ibd33a26feae03e4f0d46370346b7a950d1f6b02c
(cherry picked from commit 781233af1a)
This commit is contained in:
Alex Schultz 2020-08-19 13:55:48 -06:00 committed by Emilien Macchi
parent 5397e9eb4f
commit 74ab9401d2
1 changed files with 4 additions and 1 deletions

View File

@ -148,7 +148,10 @@ def write_default_ansible_cfg(work_dir,
sio_cfg = StringIO()
sio_cfg.write(override_ansible_cfg)
sio_cfg.seek(0)
config.readfp(sio_cfg)
if sys.version_info[0] < 3:
config.readfp(sio_cfg)
else:
config.read_file(sio_cfg)
sio_cfg.close()
with open(ansible_config_path, 'w') as configfile: