This repository has been archived by the owner. It is now read-only.

unexpected state in yum module (1.9.3) #2013

Closed
steynovich opened this Issue Sep 4, 2015 · 17 comments

Comments

Projects
None yet
@steynovich

steynovich commented Sep 4, 2015

Updating YUM packages is broken in Ansible 1.9.3.

env:
Ubuntu 15.04 vivid
Ansible version: 1.9.3-1ppa~vivid (deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu)

Snippet of my playbook:

- name: YUM upgrade
  yum: name=* state=latest update_cache=yes

Unexpected result:

TASK: [centos | YUM upgrade] **************************************************
failed: [centos_host] => {"changed": false, "errors": "unexpected state", "failed": true, "results": ""}
msg: we should never get here unless this all failed

Debugging showed that the value state is 'latest', which is an expected state.

Expected result (was working in 1.9.2):

TASK: [centos | YUM upgrade] **************************************************
ok: [centos_host]

@steynovich steynovich changed the title from unexpected state when in yum module (1.9.3) to unexpected state in yum module (1.9.3) Sep 4, 2015

@gunzy83

This comment has been minimized.

gunzy83 commented Sep 4, 2015

Confirming the above, updating all packages using the yum module is broken in 1.9.3.

My environment:
Amazon Linux AMI 2015.03.1 x86_64
Ansible version 1.9.3 installed via pip

Broken task:

- name: Ensure all base packages are updated
  yum:
    name: "*"
    state: "latest"

Result:

TASK: [base | Ensure all base packages are updated] ***********************
failed: [127.0.0.1] => {"changed": false, "errors": "unexpected state", "failed": true, "results": ""}
msg: we should never get here unless this all failed

Downgrading to 1.9.2 fixes the issue.

@abadger

This comment has been minimized.

Member

abadger commented Sep 4, 2015

I just pushed 411adff which I think will fix this. Testing now. If you'd like to test as well, that would be appreciated.

@steynovich

This comment has been minimized.

steynovich commented Sep 4, 2015

Your commit 411adff seems to fix the issue for me.

TASK: [centos | YUM upgrade] **************************************************
ok: [centos_host]

Thanks for your swift reply.

@abadger

This comment has been minimized.

Member

abadger commented Sep 4, 2015

Thanks for the quick test. Works here too. We're working out when to make a 1.9.4 release with this fix in it now.

@abadger

This comment has been minimized.

Member

abadger commented Sep 4, 2015

Okay, we've tagged 1.9.4-rc1. If no more major bugs are found a 1.9.4 final should be out soon with this fix in it.

@abadger abadger closed this Sep 4, 2015

@josebv

This comment has been minimized.

josebv commented Sep 22, 2015

This only affects when yum update is used inside roles, not at the top level yml

@lero

This comment has been minimized.

lero commented Sep 22, 2015

almost one month and still no new release to fix it? I don't want to use rc versions.

@milad-soufastai

This comment has been minimized.

milad-soufastai commented Sep 22, 2015

@josebv It affects when yum is listed in the pre_tasks on a top level yml too

@jbelafa

This comment has been minimized.

jbelafa commented Sep 24, 2015

Hi
Is it risky to downgrade our platform to 1.9.2 as it's not affected ?

@extremeshok

This comment has been minimized.

extremeshok commented Oct 6, 2015

Guys please push a fix, aka release 1.9.4 or a patched 1.9.3.1

@sivel

This comment has been minimized.

Member

sivel commented Oct 6, 2015

1.9.4-rc3 was just announced 3 days ago

https://groups.google.com/forum/m/#!topic/ansible-devel/JmtlaIbLrlo

I imagine a 1.9.4 release soon.

@extremeshok

This comment has been minimized.

extremeshok commented Oct 6, 2015

The following command will fix the yum error on debian, centos will need the path changed.

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/yum.py
@cad

This comment has been minimized.

cad commented Oct 6, 2015

How come it is not tested?

@thehungrycoder

This comment has been minimized.

thehungrycoder commented Oct 8, 2015

Just wanted to confirm that I ran into same problem with 1.9.3. I, however, downgraded to 1.9.1 which fixed the issue.

@pavgup

This comment has been minimized.

pavgup commented Oct 8, 2015

@extremeshok has the right idea. On my fancy pants macbook with ansible installed via homebrew, the fix was:

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/modules/core/packaging/os/yum.py
@ghost

This comment has been minimized.

ghost commented Oct 10, 2015

Solution provided by @extremeshok worked. On Ubuntu 14+, the path is slightly different:

sudo sed -i "s/return res/module.exit_json(**res)/g" /usr/lib/pymodules/python2.7/ansible/modules/core/packaging/os/yum.py
@sivel

This comment has been minimized.

Member

sivel commented Oct 10, 2015

1.9.4 was just released that contains this fix.

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