I need to sync custom grains and do a deploy a settings file when a minion connects. Custom grains are needed for the sls file that I am also deploying. It goes fine a handful of times and other times it errors out complaining that the grain wasn't found. The reactor file looks like this:
sync_grains:
cmd.saltutil.sync_grains:
- tgt: {{ data['id'] }}
highstate_run:
cmd.state.sls:
- tgt: {{ data['id'] }}
- arg:
- settings.minion
Shouldn't this sync grains first before deploying settings.minion ALL the time? Here's the output of eventlisten.py for one time where it did not work.
First the relevant bit:
'return': ['Rendering SLS "base:settings.minion" failed: Jinja variable \'dict\' object has no attribute \'ipv4_mgmt\'; line 15\n\n---\n[...]\n file.managed:\n - source: salt://settings/minion/minion_id\n - template: jinja\n - context:\n {% if grains[\'fqdn\'].startswith("localhost") %}\n fqdn: {{ grains[\'ipv4_mgmt\'] }} <======================\n {% else %}\n fqdn: {{ grains[\'fqdn\'] }}\n {% endif %}\n\n{% elif grains["os"] == "Windows" %}\n[...]\n---'],
'success': True}
The whole thing:
ipc:///var/run/salt/master/master_event_pub.ipc
Event fired at Mon Jun 30 09:43:12 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:12.929638',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:13 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:13.433500',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:13 2014
*************************
Tag: minion_start
Data:
{'_stamp': '2014-06-30T09:43:13.966307',
'cmd': '_minion_event',
'data': 'Minion localhost started at Mon Jun 30 09:43:18 2014',
'id': 'localhost',
'pretag': None,
'tag': 'minion_start'}
Event fired at Mon Jun 30 09:43:13 2014
*************************
Tag: salt/minion/localhost/start
Data:
{'_stamp': '2014-06-30T09:43:13.979397',
'cmd': '_minion_event',
'data': 'Minion localhost started at Mon Jun 30 09:43:18 2014',
'id': 'localhost',
'pretag': None,
'tag': 'salt/minion/localhost/start'}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: 20140630094314037460
Data:
{'_stamp': '2014-06-30T09:43:14.037814', 'minions': ['localhost']}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: new_job
Data:
{'_stamp': '2014-06-30T09:43:14.037950',
'arg': ['settings.minion'],
'fun': 'state.sls',
'jid': '20140630094314037460',
'minions': ['localhost'],
'tgt': 'localhost',
'tgt_type': 'glob',
'user': 'root'}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: salt/job/20140630094314037460/new
Data:
{'_stamp': '2014-06-30T09:43:14.038039',
'arg': ['settings.minion'],
'fun': 'state.sls',
'jid': '20140630094314037460',
'minions': ['localhost'],
'tgt': 'localhost',
'tgt_type': 'glob',
'user': 'root'}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: 20140630094314118696
Data:
{'_stamp': '2014-06-30T09:43:14.119047', 'minions': ['localhost']}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: new_job
Data:
{'_stamp': '2014-06-30T09:43:14.119185',
'arg': [],
'fun': 'saltutil.sync_grains',
'jid': '20140630094314118696',
'minions': ['localhost'],
'tgt': 'localhost',
'tgt_type': 'glob',
'user': 'root'}
Event fired at Mon Jun 30 09:43:14 2014
*************************
Tag: salt/job/20140630094314118696/new
Data:
{'_stamp': '2014-06-30T09:43:14.119274',
'arg': [],
'fun': 'saltutil.sync_grains',
'jid': '20140630094314118696',
'minions': ['localhost'],
'tgt': 'localhost',
'tgt_type': 'glob',
'user': 'root'}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.005744',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.079374',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.084483',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.809059',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.837937',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:15 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:15.904735',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:17 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:17.846182',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:18 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:18.041613',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:18 2014
*************************
Tag: 20140630094314037460
Data:
{'_stamp': '2014-06-30T09:43:18.915382',
'cmd': '_return',
'fun': 'state.sls',
'fun_args': ['settings.minion'],
'id': 'localhost',
'jid': '20140630094314037460',
'out': 'highstate',
'retcode': 1,
'return': ['Rendering SLS "base:settings.minion" failed: Jinja variable \'dict\' object has no attribute \'ipv4_mgmt\'; line 15\n\n---\n[...]\n file.managed:\n - source: salt://settings/minion/minion_id\n - template: jinja\n - context:\n {% if grains[\'fqdn\'].startswith("localhost") %}\n fqdn: {{ grains[\'ipv4_mgmt\'] }} <======================\n {% else %}\n fqdn: {{ grains[\'fqdn\'] }}\n {% endif %}\n\n{% elif grains["os"] == "Windows" %}\n[...]\n---'],
'success': True}
Event fired at Mon Jun 30 09:43:18 2014
*************************
Tag: salt/job/20140630094314037460/ret/localhost
Data:
{'_stamp': '2014-06-30T09:43:18.915580',
'cmd': '_return',
'fun': 'state.sls',
'fun_args': ['settings.minion'],
'id': 'localhost',
'jid': '20140630094314037460',
'out': 'highstate',
'retcode': 1,
'return': ['Rendering SLS "base:settings.minion" failed: Jinja variable \'dict\' object has no attribute \'ipv4_mgmt\'; line 15\n\n---\n[...]\n file.managed:\n - source: salt://settings/minion/minion_id\n - template: jinja\n - context:\n {% if grains[\'fqdn\'].startswith("localhost") %}\n fqdn: {{ grains[\'ipv4_mgmt\'] }} <======================\n {% else %}\n fqdn: {{ grains[\'fqdn\'] }}\n {% endif %}\n\n{% elif grains["os"] == "Windows" %}\n[...]\n---'],
'success': True}
Event fired at Mon Jun 30 09:43:19 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:19.630864',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:20 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:20.153212',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
Event fired at Mon Jun 30 09:43:20 2014
*************************
Tag: 20140630094314118696
Data:
{'_stamp': '2014-06-30T09:43:20.430834',
'cmd': '_return',
'fun': 'saltutil.sync_grains',
'fun_args': [],
'id': 'localhost',
'jid': '20140630094314118696',
'retcode': 0,
'return': ['grains.ipv4', 'grains.os'],
'success': True}
Event fired at Mon Jun 30 09:43:20 2014
*************************
Tag: salt/job/20140630094314118696/ret/localhost
Data:
{'_stamp': '2014-06-30T09:43:20.431025',
'cmd': '_return',
'fun': 'saltutil.sync_grains',
'fun_args': [],
'id': 'localhost',
'jid': '20140630094314118696',
'retcode': 0,
'return': ['grains.ipv4', 'grains.os'],
'success': True}
Event fired at Mon Jun 30 09:43:23 2014
*************************
Tag: salt/auth
Data:
{'_stamp': '2014-06-30T09:43:23.118809',
'act': 'accept',
'id': 'localhost',
'pub': '-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA1S4Yc8WjirnxFSe10u/g\nvDVBbNFq84MZBw9BG5M8wGjqyiec1I5p2XtDnwxd7MjOlaXDUR3BA7WPjhJU6ukN\nnMFCm5wp2UoxLfvGLJWOuouEm8ZbkNmkQpC3wsyUCshCPNR5xKOt8kJAPsn6R8HD\n5aDZmsEOGmnbATbDWTg8HJZ3bpYypm6hrBiVKz8nkDsp/4WtD5BtPiv7EyQ2dIOV\nN2ZA2tKoqN8xk2BgxnTgDULhuoGPqSMDM0KATduBFtgCuA7enholWcRoYWQVndzS\nGeot1t+fhkEHb31WmDuKPJBo4NNLEPLAWF73Dxg+PjZ3rvTAWxIePGvFvzGkdeMy\n+iQR87gZPdTIQkxRpvm/z4e02FHpf8i1c9CRlclgLPKwFm0V7ZkrJo9FvUBq/zky\n4pik/WVivIbNFXK4N10D7XpAHGhZWaS6zdCQR/UtyEkX2jtcN0rI+jK6gGkQfVNX\nFxxZiLxujtG0mM4zTPhHtEq7dTuiOi7BHjU+ohgI6Zrj7SuhOTognl6suK7MFVca\naaCoX8aqT9DUbMsCIQbsxz6jlOSV7ab3dYC7A393Ftq1CbexFSKnxUK4GIxP1pVJ\nnKoDBaTDZKpLQb6Wj0Y13nG9tpL1t0On7G9NqICtaQYa5TUsDwh/tTdVkNXQ8SS2\n588Md7/F+v0wWNOb1S86xIsCAwEAAQ==\n-----END PUBLIC KEY-----\n',
'result': True}
I guess I'm not sure if reactors are evaluated in order. We definitely need to investigate this, thanks for the report.
@basepi Has anything changed in relation to this?
Unfortunately, no, we haven't had a chance to look into this. Have you had a chance to test with the 2015.5 release? Enough has changed in the last year it's possible this was fixed.
Hi,
I'm having this exact situation, I'm deploying instances in EC2 and I want to use custom EC2 grains (tags) for matching states and therefore I need to first sync grains before doing the highstate and want to do this automatically when minions connect.
Salt: 2015.5.2
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 13.1.0
RAET: Not Installed
ZMQ: 3.2.3
Mako: 0.7.0
Debian source package: 2015.5.2+ds-1~bpo70+1
I have the following reactor:
sync_grains:
cmd.saltutil.sync_grains:
- tgt: {{ data['id'] }}
highstate_run:
local.state.highstate:
- tgt: {{ data['id'] }}
- kwargs:
queue: True
Anyone have a workaround to make this work? I have also tried to use startup_states: highstate on the minion but it produces the same.
It would be great if reactors are executed in order or we can put some kind of dependencies.
Thanks!
I have found a workaround that have just worked for me, here is the thing:
In reactor.conf put the following config:
reactor:
- 'salt/minion/*/start':
- /srv/reactor/sync_grains.sls
- 'salt/job/*/ret/*':
- /srv/reactor/check_return.sls
And in /srv/reactor/check_return.sls put something like this:
{% if data['retcode'] == 0 and data['success'] == True and data['fun'] == 'saltutil.sync_grains' %}
highstate_run:
local.state.highstate:
- tgt: {{ data['id'] }}
- kwargs:
queue: True
{% endif %}
So the highstate will only after the sync_grains is ran and it returned True/Success.
Hope this helps someone until this is fixed properly in reactor.
Thanks!
Seconded, would be great to see if reactor code could be executed in order. Just ran into a similar issue writing some reactors on 2015.5.3.
I am experiencing the same problem with 2016.3.2.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Please don't close this as stale.
Thank you for updating this issue. It is no longer marked as stale.
FYI, this issue still exists 2019.2.0
Also having this issue. I've switched away from reactors for the initial highstate and now do a series of salt-call commands at the end of my cloud-init bootstrap which is less ideal.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Thank you for updating this issue. It is no longer marked as stale.
Most helpful comment
Please don't close this as stale.