diff --git a/salt/states/apache.py b/salt/states/apache.py index 3607903f74..0f6b3ed472 100644 --- a/salt/states/apache.py +++ b/salt/states/apache.py @@ -43,6 +43,9 @@ from __future__ import with_statement, print_function # Import python libs import os.path +# Import Salt libs +import salt.utils + def __virtual__(): return 'apache.config' in __salt__ @@ -57,7 +60,7 @@ def configfile(name, config): configs = __salt__['apache.config'](name, config, edit=False) current_configs = '' if os.path.exists(name): - with open(name) as config_file: + with salt.utils.fopen(name) as config_file: current_configs = config_file.read() if configs == current_configs.strip(): @@ -74,7 +77,7 @@ def configfile(name, config): return ret try: - with open(name, 'w') as config_file: + with salt.utils.fopen(name, 'w') as config_file: print(configs, file=config_file) ret['changes'] = { 'old': current_configs,