Skip to content

Import from custom _utils #52136

@kiemlicz

Description

@kiemlicz

Description of Issue/Question

Is it possible to import custom utilities via python imports?
The doc https://docs.saltstack.com/en/latest/topics/utils/index.html suggests so but I couldn't get it working.

Setup

Follow Foo class example from:
https://docs.saltstack.com/en/latest/topics/utils/index.html

Steps to Reproduce Issue

In any custom execution module, e.g.,: _modules/customModule.py it is not possible to write:
import mymodule (given I've named the Foo class file mymodule.py)
It always fails with No module named 'mymodule'
Of course __utils__['mymodule.foo']() syntax works, the question is about import

Could you please clarify if the doc is wrong?

Versions Report

Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.12.2
       cherrypy: unknown
       dateutil: 2.8.0
      docker-py: 1.10.6
          gitdb: 2.0.0
      gitpython: 2.1.1
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: 0.27.4
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.27.4
         Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.1
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
           dist: debian 9.8
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.9.0-7-amd64
         system: Linux
        version: debian 9.8

Metadata

Metadata

Assignees

Labels

ConfirmedSalt engineer has confirmed bug/feature - often including a MCVEZRelease-Sodiumretired labelbugbroken, incorrect, or confusing behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions