ansible/ansible-modules-core

apt package spec wildcards can fail when multiple "*"s

Knio opened this issue · 1 comments

Knio commented
ISSUE TYPE
  • Bug Report
COMPONENT NAME

apt

ANSIBLE VERSION
2.1.1.0
CONFIGURATION

No config

OS / ENVIRONMENT

Ubuntu 14.04

SUMMARY
STEPS TO REPRODUCE
- hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  # single * at end of string
  # works as expected
  - apt:
      name: "htop=1.0.2*"
    become: yes

  # multiple *'s, still properly finds a match
  # already installed; does nothing
  - apt:
      name: "htop=1.*.2*"
    become: yes

  # single prefixed *, finds a match
  # works as expected
  - apt:
      name: "htop=*0.2-3"
      state: absent
    become: yes

  # multiple *'s same as above
  # fails; is passing the wildcard string directly to apt instead of the matched
  # result
  - apt:
      name: "htop=1.*.2*"
    become: yes
EXPECTED RESULTS

Install or uninstall version successfully

ACTUAL RESULTS
TASK [apt] *********************************************************************
fatal: [localhost]: FAILED! => {"cache_update_time": 0, "cache_updated": false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'htop=1.*.2*'' failed: E: Version '1.*.2*' for 'htop' was not found\n", "stderr": "E: Version '1.*.2*' for 'htop' was not found\n", "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.