mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #22810 from basepi/salt-ssh.more.msgpack.gating
[2014.7] More msgpack gating for salt-ssh
This commit is contained in:
commit
fe1de89ad7
3 changed files with 15 additions and 6 deletions
|
@ -47,7 +47,7 @@ def load():
|
|||
datastore_path = os.path.join(__opts__['cachedir'], 'datastore')
|
||||
fn_ = salt.utils.fopen(datastore_path, 'rb')
|
||||
return serial.load(fn_)
|
||||
except (IOError, OSError):
|
||||
except (IOError, OSError, NameError):
|
||||
return {}
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ def dump(new_data):
|
|||
|
||||
return True
|
||||
|
||||
except (IOError, OSError):
|
||||
except (IOError, OSError, NameError):
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -522,7 +522,11 @@ def find_cached_job(jid):
|
|||
buf = fp_.read()
|
||||
fp_.close()
|
||||
if buf:
|
||||
data = serial.loads(buf)
|
||||
try:
|
||||
data = serial.loads(buf)
|
||||
except NameError:
|
||||
# msgpack error in salt-ssh
|
||||
return
|
||||
else:
|
||||
return
|
||||
if not isinstance(data, dict):
|
||||
|
|
|
@ -272,7 +272,8 @@ def _load_accumulators():
|
|||
with open(path, 'rb') as f:
|
||||
loaded = serial.load(f)
|
||||
return loaded if loaded else ret
|
||||
except IOError:
|
||||
except (IOError, NameError):
|
||||
# NameError is a msgpack error from salt-ssh
|
||||
return ret
|
||||
|
||||
loaded = _deserialize(_get_accumulator_filepath())
|
||||
|
@ -286,8 +287,12 @@ def _persist_accummulators(accumulators, accumulators_deps):
|
|||
'accumulators_deps': accumulators_deps}
|
||||
|
||||
serial = salt.payload.Serial(__opts__)
|
||||
with open(_get_accumulator_filepath(), 'w+b') as f:
|
||||
serial.dump(accumm_data, f)
|
||||
try:
|
||||
with open(_get_accumulator_filepath(), 'w+b') as f:
|
||||
serial.dump(accumm_data, f)
|
||||
except NameError:
|
||||
# msgpack error from salt-ssh
|
||||
pass
|
||||
|
||||
|
||||
def _check_user(user, group):
|
||||
|
|
Loading…
Add table
Reference in a new issue