fix starting proxy minion on py3

This commit is contained in:
Daniel Wallace 2017-12-13 13:44:56 -07:00
parent e2824a7253
commit 8736e21f65
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48

View file

@ -9,8 +9,9 @@ import os
import pickle
import logging
# Import Salt modules
import salt.utils.files
# Import Salt libs
import salt.ext.six as six
import salt.utils
# This must be present or the Salt loader won't load this module
__proxyenabled__ = ['dummy']
@ -45,9 +46,13 @@ def _save_state(details):
def _load_state():
try:
pck = open(FILENAME, 'r') # pylint: disable=W8470
DETAILS = pickle.load(pck)
pck.close()
if six.PY3 is True:
mode = 'rb'
else:
mode = 'r'
with salt.utils.fopen(FILENAME, mode) as pck:
DETAILS = pickle.load(pck)
except EOFError:
DETAILS = {}
DETAILS['initialized'] = False