Skip to content

[salt-cloud openstack] TypeError: unhashable type: 'dict' on map creation #24017

Closed

Description

@arthurzenika
# salt-cloud -P -m map_something
[snip]
Error: There was a query error: Exception caught
Caught Exception, terminating workers
TRACE: unhashable type: 'dict'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 55, in _call
    ret = func(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 2168, in create_multiprocessing
    local_master=parallel_data['local_master']
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1250, in create
    client = salt.client.get_local_client(mopts=self.opts)
  File "/usr/lib/python2.7/dist-packages/salt/client/__init__.py", line 90, in get_local_client
    return LocalClient(mopts=opts, skip_perm_errors=skip_perm_errors)
  File "/usr/lib/python2.7/dist-packages/salt/client/__init__.py", line 137, in __init__
    self.functions = salt.loader.minion_mods(self.opts)
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 167, in minion_mods
    funcs = raw_mod(opts, providers[mod], ret.items())
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 197, in raw_mod
    if name not in loader.file_mapping:
TypeError: unhashable type: 'dict'
# salt-cloud --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
       Apache Libcloud: 0.15.1
 Debian source package: 2015.5.0+ds-1trusty1

VMS are running, but only one has a floating ip associated.

Activity

  1. kiorky commented on May 21, 2015

    @kiorky
    Contributor

    @jpic just got that one using the lxc provider.

  2. jpic commented on May 21, 2015

    @jpic
    Contributor
    ipdb> pprint.pprint(name)
    {'lxc': {'profiles': {'debian_container': {'auto': True,
                                               'bridge': 'lxcbr0',
                                               'image': 'debian',
                                               'minion': {'master': '10.0.4.1',
                                                          'master_port': 4506},
                                               'network_profile': 'nic',
                                               'password': 'foobar',
                                               'path': '/var/lib/lxc/ram',
                                               'profile': 'debian_container',
                                               'provider': 'bigal:lxc',
                                               'ssh_username': 'ubuntu'}},
             'provider': 'lxc',
             'target': 'mytarget'}}
    
    

    Is that normal ?

  3. kiorky commented on May 21, 2015

    @kiorky
    Contributor

    bt ?
    on which portion of the code, many "cloud" function receive the vm opts mangled as the first param, its normal.

  4. jpic commented on May 21, 2015

    @jpic
    Contributor

    Similar to what @arthurlogilab posted:

    ipdb> bt
      /home/jpic/env/bin/salt-cloud(6)<module>()
          2 # EASY-INSTALL-DEV-SCRIPT: 'salt==2015.5.0-1356-g888d881','salt-cloud'
          3 __requires__ = 'salt==2015.5.0-1356-g888d881'
          4 __import__('pkg_resources').require('salt==2015.5.0-1356-g888d881')
          5 __file__ = '/home/jpic/salt/scripts/salt-cloud'
    ----> 6 exec(compile(open(__file__).read(), __file__, 'exec'))
    
      /home/jpic/salt/scripts/salt-cloud(10)<module>()
          6 from salt.scripts import salt_cloud
          7 
          8 
          9 if __name__ == '__main__':
    ---> 10     salt_cloud()
    
      /home/jpic/salt/salt/scripts.py(314)salt_cloud()
        312     try:
        313         client = salt.cloud.cli.SaltCloud()
    --> 314         client.run()
        315     except KeyboardInterrupt as err:
        316         trace = traceback.format_exc()
    
      /home/jpic/salt/salt/cloud/cli.py(255)run()
        253                 ret = mapper.run_profile(
        254                     self.options.profile,
    --> 255                     self.config.get('names')
        256                 )
        257             except (SaltCloudException, Exception) as exc:
    
      /home/jpic/salt/salt/cloud/__init__.py(1402)run_profile()
       1400                 # No need to inject __active_provider_name__ into the context
       1401                 # here because self.create takes care of that
    -> 1402                 ret[name] = self.create(vm_)
       1403                 if not ret[name]:
       1404                     ret[name] = {'Error': 'Failed to deploy VM'}
    
      /home/jpic/salt/salt/cloud/__init__.py(1264)create()
       1262                 # a small pause makes the sync work reliably
       1263                 time.sleep(3)
    -> 1264                 client = salt.client.get_local_client(mopts=self.opts)
       1265                 ret = client.cmd(vm_['name'], 'saltutil.sync_{0}'.format(
       1266                     self.opts['sync_after_install']
    
      /home/jpic/salt/salt/client/__init__.py(96)get_local_client()
         94     # TODO: AIO core is separate from transport
         95     elif opts['transport'] in ('zeromq', 'tcp'):
    ---> 96         return LocalClient(mopts=opts, skip_perm_errors=skip_perm_errors)
         97 
         98 
    
      /home/jpic/salt/salt/client/__init__.py(144)__init__()
        142                 listen=not self.opts.get('__worker', False))
        143         self.utils = salt.loader.utils(self.opts)
    --> 144         self.functions = salt.loader.minion_mods(self.opts, utils=self.utils)
        145         self.returners = salt.loader.returners(self.opts, self.functions)
        146 
    
      /home/jpic/salt/salt/loader.py(190)minion_mods()
        188         providers = opts.get('providers', False)
        189         for mod in providers:
    --> 190             funcs = raw_mod(opts, providers[mod], ret.items())
        191             if funcs:
        192                 for func in funcs:
    
    > /home/jpic/salt/salt/loader.py(224)raw_mod()
        222     # if we don't have the module, return an empty dict
        223     import ipdb; ipdb.set_trace()
    --> 224     if name not in loader.file_mapping:
        225         return {}
    
  5. jpic commented on May 21, 2015

    @jpic
    Contributor

    FTR, that's loader.file_mapping:

    {'aliases': ('/home/jpic/salt/salt/modules/aliases.py', '.py'),
     'alternatives': ('/home/jpic/salt/salt/modules/alternatives.py', '.py'),
     'apache': ('/home/jpic/salt/salt/modules/apache.py', '.py'),
    
    # snip .... see full : http://dpaste.com/2J03PB2
    
     'zpool': ('/home/jpic/salt/salt/modules/zpool.py', '.py'),
     'zypper': ('/home/jpic/salt/salt/modules/zypper.py', '.py')}
    

    Again FTR, that's what the Python error is about:

    >>> {} in {}
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unhashable type: 'dict'
    

    Hope this helps.

  6. jpic commented on May 21, 2015

    @jpic
    Contributor

    According to the docstring of raw_mod, the name argument is wrong as suspected above:

        '''  
        Returns a single module loaded raw and bypassing the __virtual__ function
    
        .. code-block:: python
    
            import salt.config
            import salt.loader
    
            __opts__ = salt.config.minion_config('/etc/salt/minion')
            testmod = salt.loader.raw_mod(__opts__, 'test', None)
            testmod['test.ping']()
        '''
    

    However, the above frame's comment is blatant

    > /home/jpic/salt/salt/loader.py(190)minion_mods()
        # Load any provider overrides from the configuration file providers option
        #  Note: Providers can be pkg, service, user or group - not to be confused
        #        with cloud providers.
        if opts.get('providers', False):
            providers = opts.get('providers', False)
            for mod in providers:
                funcs = raw_mod(opts, providers[mod], ret.items()) <---------
    

    So maybe it's actually a user configuration problem.

  7. added a commit that references this issue on May 21, 2015
  8. kiorky commented on May 21, 2015

    @kiorky
    Contributor

    there must be a provider or providers some where in your conf which conflict with thtat,

  9. kiorky commented on May 21, 2015

    @kiorky
    Contributor

    i know how to make a patch to fix the problem one and for all
    pushing it on a minute.

  10. gladiatr72 commented on May 22, 2015

    @gladiatr72
    Contributor

    *\o/*

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions