mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
ID field for event returns in mysql
This commit is contained in:
parent
4f0d01f21a
commit
d31913118f
@ -51,3 +51,10 @@ Deprecations
|
||||
- Removed ``parameter`` argument from ``eselect.set_`` state. Please migrate to
|
||||
``module_parameter`` or ``action_parameter``.
|
||||
|
||||
- The ``salt_events`` table schema has changed to include an additional field
|
||||
called ``master_id`` to distinguish between events flowing into a database
|
||||
from multiple masters. If ``event_return`` is enabled in the master config,
|
||||
the database schema must first be updated to add the ``master_id`` field.
|
||||
This alteration can be accomplished as follows:
|
||||
|
||||
``ALTER TABLE salt_events ADD master_id VARCHAR(255) NOT NULL;``
|
||||
|
@ -74,6 +74,7 @@ Use the following mysql database schema::
|
||||
`tag` varchar(255) NOT NULL,
|
||||
`data` varchar(1024) NOT NULL,
|
||||
`alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`master_id` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `tag` (`tag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -211,9 +212,9 @@ def event_return(events):
|
||||
for event in events:
|
||||
tag = event.get('tag', '')
|
||||
data = event.get('data', '')
|
||||
sql = '''INSERT INTO `salt_events` (`tag`, `data` )
|
||||
VALUES (%s, %s)'''
|
||||
cur.execute(sql, (tag, json.dumps(data)))
|
||||
sql = '''INSERT INTO `salt_events` (`tag`, `data`, `master_id` )
|
||||
VALUES (%s, %s, %s)'''
|
||||
cur.execute(sql, (tag, json.dumps(data), __opts__['id']))
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
|
Loading…
Reference in New Issue
Block a user