{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/26348","labels_url":"https://api.github.com/repos/saltstack/salt/issues/26348/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/26348/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/26348/events","html_url":"https://github.com/saltstack/salt/issues/26348","id":101212464,"number":26348,"title":"Loader for runner module invoked from reactor does not include code in _utils leading to exception","user":{"login":"yannis666","id":711000,"avatar_url":"https://avatars.githubusercontent.com/u/711000?v=3","gravatar_id":"","url":"https://api.github.com/users/yannis666","html_url":"https://github.com/yannis666","followers_url":"https://api.github.com/users/yannis666/followers","following_url":"https://api.github.com/users/yannis666/following{/other_user}","gists_url":"https://api.github.com/users/yannis666/gists{/gist_id}","starred_url":"https://api.github.com/users/yannis666/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yannis666/subscriptions","organizations_url":"https://api.github.com/users/yannis666/orgs","repos_url":"https://api.github.com/users/yannis666/repos","events_url":"https://api.github.com/users/yannis666/events{/privacy}","received_events_url":"https://api.github.com/users/yannis666/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Core","name":"Core","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P3","name":"P3","color":"0a3d77"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":2496,"closed_issues":2522,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-08-27T20:45:26Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-08-15T21:54:04Z","updated_at":"2015-08-27T21:10:50Z","closed_at":null,"body":"We have a runner module that is invoked from a reactor\r\n```saltstack\r\nupdate_status: \r\n  runner.lcm_orchestrator_job.react_to_salt_job_event:\r\n     - args:\r\n       - {{ data['id']|default('None') }}\r\n       - {{ data['jid'] }} \r\n      - {{ data['retcode']|default('None') }} \r\n      - {{ data['fun'] }} \r\n      - {{ data['return']|default('None') }} \r\n```\r\nIn the `lcm_orchestrator_job` module there are (lazy) imports on other modules which are in the `_utils` directory.\r\nWhen however the module is accessed via the reactor, we see the following in the master log file\r\n```\r\n2015-08-15 21:30:37,957 [salt.utils.event                         ][DEBUG   ][1129] Sending event - data = {'_stamp': '2015-08-15T21:30:37.957409', 'tag': 'salt/run/20150815213037578147/ret', 'data': {'jid': '20150815213037578147', 'return': 'Exception occurred in runner lcm_orchestrator_job.react_to_salt_job_event: Traceback (most recent call last):\\n  File \"/usr/lib/python2.6/site-packages/salt/client/mixins.py\", line 317, in low\\n    data[\\'return\\'] = self.functions[fun](*args, **kwargs)\\n  File \"/srv/salt/_runners/lcm_orchestrator_job.py\", line 2236, in react_to_salt_job_event\\n    lock_manager = _take_jobs_lock()\\nFile \"/srv/salt/_runners/lcm_orchestrator_job.py\", line 1966, in _take_jobs_lock\\n    schedules_dir = _get_local_path(JOBS_DIR)\\n  File \"/srv/salt/_runners lcm_orchestrator_job.py\", line 2045, in _get_local_path\\n    import lcm_file_util\\nImportError: No module named lcm_file_util\\n', 'success': False, '_stamp': '2015-08-15T21:30:37.639244', 'user': 'Reactor', 'fun': 'runner.lcm_orchestrator_job.react_to_salt_job_event'}}\r\n```\r\n\r\nOriginally we were seeing the Trace early, on compilation. Moving to lazy imports delayed till the event.\r\n\r\nThe imports, modules in `_utils`, are resolved correctly when using `salt-run`.\r\n\r\nWe are using: salt 2015.5.3 (Lithium)\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/135555880","html_url":"https://github.com/saltstack/salt/issues/26348#issuecomment-135555880","issue_url":"https://api.github.com/repos/saltstack/salt/issues/26348","id":135555880,"user":{"login":"cachedout","id":111616,"avatar_url":"https://avatars.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":"2015-08-27T21:10:50Z","updated_at":"2015-08-27T21:10:50Z","body":"Hi @yannis666 Can you provide us with a minimal test case to try and reproduce this issue?"}}