{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/47395","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/47395/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/47395/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/47395/events","html_url":"https://github.com/saltstack/salt/issues/47395","id":318881947,"number":47395,"title":"Python3 can't override core module","user":{"login":"jvdbeemt","id":8734513,"avatar_url":"https://avatars2.githubusercontent.com/u/8734513?v=4","gravatar_id":"","url":"https://api.github.com/users/jvdbeemt","html_url":"https://github.com/jvdbeemt","followers_url":"https://api.github.com/users/jvdbeemt/followers","following_url":"https://api.github.com/users/jvdbeemt/following{/other_user}","gists_url":"https://api.github.com/users/jvdbeemt/gists{/gist_id}","starred_url":"https://api.github.com/users/jvdbeemt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvdbeemt/subscriptions","organizations_url":"https://api.github.com/users/jvdbeemt/orgs","repos_url":"https://api.github.com/users/jvdbeemt/repos","events_url":"https://api.github.com/users/jvdbeemt/events{/privacy}","received_events_url":"https://api.github.com/users/jvdbeemt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-30T13:01:53Z","updated_at":"2018-04-30T16:47:52Z","closed_at":null,"author_association":"NONE","body":"We were investigating if we could take the step to python3. Our first tests were fine. \r\nBut we found a blocking issue. If we use a internal module, let's say network. We override one function, sync this to a minion. It wont be picked up. If we use python2.7 this works:\r\n\r\nPython2.7\r\n\r\nExample module:\r\n/srv/salt/states/_modules\r\njurgen@jurgen-HP-ZBook-15u-G3:/srv/salt/states/_modules$ \r\ncat test.py\r\n\r\n```\r\nimport salt\r\nimport logging\r\nimport json\r\n\r\ntry:\r\n    import requests\r\n    HAS_LIBS = True\r\nexcept ImportError:\r\n    HAS_LIBS = False\r\n\r\n__virtualname__ = 'test'\r\n\r\ndef __virtual__():\r\n    '''\r\n    Only load if requests is installed\r\n    '''\r\n    if HAS_LIBS:\r\n        return __virtualname__\r\n    else:\r\n        return False, 'The \\'{0}\\' module could not be loaded: \\'requests\\' is not installed.'.format(__virtualname__)\r\n\r\n\r\ndef spam(eggs):\r\n    '''\r\n    A function to make some spam with eggs!\r\n\r\n    CLI Example::\r\n\r\n        salt '*' test.spam eggs\r\n    '''\r\n    return eggs\r\n```\r\n\r\n```\r\nsudo salt-call saltutil.sync_all -l\r\n\r\nlocal:\r\n    ----------\r\n    beacons:\r\n    clouds:\r\n    engines:\r\n    grains:\r\n    log_handlers:\r\n    modules:\r\n        - modules.test\r\n    output:\r\n    pillar:\r\n    proxymodules:\r\n    renderers:\r\n    returners:\r\n    sdb:\r\n    states:\r\n    thorium:\r\n    utils:\r\n```\r\n\r\n```\r\nsudo salt-call test.spam eggs \r\nlocal:\r\n    eggs\r\n```\r\n\r\npython3.5\r\nSame as above with the following end result:\r\n\r\n```\r\nsudo salt-call test.spam eggs \r\n'test.spam' is not available.\r\n```\r\n\r\n\r\nSalt Version:\r\n           Salt: 2018.3.0\r\n \r\nDependency Versions:\r\n           cffi: Not Installed\r\n       cherrypy: Not Installed\r\n       dateutil: 2.4.2\r\n      docker-py: Not Installed\r\n          gitdb: 0.6.4\r\n      gitpython: 1.0.1\r\n          ioflo: Not Installed\r\n         Jinja2: 2.8\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: Not Installed\r\n           Mako: 1.0.3\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.6\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n   pycryptodome: Not Installed\r\n         pygit2: Not Installed\r\n         Python: 2.7.12 (default, Dec  4 2017, 14:50:18)  pyton3.5 if we use the py3 repo\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.2.0\r\n           RAET: Not Installed\r\n          smmap: 0.9.0\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n \r\nSystem Versions:\r\n           dist: Ubuntu 16.04 xenial\r\n         locale: UTF-8\r\n        machine: x86_64\r\n        release: 4.13.0-38-generic\r\n         system: Linux\r\n        version: Ubuntu 16.04 xenial\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/385457852","html_url":"https://github.com/saltstack/salt/issues/47395#issuecomment-385457852","issue_url":"https://api.github.com/repos/saltstack/salt/issues/47395","id":385457852,"user":{"login":"Ch3LL","id":6886822,"avatar_url":"https://avatars3.githubusercontent.com/u/6886822?v=4","gravatar_id":"","url":"https://api.github.com/users/Ch3LL","html_url":"https://github.com/Ch3LL","followers_url":"https://api.github.com/users/Ch3LL/followers","following_url":"https://api.github.com/users/Ch3LL/following{/other_user}","gists_url":"https://api.github.com/users/Ch3LL/gists{/gist_id}","starred_url":"https://api.github.com/users/Ch3LL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ch3LL/subscriptions","organizations_url":"https://api.github.com/users/Ch3LL/orgs","repos_url":"https://api.github.com/users/Ch3LL/repos","events_url":"https://api.github.com/users/Ch3LL/events{/privacy}","received_events_url":"https://api.github.com/users/Ch3LL/received_events","type":"User","site_admin":false},"created_at":"2018-04-30T16:47:52Z","updated_at":"2018-04-30T16:47:52Z","author_association":"CONTRIBUTOR","body":"this is working fine for me on the version report:\r\n\r\n```\r\nSalt Version:                                                                                                                                                                  \r\n           Salt: 2018.3.0                                                                                                                                                      \r\n                                                                                                                                                                               \r\nDependency Versions:                                                                                                                                                           \r\n           cffi: 1.11.2                                                                                                                                                        \r\n       cherrypy: Not Installed                                                                                                                                                 \r\n       dateutil: 2.6.1                                                                                                                                                         \r\n      docker-py: 2.7.0                                                                                                                                                         \r\n          gitdb: Not Installed                                                                                                                                                 \r\n      gitpython: Not Installed                                                                                                                                                 \r\n          ioflo: Not Installed                                                                                                                                                 \r\n         Jinja2: 2.10                                                                                                                                                          \r\n        libgit2: Not Installed                                                                                                                                                 \r\n        libnacl: Not Installed                                                                                                                                                 \r\n       M2Crypto: Not Installed                                                                                                                                                 \r\n           Mako: 1.0.7                                                                                                                                                         \r\n   msgpack-pure: Not Installed                                                                                                                                                 \r\n msgpack-python: 0.4.8                                                                                                                                                         \r\n   mysql-python: 1.3.12                                                                                                                                                        \r\n      pycparser: 2.18                                                                                                                                                          \r\n       pycrypto: 2.6.1                                                                                                                                                         \r\n   pycryptodome: Not Installed                                                                                                                                                 \r\n         pygit2: Not Installed                                                                                                                                                 \r\n         Python: 3.6.4 (default, Dec 23 2017, 19:07:07)                                                                                                                        \r\n   python-gnupg: Not Installed                                                                                                                                                 \r\n         PyYAML: 3.12                                                                                                                                                          \r\n          PyZMQ: 16.0.3                                                                                                                                                        \r\n           RAET: Not Installed                                                                                                                                                 \r\n          smmap: Not Installed\r\n        timelib: Not Installed\r\n        Tornado: 4.5.2\r\n            ZMQ: 4.1.6\r\n\r\nSystem Versions:\r\n           dist: arch Manjaro Linux\r\n         locale: UTF-8\r\n        machine: x86_64\r\n        release: 4.11.12-1-MANJARO\r\n         system: Linux\r\n        version: arch Manjaro Linux\r\n```\r\n\r\n```\r\n➜  _modules sudo salt-call test.spam eggs -lwarning\r\nlocal:\r\n    eggs\r\n```\r\n\r\nHow are you installing python3? Maybe there is some conflicting pycache when installing between the two versions "}}
{"actor":{"display_login":"Ch3LL"}}