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

osfv_cli/src/osfv/cli/cli.py: fix #93 #101

Merged
merged 3 commits into from
Jan 30, 2025
Merged

osfv_cli/src/osfv/cli/cli.py: fix #93 #101

merged 3 commits into from
Jan 30, 2025

Conversation

macpijan
Copy link
Contributor

Fixes #93

Fixes #93

Signed-off-by: Maciej Pijanowski <[email protected]>
@m-iwanicki
Copy link

Doesn't work, installed in new venv (via make install and also tried pip install .):

(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) which osfv_cli
~/projects/osfv-scripts/osfv_cli/venv/bin/osfv_cli
(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) osfv_cli snipeit check_out --asset_id 105
Asset 105 successfully checked out.
(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) osfv_cli rte --rte_ip 192.168.10.225 flash probe
DUT model retrieved from snipeit: Optiplex 7010
Using rte command is invasive action, checking first if the device is not used...
Asset 105 is already checked out by you
Probing flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 -c MX25L3205D/MX25L3208D
flashrom v1.3.0 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L3205D/MX25L3208D" (4096 kB, SPI) on linux_spi.
===
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to [email protected] if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
No operations were specified.
Since the asset 105 has been checkout manually                     by you prior running this script, it will NOT be checked                     in automatically. Please return the device when work is                     finished.
Asset 105 successfully checked in.

Signed-off-by: Maciej Pijanowski <[email protected]>
Signed-off-by: Maciej Pijanowski <[email protected]>
@m-iwanicki
Copy link

Hmmm, weird when I install with pip install -e . then it works.

@macpijan
Copy link
Contributor Author

macpijan commented Jan 30, 2025

Installed via make install now:

macpijan in ~/projects/github/dasharo/osfv-scripts-tmp/osfv_cli on fix-93 ● λ which osfv_cli
~/.local/bin/osfv_cli
macpijan in ~/projects/github/dasharo/osfv-scripts-tmp/osfv_cli on fix-93 ● λ osfv_cli --version
0.5.10
osfv_cli rte --rte_ip 192.168.10.168 flash probe  
DUT model retrieved from snipeit: FW4C
Using rte command is invasive action, checking first if the device is not used...
Asset 42 is already checked out by you
Probing flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 
flashrom v1.3.0 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi.
No operations were specified.
Since the asset 42 has been checkout manually                     by you prior running this script, it will NOT be checked                     in automatically. Please return the device when work is                     finished.

Not sure if that helps in anyway, but pushed some pkg updates as well.

@m-iwanicki
Copy link

Still doesn't work. How to reproduce:

rm -rf venv
python -m venv venv
source venv/bin/activate
pip install poetry
make install
osfv_cli snipeit check_out --asset_id 105
osfv_cli rte --rte_ip 192.168.10.225 pwr off

Please try these steps and check if it works for you.
Based on your logs you are not using venv (i.e. not trying clean install).
If installation steps differ then please update https://github.com/Dasharo/osfv-scripts/tree/main/osfv_cli#installation

Now I can't even reproduce the working example with pip install -e .
Maybe there is problem with cache?

@macpijan
Copy link
Contributor Author

macpijan commented Jan 30, 2025

Let me try. I admit, I have never used it in venv.

I have accepted commit from Piotr 32c07fa apparently, but I keep using just poetry on the host, as I originally have.

@macpijan
Copy link
Contributor Author

TBH that's odd, how one should use this osfv_cli globally then?
Add venv in this repo to PATH?

@macpijan
Copy link
Contributor Author

Either way, in venv seems to work fine for me as well

