Search code examples
pythonsalt-project

Custom Stackstack runner won't lazyload


Creating a custom runner but salt-run myrunner.test returns with Module 'myrunner' is not available.. Here's my versions

           Salt: 2015.5.5
         Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: 1.4.3
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed
        Tornado: Not Installed
        timelib: Not Installed
       dateutil: Not Installed

This is what the logs output when I try running:

2015-09-16 15:08:21,109 [salt.utils.lazy  ][DEBUG   ][7617] Could not LazyLoad myrunner.test
2015-09-16 15:08:21,111 [salt.utils.lazy  ][DEBUG   ][7617] LazyLoaded nested.output

Here's the runner code

# -*- coding: utf-8 -*-
from __future__ import absolute_import
    
# salt imports
import salt.config
import salt.loader
import salt.runner
import salt.client
    
def __virtual__():
    return 'myrunner'
    
def test():
    print "Hello World!"
    return True

I've also set my runner_dir in my master config file to /srv/salt/_runners. I can't get salt to recognize my runner. Has anyone else had a similar problem? I would appreciate any help


Solution

  • OK, runner_dir is incorrect. Use this instead:

    runner_dirs: ['/srv/salt/_runners',]
    

    runner_dirs is a list of directories the master should look in for runners to execute.

    I tested this with your exact runner and it worked for me.