def _get_jid_snapshots(jid, config='root'):
 jid_snapshots = [x for x in list_snapshots(config) if (x['userdata'].get('salt_jid') == jid)]
 pre_snapshot = [x for x in jid_snapshots if (x['type'] == 'pre')]
 post_snapshot = [x for x in jid_snapshots if (x['type'] == 'post')]
 if ((not pre_snapshot) or (not post_snapshot)):
  raise CommandExecutionError("Jid '{0}' snapshots not found".format(jid))
 return (pre_snapshot[0]['id'], post_snapshot[0]['id'])

def _get_jid_snapshots ( jid , config = 'root' ) : jid_snapshots = [ x for x in list_snapshots ( config ) if ( x [ 'userdata' ] . get ( 'salt_jid' ) == jid ) ] pre_snapshot = [ x for x in jid_snapshots if ( x [ 'type' ] == 'pre' ) ] post_snapshot = [ x for x in jid_snapshots if ( x [ 'type' ] == 'post' ) ] if ( ( not pre_snapshot ) or ( not post_snapshot ) ) : raise CommandExecutionError ( "Jid '{0}' snapshots not found" . format ( jid ) ) return ( pre_snapshot [ 0 ] [ 'id' ] , post_snapshot [ 0 ] [ 'id' ] )
returns pre/post snapshots made by a given salt jid looks for salt_jid entries into snapshots userdata which are created when snapper .