Use utility for ZMQ import handling in flo/zero

This commit is contained in:
Bo Maryniuk 2018-02-13 14:21:42 +01:00
parent 08dee6f5bd
commit 457ef7d9a5

View File

@ -15,15 +15,13 @@ import errno
# Import ioflo libs # Import ioflo libs
import ioflo.base.deeding import ioflo.base.deeding
# Import third party libs # Import third party libs
try: from salt.utils.zeromq import zmq
import zmq
import salt.master import salt.master
import salt.crypt import salt.crypt
import salt.daemons.masterapi import salt.daemons.masterapi
import salt.payload import salt.payload
HAS_ZMQ = True import salt.utils.stringutils
except ImportError:
HAS_ZMQ = False
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -159,7 +157,7 @@ class SaltZmqPublisher(ioflo.base.deeding.Deed):
''' '''
Set up tracking value(s) Set up tracking value(s)
''' '''
if not HAS_ZMQ: if not zmq:
return return
self.created = False self.created = False
self.serial = salt.payload.Serial(self.opts.value) self.serial = salt.payload.Serial(self.opts.value)