(venv) macpijan in ~/projects/github/dasharo/osfv-scripts/osfv_cli on fix-93 ● ● λ osfv_cli snipeit check_out --asset_id 105
Asset 105 successfully checked out.
(venv) macpijan in ~/projects/github/dasharo/osfv-scripts/osfv_cli on fix-93 ● ● λ osfv_cli rte --rte_ip 192.168.10.225 pwr off
DUT model retrieved from snipeit: Optiplex 7010
Using rte command is invasive action, checking first if the device is not used...
Asset 105 is already checked out by you
Powering off...
Since the asset 105 has been checkout manually                     by you prior running this script, it will NOT be checked                     in automatically. Please return the device when work is                     finished.
(venv) macpijan in ~/projects/github/dasharo/osfv-scripts/osfv_cli on fix-93 ● ● λ which osfv_cli 
~/projects/github/dasharo/osfv-scripts/osfv_cli/venv/bin/osfv_cli
(venv) macpijan in ~/projects/github/dasharo/osfv-scripts/osfv_cli on fix-93 ● ● λ osfv_cli --version
0.5.10

@macpijan
Copy link
Contributor Author

Maybe there is problem with cache?

Make sure to check version of the tool, it's bumped in this PR.

@m-iwanicki
Copy link

I use venv to make sure I have clean environment and can do clean install, in normal day to day use I also installed without virtual environment.

Not sure what might be a problem, maybe @DaniilKl will check if this PR fixes his problems. If yes then maybe there is something wrong with my installation.

Now I installed with pip install -e .. Got 0.5.10 and it worked:

Details

(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) pip install -e .
Obtaining file:///home/miwanicki/projects/osfv-scripts/osfv_cli
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: PyYAML<7.0,>=6.0 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (6.0.2)
Requirement already satisfied: importlib-resources<7.0.0,>=6.1.1 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (6.5.2)
Requirement already satisfied: paramiko<4.0.0,>=3.2.0 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (3.5.0)
Requirement already satisfied: pexpect<5.0.0,>=4.8.0 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (4.9.0)
Requirement already satisfied: requests<3.0.0,>=2.31.0 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (2.32.3)
Requirement already satisfied: unidecode<2.0.0,>=1.3.6 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (1.3.8)
Requirement already satisfied: voluptuous<0.15.0,>=0.14.2 in ./venv/lib64/python3.13/site-packages (from osfv==0.5.10) (0.14.2)
Requirement already satisfied: bcrypt>=3.2 in ./venv/lib64/python3.13/site-packages (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10) (4.2.1)
Requirement already satisfied: cryptography>=3.3 in ./venv/lib64/python3.13/site-packages (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10) (44.0.0)
Requirement already satisfied: pynacl>=1.5 in ./venv/lib64/python3.13/site-packages (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10) (1.5.0)
Requirement already satisfied: ptyprocess>=0.5 in ./venv/lib64/python3.13/site-packages (from pexpect<5.0.0,>=4.8.0->osfv==0.5.10) (0.7.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib64/python3.13/site-packages (from requests<3.0.0,>=2.31.0->osfv==0.5.10) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib64/python3.13/site-packages (from requests<3.0.0,>=2.31.0->osfv==0.5.10) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv/lib64/python3.13/site-packages (from requests<3.0.0,>=2.31.0->osfv==0.5.10) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib64/python3.13/site-packages (from requests<3.0.0,>=2.31.0->osfv==0.5.10) (2024.12.14)
Requirement already satisfied: cffi>=1.12 in ./venv/lib64/python3.13/site-packages (from cryptography>=3.3->paramiko<4.0.0,>=3.2.0->osfv==0.5.10) (1.17.1)
Requirement already satisfied: pycparser in ./venv/lib64/python3.13/site-packages (from cffi>=1.12->cryptography>=3.3->paramiko<4.0.0,>=3.2.0->osfv==0.5.10) (2.22)
Building wheels for collected packages: osfv
  Building editable for osfv (pyproject.toml) ... done
  Created wheel for osfv: filename=osfv-0.5.10-py3-none-any.whl size=1428 sha256=71e85722f25445f5a9810015921afac87fbb625f4649dbc8371db428339425db
  Stored in directory: /tmp/pip-ephem-wheel-cache-ggr8jg4l/wheels/12/cc/94/bd3885fffecd7a9ffcc33aed6f0e0b26260aa5d9c31990bd0b
Successfully built osfv
Installing collected packages: osfv
  Attempting uninstall: osfv
    Found existing installation: osfv 0.5.10
    Uninstalling osfv-0.5.10:
      Successfully uninstalled osfv-0.5.10
Successfully installed osfv-0.5.10

[notice] A new release of pip is available: 24.2 -> 25.0
[notice] To update, run: pip install --upgrade pip
(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) osfv_cli --version
0.5.10
(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) osfv_cli snipeit check_out --rte_ip 192.168.10.172 && osfv_cli rte --rte_ip 192.168.10.172 pwr off
Asset 31 successfully checked out.
DUT model retrieved from snipeit: APU2
Using rte command is invasive action, checking first if the device is not used...
Asset 31 is already checked out by you
Powering off...
Since the asset 31 has been checkout manually                     by you prior running this script, it will NOT be checked                     in automatically. Please return the device when work is                     finished.

make install installed 0.5.9, not sure why

Details

(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) make install
poetry build
Building osfv (0.5.10)
  - Building sdist
  - Built osfv-0.5.10.tar.gz
  - Building wheel
  - Built osfv-0.5.10-py3-none-any.whl
pip install --force-reinstall dist/osfv-0.5.10-py3-none-any.whl
Processing ./dist/osfv-0.5.10-py3-none-any.whl
Collecting PyYAML<7.0,>=6.0 (from osfv==0.5.10)
  Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting importlib-resources<7.0.0,>=6.1.1 (from osfv==0.5.10)
  Using cached importlib_resources-6.5.2-py3-none-any.whl.metadata (3.9 kB)
Collecting paramiko<4.0.0,>=3.2.0 (from osfv==0.5.10)
  Using cached paramiko-3.5.0-py3-none-any.whl.metadata (4.4 kB)
Collecting pexpect<5.0.0,>=4.8.0 (from osfv==0.5.10)
  Using cached pexpect-4.9.0-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting requests<3.0.0,>=2.31.0 (from osfv==0.5.10)
  Using cached requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting unidecode<2.0.0,>=1.3.6 (from osfv==0.5.10)
  Using cached Unidecode-1.3.8-py3-none-any.whl.metadata (13 kB)
Collecting voluptuous<0.15.0,>=0.14.2 (from osfv==0.5.10)
  Using cached voluptuous-0.14.2-py3-none-any.whl.metadata (20 kB)
Collecting bcrypt>=3.2 (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10)
  Using cached bcrypt-4.2.1-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (9.8 kB)
Collecting cryptography>=3.3 (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10)
  Using cached cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (5.7 kB)
Collecting pynacl>=1.5 (from paramiko<4.0.0,>=3.2.0->osfv==0.5.10)
  Using cached PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB)
