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

Pip uninstall does not support pkgname variable #606

Closed
brabiega opened this issue Apr 20, 2021 · 0 comments · Fixed by #607
Closed

Pip uninstall does not support pkgname variable #606

brabiega opened this issue Apr 20, 2021 · 0 comments · Fixed by #607

Comments

@brabiega
Copy link
Contributor

brabiega commented Apr 20, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant