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

ERROR! Unexpected Exception: need more than 1 value to unpack #16128

Closed
basictheprogram opened this issue Jun 3, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@basictheprogram
Copy link

commented Jun 3, 2016

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible --version
ansible 2.2.0 (devel 3121e352f7) last updated 2016/06/03 14:30:49 (GMT -500)
  lib/ansible/modules/core: (detached HEAD 2bd8d78a8b) last updated 2016/06/03 14:30:49 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD b0aec50b9a) last updated 2016/06/01 14:41:34 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

No changes to the ansible.cfg or environment variables

OS / ENVIRONMENT

Running from OS X 10.11.5
Managing: N/A

SUMMARY

Attempting to get Ansible working with Windows.
A simple inventory files and a very simple playbook with a very simple task fails to load with the error message: "ERROR! Unexpected Exception: need more than 1 value to unpack"

STEPS TO REPRODUCE

Inventory file testing-windows

[windows-workstations]
winvm1.tanners.org
winvm2.tanners.org
winvm3.tanners.org
winvm4.tanners.org
winvm5.tanners.org

Playbook windows-workstations.yml


---
# file: windows-workstations.yml

- hosts: windows-workstations
  vars:
  pre_tasks:
  roles:
  tasks:
  post_tasks:
EXPECTED RESULTS

Playbook would load and do nothing

ACTUAL RESULTS
$ ansible-playbook -i testing-windows  windows-workstations.yml  -vvv
Using /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg as config file
ERROR! Unexpected Exception: need more than 1 value to unpack
the full traceback was:

Traceback (most recent call last):
  File "/Users/tanner/projects/ansible.git/ansible/bin/ansible-playbook", line 97, in <module>
    exit_code = cli.run()
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/cli/playbook.py", line 154, in run
    results = pbex.run()
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/executor/playbook_executor.py", line 73, in run
    self._inventory.set_playbook_basedir(os.path.dirname(playbook_path))
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/inventory/__init__.py", line 697, in set_playbook_basedir
    self.get_group_vars(group)
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/inventory/__init__.py", line 715, in get_group_vars
    return self._get_hostgroup_vars(host=None, group=group, new_pb_basedir=new_pb_basedir)
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/inventory/__init__.py", line 776, in _get_hostgroup_vars
    self._variable_manager.add_group_vars_file(base_path, self._loader)
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/vars/__init__.py", line 602, in add_group_vars_file
    data = self._load_inventory_file(path, loader)
  File "/Users/tanner/projects/ansible.git/ansible/lib/ansible/vars/__init__.py", line 540, in _load_inventory_file
    _found, results = self._load_inventory_file(path=p, loader=loader)
ValueError: need more than 1 value to unpack
@basictheprogram

This comment has been minimized.

Copy link
Author

commented Jun 3, 2016

A lot bigger problem. All my playbooks now throw this error. Even ones that worked yesterday. A git bisect is telling me this commit breaks things:

273a965dcc1e522fcd6637c63be0157a17cff421 is the first bad commit
commit 273a965dcc1e522fcd6637c63be0157a17cff421
Author: James Cammarata <jimi@sngx.net>
Date:   Thu Jun 2 16:08:52 2016 -0400

    Fix the way host and group vars are loaded

    * In the VariableManager, we were not properly tracking if a file
      had already been loaded, so we continuously append data to the end
      of the list there for host and group vars, meaning large sets of data
      are duplicated multiple times
    * In the inventory, we were merging the host/group vars with the vars
      local to the host needlessly, as the VariableManager already handles that.
      This leads to needless duplication of the data and makes combining the
      vars in VariableManager take even longer.
@towolf

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2016

Looks like the recursive call on line 540 was not updated.

@basictheprogram

This comment has been minimized.

Copy link
Author

commented Jun 5, 2016

If you mean remove the _found from "_found, results", I'd agree.

@alikins alikins added this to the 2.2.0 milestone Jun 6, 2016

@alikins alikins added the bug_report label Jun 6, 2016

@alikins

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2016

This looks like it is a good candidate for a unit/integration test as well. A good candidate_for_tests.

@jimi-c

This comment has been minimized.

Copy link
Member

commented Jun 6, 2016

My bad, I'll get this fixed ASAP.

@jimi-c jimi-c closed this in add2d19 Jun 6, 2016

@jimi-c

This comment has been minimized.

Copy link
Member

commented Jun 6, 2016

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

jimi-c referenced this issue Jun 6, 2016

Fix the way host and group vars are loaded
* In the VariableManager, we were not properly tracking if a file
  had already been loaded, so we continuously append data to the end
  of the list there for host and group vars, meaning large sets of data
  are duplicated multiple times
* In the inventory, we were merging the host/group vars with the vars
  local to the host needlessly, as the VariableManager already handles that.
  This leads to needless duplication of the data and makes combining the
  vars in VariableManager take even longer.

jimi-c added a commit that referenced this issue Jun 6, 2016

@ansibot ansibot added bug and removed bug_report labels Mar 7, 2018

@ansible ansible locked and limited conversation to collaborators Apr 25, 2019

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