Allow the event listener to work with the test sockets. And even for the minion's

This commit is contained in:
Pedro Algarvio 2013-04-27 12:47:03 +01:00
parent de8d29c8e5
commit b88d901b78

View file

@ -42,18 +42,24 @@ def parse():
if v is not None:
opts[k] = v
opts['sock_dir'] = os.path.join(opts['sock_dir'], opts['node'])
if 'minion' in options.node:
if args:
opts['id'] = args[0]
return opts
opts['id'] = options.node
return opts
def listen(sock_dir, node):
def listen(sock_dir, node, id=None):
'''
Attach to the pub socket and grab messages
'''
event = salt.utils.event.SaltEvent(
node,
sock_dir,
id=id
)
print event.puburi
while True:
@ -69,4 +75,4 @@ def listen(sock_dir, node):
if __name__ == '__main__':
opts = parse()
listen(opts['sock_dir'], opts['node'])
listen(opts['sock_dir'], opts['node'], id=opts.get('id', ''))