Collecting ptyprocess>=0.5 (from pexpect<5.0.0,>=4.8.0->osfv==0.5.10)
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting charset-normalizer<4,>=2 (from requests<3.0.0,>=2.31.0->osfv==0.5.10)
  Using cached charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (35 kB)
Collecting idna<4,>=2.5 (from requests<3.0.0,>=2.31.0->osfv==0.5.10)
  Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting urllib3<3,>=1.21.1 (from requests<3.0.0,>=2.31.0->osfv==0.5.10)
  Using cached urllib3-2.3.0-py3-none-any.whl.metadata (6.5 kB)
Collecting certifi>=2017.4.17 (from requests<3.0.0,>=2.31.0->osfv==0.5.10)
  Using cached certifi-2024.12.14-py3-none-any.whl.metadata (2.3 kB)
Collecting cffi>=1.12 (from cryptography>=3.3->paramiko<4.0.0,>=3.2.0->osfv==0.5.10)
  Using cached cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.12->cryptography>=3.3->paramiko<4.0.0,>=3.2.0->osfv==0.5.10)
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Using cached importlib_resources-6.5.2-py3-none-any.whl (37 kB)
Using cached paramiko-3.5.0-py3-none-any.whl (227 kB)
Using cached pexpect-4.9.0-py2.py3-none-any.whl (63 kB)
Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (759 kB)
Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Using cached Unidecode-1.3.8-py3-none-any.whl (235 kB)
Using cached voluptuous-0.14.2-py3-none-any.whl (31 kB)
Using cached bcrypt-4.2.1-cp39-abi3-manylinux_2_28_x86_64.whl (278 kB)
Using cached certifi-2024.12.14-py3-none-any.whl (164 kB)
Using cached charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (144 kB)
Using cached cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Using cached idna-3.10-py3-none-any.whl (70 kB)
Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Using cached PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB)
Using cached urllib3-2.3.0-py3-none-any.whl (128 kB)
Using cached cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Installing collected packages: ptyprocess, voluptuous, urllib3, unidecode, PyYAML, pycparser, pexpect, importlib-resources, idna, charset-normalizer, certifi, bcrypt, requests, cffi, pynacl, cryptography, paramiko, osfv
  Attempting uninstall: urllib3
    Found existing installation: urllib3 2.3.0
    Uninstalling urllib3-2.3.0:
      Successfully uninstalled urllib3-2.3.0
  Attempting uninstall: pycparser
    Found existing installation: pycparser 2.22
    Uninstalling pycparser-2.22:
      Successfully uninstalled pycparser-2.22
  Attempting uninstall: idna
    Found existing installation: idna 3.10
    Uninstalling idna-3.10:
      Successfully uninstalled idna-3.10
  Attempting uninstall: charset-normalizer
    Found existing installation: charset-normalizer 3.4.1
    Uninstalling charset-normalizer-3.4.1:
      Successfully uninstalled charset-normalizer-3.4.1
  Attempting uninstall: certifi
    Found existing installation: certifi 2024.12.14
    Uninstalling certifi-2024.12.14:
      Successfully uninstalled certifi-2024.12.14
  Attempting uninstall: requests
    Found existing installation: requests 2.32.3
    Uninstalling requests-2.32.3:
      Successfully uninstalled requests-2.32.3
  Attempting uninstall: cffi
    Found existing installation: cffi 1.17.1
    Uninstalling cffi-1.17.1:
      Successfully uninstalled cffi-1.17.1
  Attempting uninstall: cryptography
    Found existing installation: cryptography 44.0.0
    Uninstalling cryptography-44.0.0:
      Successfully uninstalled cryptography-44.0.0
