Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error with and EC2 #33162

jfindlay opened this issue May 11, 2016 · 1 comment


None yet
3 participants
Copy link

commented May 11, 2016

Description of Issue/Question returns data inconsistent with what expects. It is returning a dictionary with a single key, value pair, whose key seems to be the name the cache_node function is looking for:

  {'amiLaunchIndex': '0',
   'keyName': 'jmoney',
   'launchTime': '2016-05-10T23:00:26.000Z',
   'monitoring': {'state': 'disabled'},
   'name': 'jmoney-git-ec2-amazon-6',
   'virtualizationType': 'hvm'}

Contrast this with a digital ocean node dictionary, which has the required name attribute in the top level dictionary and does not cause the stack trace:

  u'kernel': None,
  u'locked': True,
  u'memory': 2048,
  u'name': u'jmoney-stable-do-fedora-23',
  u'networks': {u'v4': [], u'v6': []},
  u'next_backup_window': None,


Provision an amazon VM: salt-cloud -p amazon-6 jmoney-git-ec2-amazon-6.

Steps to Reproduce Issue

# salt-call --local cloud.has_instance jmoney-git-ec2-amazon-6
[INFO    ] Starting new HTTPS connection (1):
[INFO    ] Starting new HTTPS connection (1):
[INFO    ] Starting new HTTPS connection (1):
[INFO    ] Starting new HTTPS connection (1):
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'name'
Traceback (most recent call last):
  File "/usr/local/bin/salt-call", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/salt/scripts/salt-call", line 11, in <module>
  File "/root/salt/salt/", line 341, in salt_call
  File "/root/salt/salt/cli/", line 53, in run
  File "/root/salt/salt/cli/", line 133, in run
    ret =
  File "/root/salt/salt/cli/", line 196, in call
    ret['return'] = func(*args, **kwargs)
  File "/root/salt/salt/modules/", line 149, in has_instance
    data = get_instance(name, provider)
  File "/root/salt/salt/modules/", line 175, in get_instance
    data = action(fun='show_instance', names=[name], provider=provider)
  File "/root/salt/salt/modules/", line 234, in action
    info = client.action(fun, cloudmap, names, provider, instance, kwargs)
  File "/root/salt/salt/cloud/", line 482, in action
    return mapper.do_action(names, kwargs)
  File "/root/salt/salt/cloud/", line 1511, in do_action
    vm_name, call='action'
  File "/root/salt/salt/cloud/clouds/", line 3171, in show_instance, __active_provider_name__, __opts__)
  File "/root/salt/salt/utils/", line 2821, in cache_node
    path = os.path.join(prov_dir, '{0}.p'.format(node['name']))
KeyError: 'name'

Versions Report

# salt-call --versions
Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
           Mako: 1.0.0
         PyYAML: 3.11
          PyZMQ: 14.4.0
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: Not Installed
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: debian 8.4
        machine: x86_64
        release: 3.16.0-4-amd64
         system: debian 8.4

This comment has been minimized.

Copy link

commented May 12, 2016

Should be fixed by #33164

@cachedout cachedout closed this May 12, 2016

sergeizv added a commit to sergeizv/salt that referenced this issue Mar 2, 2017

Revert "cloud.clouds.ec2: cache each named node (saltstack#33164)"
This reverts commit b3805d8 ("cloud.clouds.ec2: cache each named
node (saltstack#33164)").

Commit 25771fc ("_get_node return instance info directly, not a
dict of instances") from 2016.3 feature release changed how the result
of _get_node should be interpreted. Before it was like

  res = _get_node(...)
  node = res[name]

and after the commit it became

  node = _get_node(...)

Commit b3805d8 ("cloud.clouds.ec2: cache each named node (saltstack#33164)")
submitted into 2015.8 as a bugfix for saltstack#33162 added loops over the keys
of a dictionary returned by _get_node, fixing calls in queue_instances() and

But after being merged into 2016.3 with merge commit 679200a
("Merge branch '2015.8' into '2016.3'"), the commit in question
reintroduced the bug on 2016.3 because of changed return value of

Fixes saltstack#39782

@sergeizv sergeizv referenced this issue Mar 2, 2017


Fix 39782 #39784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.