amrox / asdf-pyapp

A generic Python Application plugin the asdf version manager.
MIT License
60 stars 8 forks source link

ansible-base seems not working #12

Closed iamhsa closed 2 years ago

iamhsa commented 2 years ago

Describe the bug

ansible-base seems not working

Steps to reproduce

❯ asdf plugin add ansible-base https://github.com/amrox/asdf-pyapp.git

❯ asdf current ansible-base __ No version is set. Run "asdf <global|shell|local> ansible-base " awscli 2.4.0 /root/.tool-versions packer 1.7.8 /root/.tool-versions terraform 1.0.11 /root/.tool-versions

❯ asdf list all ansible-base Plugin ansible-base's list-all callback script failed with output:

❯ asdf install ansible-base latest Plugin ansible-base's list-all callback script failed with output:

ansible-base is already installed

amrox commented 2 years ago

Hi @iamhsa - I'm trying to troubleshoot this.

Can you provide some details about your environment?

OS (uname -a)

Python ($(which python3) --version)

iamhsa commented 2 years ago

Hi @amrox,

I encountered this problem on Gnu/Linux (Debian)... but for now I seem to be working.

Sorry for the noise !

iamhsa commented 2 years ago

re-hello @amrox

In fact I have a similar (but not exactly the same) issue on another Linux (ArchLinux).

# uname -a && cat /etc/os-release
Linux 99348e6ad5c6 5.4.139-16311-g330b3df0010b #1 SMP PREEMPT Mon Nov 8 12:23:05 PST 2021 x86_64 GNU/Linux
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux-logo
# asdf current
ansible-base    ______          No version set. Run "asdf <global|shell|local> ansible-base <version>"

When I try to install latest ansible I have this output :

# asdf install ansible-base latest
asdf-pyapp: [ERROR] Unable to parse versions for 'ansible-base'
ansible-base  is already installed

But if I use a specific version, it work

asdf install ansible-base 2.10.15
Requirement already satisfied: pip in ./.asdf/installs/ansible-base/2.10.15/venv/lib/python3.9/site-packages (21.2.4)
Collecting pip
  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 4.1 MB/s 
Collecting wheel
  Downloading wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.4
    Uninstalling pip-21.2.4:
      Successfully uninstalled pip-21.2.4
Successfully installed pip-21.3.1 wheel-0.37.0
Collecting ansible-base==2.10.15
  Downloading ansible-base-2.10.15.tar.gz (6.1 MB)

[...]

Installing collected packages: pyparsing, click, userpath, packaging, argcomplete, pipx
Successfully installed argcomplete-1.12.3 click-8.0.3 packaging-21.3 pipx-0.16.3 pyparsing-3.0.6 userpath-1.7.0
# asdf global ansible-base  2.10.15

# ansible --version
ansible 2.10.15
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.asdf/installs/ansible-base/2.10.15/venv/lib/python3.9/site-packages/ansible
  executable location = /root/.asdf/installs/ansible-base/2.10.15/bin/ansible
  python version = 3.9.9 (main, Nov 20 2021, 21:30:06) [GCC 11.1.0]

So this issue occur only with latest keyword

iamhsa commented 2 years ago

I am share you two docker command to reproduce this.

This fails :

docker run -e TERM  -w /root -it --rm archlinux bash -uec '
    pacman -Syu --noconfirm git which python python-pip
    git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
    . $HOME/.asdf/asdf.sh
    asdf plugin add ansible-base https://github.com/amrox/asdf-pyapp.git
    asdf current
    asdf install ansible-base latest'

This does not fail :

docker run -e TERM  -w /root -it --rm archlinux bash -uec '
    pacman -Syu --noconfirm git which python python-pip
    git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
    . $HOME/.asdf/asdf.sh
    asdf plugin add ansible-base https://github.com/amrox/asdf-pyapp.git
    asdf current
    asdf install ansible-base 2.10.15
    asdf global ansible-base 2.10.15
    ansible --version'

Edit : typo in docker command

amrox commented 2 years ago

@iamhsa that is perfect. I will look into it this weekend

amrox commented 2 years ago

@iamhsa merged #14 to master. Let me know if that works for you?

iamhsa commented 2 years ago

@amrox : Works great !

❯  asdf list-all  ansible-base
0.0.1a1
0.0.1a2
[...]
2.10.15
2.10.15rc1
2.10.16rc1
❯ asdf install ansible-base latest
Requirement already satisfied: pip in ./.asdf/installs/ansible-base/2.10.15/venv/lib/python3.9/site-packages (21.2.4)
Collecting pip
  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 22.0 MB/s 
Collecting wheel
  Downloading wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.4
    Uninstalling pip-21.2.4:
      Successfully uninstalled pip-21.2.4
Successfully installed pip-21.3.1 wheel-0.37.0
Collecting ansible-base==2.10.15
  Using cached ansible-base-2.10.15.tar.gz (6.1 MB)
  Preparing metadata (setup.py) ... done
[...]
Installing collected packages: pyparsing, click, userpath, packaging, argcomplete, pipx
Successfully installed argcomplete-1.12.3 click-8.0.3 packaging-21.3 pipx-0.16.3 pyparsing-3.0.6 userpath-1.7.0

❯ asdf global ansible-base latest

❯ ansible --version
ansible 2.10.15
  config file = None
  configured module search path = ['/home/hug0/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/hug0/.asdf/installs/ansible-base/2.10.15/venv/lib/python3.9/site-packages/ansible
  executable location = /home/hug0/.asdf/installs/ansible-base/2.10.15/bin/ansible
  python version = 3.9.9 (main, Nov 20 2021, 21:30:06) [GCC 11.1.0]

Thanks a lot for the quick fix!

Edit : change output ansible --version (system version --> asdf ansible version)