Successfully installed PyYAML-6.0.2 bcrypt-4.2.1 certifi-2024.12.14 cffi-1.17.1 charset-normalizer-3.4.1 cryptography-44.0.0 idna-3.10 importlib-resources-6.5.2 osfv-0.5.10 paramiko-3.5.0 pexpect-4.9.0 ptyprocess-0.7.0 pycparser-2.22 pynacl-1.5.0 requests-2.32.3 unidecode-1.3.8 urllib3-2.3.0 voluptuous-0.14.2

[notice] A new release of pip is available: 24.2 -> 25.0
[notice] To update, run: pip install --upgrade pip
test -f /home/miwanicki/.osfv/snipeit.yml || install -D -m 644 snipeit.yml /home/miwanicki/.osfv/snipeit.yml
test -f /home/miwanicki/.osfv/zabbix.yml || install -D -m 644 zabbix.yml /home/miwanicki/.osfv/zabbix.yml
(venv) miwanicki@3M02 ➜  ~/projects/osfv-scripts/osfv_cli git:(fix-93) osfv_cli -v
0.5.9

pip says that it:

Successfully installed (...) osfv-0.5.10 (...)

After I removed global osfv_cli installation it shows correct version 0.5.10 so I think the problem was with which version was executed. Which is weird as which osfv_cli returned executable inside venv

Copy link

@m-iwanicki m-iwanicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it works, had to remove global osfv_cli as for some reason it's the one that was used instead one in virtualenv

@macpijan macpijan merged commit a6b18bb into main Jan 30, 2025
1 check passed
@macpijan macpijan deleted the fix-93 branch January 30, 2025 16:58
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 this pull request may close these issues.

osfv_cli checks device in even if it was previously checked out manually
2 participants