Skip to content

[salt-cloud lxc] NameError: global name '__salt__' is not defined #23657

Closed

Description

@arthurzenika
# salt-cloud -m map_lxc_test 
[snip]
ping_status:
    True
result:
    True
ursa:
    |_
      ----------
      changes:
          ----------
          init:
              |_
                ----------
                create:
                    Container cloned
              |_
                ----------
                password:
                    Password(s) updated
              |_
                ----------
                dns:
                    DNS updated
              |_
                ----------
                bootstrap:
                    Continer successfully bootstrapped
              |_
                ----------
                state:
                    ----------
                    new:
                        running
                    old:
                        None
      comment:
          Container 'bagu.logilab.priv' successfully initialized
      container_name:
          bagu.logilab.priv
      name:
          bagu.logilab.priv
      result:
          True
[INFO    ] Runner completed: 20150513153844491566
[ERROR   ] Failed to read the virtual function for module: npm
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1176, in process_virtual
    virtual = mod.__virtual__()
  File "/usr/lib/python2.7/dist-packages/salt/modules/npm.py", line 31, in __virtual__
    _check_valid_version()
  File "/usr/lib/python2.7/dist-packages/salt/modules/npm.py", line 47, in _check_valid_version
    __salt__['cmd.run']('npm --version'))
NameError: global name '__salt__' is not defined
[ERROR   ] There was a query error: unhashable type: 'dict'
# salt-run --versions-report
                  Salt: 2015.5.0
                Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
                Jinja2: 2.7.2
              M2Crypto: 0.21.1
        msgpack-python: 0.3.0
          msgpack-pure: Not Installed
              pycrypto: 2.6.1
               libnacl: Not Installed
                PyYAML: 3.10
                 ioflo: Not Installed
                 PyZMQ: 14.0.1
                  RAET: Not Installed
                   ZMQ: 4.0.4
                  Mako: 0.9.1
 Debian source package: 2015.5.0+ds-1trusty1

The minion inside lxc seems to be running but is not answering to commands from the master.

Activity

  1. arthurzenika commented on May 13, 2015

    @arthurzenika
    Author

    It seem that the problem is that the minion inside lxc is configured to talk to localhost for it's master.

  2. added
    bug
    severity-medium
    P3
    on May 14, 2015
  3. added this to the Approved milestone on May 14, 2015
  4. added a commit that references this issue on May 14, 2015
  5. jfindlay commented on May 14, 2015

    @jfindlay
    Contributor

    @arthurlogilab, I think there may be two bugs here. I have submitted a pull request to fix the stack trace.

  6. kiorky commented on May 17, 2015

    @kiorky
    Contributor

    dup of #23772

  7. kiorky commented on May 17, 2015

    @kiorky
    Contributor

    related to #23830

  8. kiorky commented on May 17, 2015

    @kiorky
    Contributor

    (the master setting is now partly fixed by the first patches i submitted, but there is still a problem coming from salt cloud where load_args_and_kwargs filters some settings, like ... the minion config which includes the reference to the master.)

  9. kiorky commented on May 17, 2015

    @kiorky
    Contributor

    @arthurlogilab once #23807 / #23808 will be merged, lot of your issues will be fixed.

  10. kiorky commented on May 17, 2015

    @kiorky
    Contributor

    (you can also grab the changesets from the PR ;) )

  11. kiorky commented on May 19, 2015

    @kiorky
    Contributor
  12. arthurzenika commented on May 21, 2015

    @arthurzenika
    Author

    @kiorky thanks, haven't tested (yet) against your PR, but I see the following error on the minion side

    2015-05-21 18:23:28,632 [salt.loaded.int.module.cmdmod][ERROR   ][8877] Command 'lxc-attach --clear-env -n test -- /usr/bin/env' failed with return code: 1
    2015-05-21 18:23:28,633 [salt.loaded.int.module.cmdmod][ERROR   ][8877] output: lxc-attach: attach.c: lxc_attach: 635 failed to get the init pid
    2015-05-21 18:23:30,010 [salt.loaded.int.module.cmdmod][ERROR   ][8877] Command "lxc-attach --clear-env  --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin -n test -- test -e '/lxc.initial_seed'" failed with return code: 1
    2015-05-21 18:23:30,011 [salt.loaded.int.module.cmdmod][ERROR   ][8877] retcode: 1
    

    are you sure you're PRs solve this issue ?

  13. kiorky commented on May 24, 2015

    @kiorky
    Contributor

    Yes they are, and as i said to you already a bunch of times, you are bitten by lxc <1.0.7.

    My current Pr normally support it automically, or you can also configure a special network profile for old version:
    https://github.com/makinacorpus/salt/blob/ef1f95231a79225c10b3883be57b941e831959d0/doc/topics/tutorials/lxc.rst#old-lxc-support-107

    The new pr that add those automatic support are in
    #24080 (2015.5) & #23982 (develop)

  14. added
    RIoT
    on Jun 9, 2015
  15. rallytime commented on Oct 19, 2015

    @rallytime
    Contributor

    @arthurlogilab Have you had a chance to test these fixes? It looks to me like this issue is resolved.

  16. added
    fixed-pls-verify
    on Oct 19, 2015
  17. arthurzenika commented on Oct 22, 2015

    @arthurzenika
    Author

    It doesn't seem to crash on salt but now I get #27956 (and way too much verbose output)

  18. rallytime commented on Dec 8, 2015

    @rallytime
    Contributor

    @arthurlogilab Sorry for the delay. It looks as though #27956 is resolved. Since this particular issue appears to be resolved, I am closing this. If the issue pops up again, please let us know or feel free to file a new issue. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3RIoTSalt-Cloudbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions