1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Import the proper library
import salt.utils.event
import salt.config

import salt.log 
salt.log.setup_console_logger('all')

payload = {
  'data': {'drip':'drop'},
  'id': 'sagat.foxhop.net',
  'tag': 'mytag',
  'events': None,
  'pretag': None,
}

sock_dir = '/var/run/salt/minion'

# generates invalid hash ...
#event = salt.utils.event.SaltEvent('sagat.foxhop.net',sock_dir=sock_dir)

opts = salt.config.client_config(os.path.join(syspaths.CONFIG_DIR, 'minion'))
// opts['id'] and opts['sock_dir'] should be loaded from the config file

event = salt.utils.event.SaltEvent('minion', **opts)

#help(salt.utils.event.SaltEvent)
#help(event)

# Fire deploy action
event.fire_event(payload, 'fire_master')