Skip to content

Pip uninstall does not support pkgname variable #606

@brabiega

Description

@brabiega

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.4.0
  • Ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
  • Distribution: Ubuntu 18.04
  • Module version: 5.0, 6.0

How to reproduce (e.g Puppet code you use)

        python::pip { '/opt/virtualenv/oco3/wheel':
            ensure     => 'absent',
            pkgname    => 'wheel',
            virtualenv => '/opt/virtualenv/oco3'
        }

What are you seeing

Puppet error on executing pip uninstall

What behaviour did you expect instead

Uninstalled package determined by $pkgname within given $virtualenv

Output log

Relevant part of the output

Python::Pip[/opt/virtualenv/oco3/wheel]/Exec[pip_uninstall_/opt/virtualenv/oco3/wheel]/returns: ERROR: Invalid requirement: '/opt/virtualenv/oco3/wheel'
Python::Pip[/opt/virtualenv/oco3/wheel]/Exec[pip_uninstall_/opt/virtualenv/oco3/wheel]/returns: Hint: It looks like a path. File '/opt/virtualenv/oco3/wheel' does not exist.
Error: 'echo y | /opt/virtualenv/oco3/bin/pip uninstall   /opt/virtualenv/oco3/wheel' returned 1 instead of one of [0]
Error: Python::Pip[/opt/virtualenv/oco3/wheel]/Exec[pip_uninstall_/opt/virtualenv/oco3/wheel]/returns: change from 'notrun' to ['0'] failed: 'echo y | /opt/virtualenv/oco3/bin/pip uninstall   /opt/virtualenv/oco3/wheel' returned 1 instead of one of [0]

Any additional information you'd like to impart

BUG location https://github.com/voxpupuli/puppet-python/blob/master/manifests/pip.pp#L223

      default: {
        # Anti-action, uninstall.
        $command        = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}"
        $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'"
      }

As you can see this piece of code doesn't respect $pkgname from define params. Instead it uses $name to build the command

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