{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/34660","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/34660/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/34660/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/34660/events","html_url":"https://github.com/saltstack/salt/issues/34660","id":165490674,"number":34660,"title":"saltutil.sync_modules can't sync myself module to minions if I use consul python package in the module","user":{"login":"ShaolongTan","id":20452673,"avatar_url":"https://avatars.githubusercontent.com/u/20452673?v=3","gravatar_id":"","url":"https://api.github.com/users/ShaolongTan","html_url":"https://github.com/ShaolongTan","followers_url":"https://api.github.com/users/ShaolongTan/followers","following_url":"https://api.github.com/users/ShaolongTan/following{/other_user}","gists_url":"https://api.github.com/users/ShaolongTan/gists{/gist_id}","starred_url":"https://api.github.com/users/ShaolongTan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShaolongTan/subscriptions","organizations_url":"https://api.github.com/users/ShaolongTan/orgs","repos_url":"https://api.github.com/users/ShaolongTan/repos","events_url":"https://api.github.com/users/ShaolongTan/events{/privacy}","received_events_url":"https://api.github.com/users/ShaolongTan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-14T07:01:53Z","updated_at":"2016-07-15T02:57:27Z","closed_at":null,"body":"### Description of Issue/Question\r\nI write a myself module with python. Because I need to use python consul package, I import consul in my python code. I used saltutil.sync_modules to sync the extended module. It shown saltutil sync the module, but actually I can't use the module function.\r\nIf remove the \"import consul\" code, the saltutil.sync_modules works.\r\n\r\n### Setup\r\n(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)\r\nN/A\r\n\r\n### Steps to Reproduce Issue\r\n(Include debug logs if possible and relevant.)\r\n1. Add python code to /srv/salt/_modules/myconsul.py\r\n```\r\n#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport logging\r\nimport time\r\nimport consul\r\n\r\ndef get(host, port, prefix):\r\n    \"\"\"\r\n    Get key from Consul\r\n    \"\"\"\r\n    #c = consul.Consul(host=host, port=port)\r\n    #try:\r\n    #    ret = c.kv.get(prefix)[1]['Value']\r\n    #except KeyError as err:\r\n    #    log.debug(\"Can't find Key for %s. Error: %s\" % (prefix, str(err)))\r\n    #    raise err\r\n\r\n    #return ret\r\n    return \"aa\"\r\n\r\ndef date():\r\n    return time.time()\r\n```\r\n2. sync the extended modules\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt \"test-xxxx\" saltutil.sync_modules -l debug\r\n[DEBUG   ] Reading configuration from /etc/salt/master\r\n[DEBUG   ] Missing configuration file: /home/tanr9/.saltrc\r\n[DEBUG   ] Configuration file path: /etc/salt/master\r\n[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.\r\n[DEBUG   ] Reading configuration from /etc/salt/master\r\n[DEBUG   ] Missing configuration file: /home/tanr9/.saltrc\r\n[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc\r\n[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'ubuntu1404_master', 'tcp://127.0.0.1:4506', 'clear')\r\n[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pub.ipc\r\n[DEBUG   ] LazyLoaded local_cache.get_load\r\n[DEBUG   ] Reading minion list from /var/cache/salt/master/jobs/ba/bb7d352540ed35516a89721329782e/.minions.p\r\n[DEBUG   ] get_iter_returns for jid 20160714063824028526 sent to set(['test-xxxx']) will timeout at 06:38:29.042901\r\n[DEBUG   ] jid 20160714063824028526 return from test-xxxx\r\n[DEBUG   ] LazyLoaded nested.output\r\ntest-xxxx:\r\n    - modules.myconsul\r\n[DEBUG   ] jid 20160714063824028526 found all minions set(['test-xxxx'])\r\n```\r\n3. find that can't use the module.\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt \"test-xxxx\" myconsul.date\r\ntest-xxxx:\r\n    'myconsul.date' is not available.\r\nERROR: Minions returned with non-zero exit code\r\n```\r\n4. If I JUST remove the \"import consul\". it is work after sync the module again.\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt \"test-xxxx\" myconsul.date\r\ntest-xxxx:\r\n    1468479197.94\r\n```\r\n5.  I make sure I have installed python-consul package in salt-master and salt-minion.\r\n  - for master:\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ python -c \"import consul\"\r\ntanr9@ubuntu1404:/srv/salt/_modules$ \r\n```\r\n  - for minion:\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt \"test-xxxx\" cmd.run \"python -c 'import consul'\"\r\ntest-xxxx:\r\ntanr9@ubuntu1404:/srv/salt/_modules$\r\n```\r\n\r\n### Versions Report\r\n(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)\r\n  - for master:\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt --versions-report\r\nSalt Version:\r\n           Salt: 2016.3.0\r\n \r\nDependency Versions:\r\n           cffi: 1.7.0\r\n       cherrypy: Not Installed\r\n       dateutil: 1.5\r\n          gitdb: 0.5.4\r\n      gitpython: 0.3.2 RC1\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: 0.9.1\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.3.0\r\n   mysql-python: 1.2.3\r\n      pycparser: 2.14\r\n       pycrypto: 2.6.1\r\n         pygit2: Not Installed\r\n         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 14.0.1\r\n           RAET: Not Installed\r\n          smmap: 0.8.2\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.0.4\r\n \r\nSystem Versions:\r\n           dist: Ubuntu 14.04 trusty\r\n        machine: x86_64\r\n        release: 4.2.0-27-generic\r\n         system: Linux\r\n        version: Ubuntu 14.04 trusty\r\n```\r\n  - for minion:\r\n```\r\ntanr9@ubuntu1404:/srv/salt/_modules$ sudo salt \"test-xxxx\" test.versions_report\r\ntest-xxxx:\r\n    Salt Version:\r\n               Salt: 2015.8.0\r\n     \r\n    Dependency Versions:\r\n             Jinja2: 2.8\r\n           M2Crypto: 0.22\r\n               Mako: 1.0.1\r\n             PyYAML: 3.11\r\n              PyZMQ: 14.4.1\r\n             Python: 2.7.10 (default, Sep 24 2015, 13:11:49)\r\n               RAET: Not Installed\r\n            Tornado: 4.2.1\r\n                ZMQ: 4.0.5\r\n               cffi: Not Installed\r\n           cherrypy: Not Installed\r\n           dateutil: Not Installed\r\n              gitdb: Not Installed\r\n          gitpython: Not Installed\r\n              ioflo: Not Installed\r\n            libnacl: Not Installed\r\n       msgpack-pure: 0.1.3\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             pygit2: Not Installed\r\n       python-gnupg: Not Installed\r\n              smmap: Not Installed\r\n            timelib: Not Installed\r\n     \r\n    System Versions:\r\n               dist: SuSE 11 x86_64\r\n            machine: x86_64\r\n            release: 3.0.101-0.46-default\r\n             system: SUSE Linux Enterprise Server  11 x86_64\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/232848169","html_url":"https://github.com/saltstack/salt/issues/34660#issuecomment-232848169","issue_url":"https://api.github.com/repos/saltstack/salt/issues/34660","id":232848169,"user":{"login":"ShaolongTan","id":20452673,"avatar_url":"https://avatars.githubusercontent.com/u/20452673?v=3","gravatar_id":"","url":"https://api.github.com/users/ShaolongTan","html_url":"https://github.com/ShaolongTan","followers_url":"https://api.github.com/users/ShaolongTan/followers","following_url":"https://api.github.com/users/ShaolongTan/following{/other_user}","gists_url":"https://api.github.com/users/ShaolongTan/gists{/gist_id}","starred_url":"https://api.github.com/users/ShaolongTan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShaolongTan/subscriptions","organizations_url":"https://api.github.com/users/ShaolongTan/orgs","repos_url":"https://api.github.com/users/ShaolongTan/repos","events_url":"https://api.github.com/users/ShaolongTan/events{/privacy}","received_events_url":"https://api.github.com/users/ShaolongTan/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T02:57:27Z","updated_at":"2016-07-15T02:57:27Z","body":"Thanks for you quick response. My minion is 2015.8.0 and not 2016.8.0. :)\r\nBut why I can sync modules if I just remove \"import consul\"? If the reason is backwards incompatible, it always should not work. is it right? thanks."}}
{"actor":{"display_login":"ShaolongTan"}}