{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/41215","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/41215/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/41215/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/41215/events","html_url":"https://github.com/saltstack/salt/pull/41215","id":228381795,"number":41215,"title":"Fix bug in reactor.py's caller()","user":{"login":"jettero","id":54520,"avatar_url":"https://avatars0.githubusercontent.com/u/54520?v=3","gravatar_id":"","url":"https://api.github.com/users/jettero","html_url":"https://github.com/jettero","followers_url":"https://api.github.com/users/jettero/followers","following_url":"https://api.github.com/users/jettero/following{/other_user}","gists_url":"https://api.github.com/users/jettero/gists{/gist_id}","starred_url":"https://api.github.com/users/jettero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jettero/subscriptions","organizations_url":"https://api.github.com/users/jettero/orgs","repos_url":"https://api.github.com/users/jettero/repos","events_url":"https://api.github.com/users/jettero/events{/privacy}","received_events_url":"https://api.github.com/users/jettero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-12T19:09:24Z","updated_at":"2017-05-17T19:29:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/41215","html_url":"https://github.com/saltstack/salt/pull/41215","diff_url":"https://github.com/saltstack/salt/pull/41215.diff","patch_url":"https://github.com/saltstack/salt/pull/41215.patch"},"body":"Before we get to `caller()`, we're way up on line 273, where we do something like this:\r\n\r\n    In [2]: salt.utils.format_call(salt.states.file.managed, {'name': '/etc/lol', 'user': 'jettero'})\r\n    Out[2]: \r\n    {'args': ['/etc/lol'],\r\n     'kwargs': {'allow_empty': True,\r\n      ...\r\n      'user': 'jettero'}}\r\n\r\n... after we've already figured out the `l_fun`; the we call the `l_fun( *f_call['args'], **f_call['kwargs'] )` (roughly speaking).\r\n\r\nI don't see why caller() is replacing the *args figured out by format_call with the args that are literally never in kwargs. Between 2015.8.x and 2016.x.x somewhere, kwargs['args'] was changed to kwawrgs.get('args',[]) because someone notice it's never in there; but this doesn't actually fix the problem.\r\n\r\nI think the problem is as follows:\r\n\r\n`caller.file.manged` is normally used from the _minion_ reactor and master reactor handles something differently (I can't begin to guess what).\r\n\r\nSo perhaps the replace should be something more like:\r\n\r\n    if 'args' in kwargs and not args:\r\n       args = kwargs['args']\r\n\r\n### What does this PR do?\r\n\r\nAttempt to make caller.file.managed work from the master reactor\r\n\r\n### What issues does this PR fix or reference?\r\n\r\nN/A\r\n\r\n### Previous Behavior\r\n\r\nOn 2015.8.10 (still, sigh), though this still wouldn't work in 2016.11 imo, where it's just a useful args replaced by kwargs.get('args',[])\r\n\r\n    11:50:02 salt.utils.reactor ERROR Failed to execute caller: <bound method ReactWrap.caller of <salt.utils.reactor.R\r\n    Wrap object at 0x21e0410>>\r\n    Traceback (most recent call last):\r\n      File \"/usr/lib/python2.6/site-packages/salt/utils/reactor.py\", line 198, in run\r\n        l_fun(*f_call.get('args', ()), **kwargs)\r\n      File \"/usr/lib/python2.6/site-packages/salt/utils/reactor.py\", line 251, in caller\r\n        args = kwargs['args']\r\n    KeyError: 'args'\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/302205244","html_url":"https://github.com/saltstack/salt/pull/41215#issuecomment-302205244","issue_url":"https://api.github.com/repos/saltstack/salt/issues/41215","id":302205244,"user":{"login":"cachedout","id":111616,"avatar_url":"https://avatars0.githubusercontent.com/u/111616?v=3","gravatar_id":"","url":"https://api.github.com/users/cachedout","html_url":"https://github.com/cachedout","followers_url":"https://api.github.com/users/cachedout/followers","following_url":"https://api.github.com/users/cachedout/following{/other_user}","gists_url":"https://api.github.com/users/cachedout/gists{/gist_id}","starred_url":"https://api.github.com/users/cachedout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cachedout/subscriptions","organizations_url":"https://api.github.com/users/cachedout/orgs","repos_url":"https://api.github.com/users/cachedout/repos","events_url":"https://api.github.com/users/cachedout/events{/privacy}","received_events_url":"https://api.github.com/users/cachedout/received_events","type":"User","site_admin":false},"created_at":"2017-05-17T19:29:01Z","updated_at":"2017-05-17T19:29:01Z","body":"@Ch3LL and @frogunder I would like to have you take this PR and run through some reactor tests and give your feedback before I merge this."}}
{"actor":{"display_login":"cachedout"}}