saltstack / saltstack/salt

[BUG] The nexus module does not work with Python 3

Open
#63,560 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug bytes-vs-strings Execution-Module needs-triage python3
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
The nexus module does not work since upgrading minion to 3004.2 the nexus.downloaded state fails with
error "expected bytes-like object".

Setup
Master (3004.2) is running on Ubuntu Server, minion(3004.2) is running on Windows 10 machine.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
Run this state with described minion version

downloadtest:
  nexus.downloaded:
    - artifact:
        nexus_url: https://mynexusrepo.com/respository
        repository: 'test'
        packaging: '7z'
        group_id: 'testgrop'
        artifact_id: 'testartifact'
        username: 'user'
        password: 'supersecrect'
        version: '1.0'
    - target_file: C:\Temp\test.7z

Expected behavior
The file should be downloaded without failing.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Master:

Salt Version:
          Salt: 3004.2

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: 2.0.6
     gitpython: 3.0.7
        Jinja2: 2.10.1
       libgit2: 0.28.3
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.6.1
        pygit2: 1.0.3
        Python: 3.8.10 (default, Jun 22 2022, 20:18:18)
  python-gnupg: 0.4.5
        PyYAML: 5.3.1
         PyZMQ: 18.1.1
         smmap: 2.0.5
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.2

System Versions:
          dist: ubuntu 20.04 focal
        locale: utf-8
       machine: x86_64
       release: 5.4.0-126-generic
        system: Linux
       version: Ubuntu 20.04 focal

Minion

Salt Version:
          Salt: 3004.2

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.7
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.4
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.10.1
        pygit2: Not Installed
        Python: 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)]
  python-gnupg: 0.4.7
        PyYAML: 5.4.1
         PyZMQ: 19.0.0
         smmap: 4.0.0
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.2

System Versions:
          dist:
        locale: cp1252
       machine: AMD64
       release: 2019
        system: Windows
       version: 2019 10.0.17763 SP0 Multiprocessor Free

Additional context
This looks like the same problem mentioned in https://github.com/saltstack/salt/issues/56660. I can provide a pull request applying the same fix to the nexus module.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the nexus.downloaded state from the supplied YAML on a Windows 10 minion running Salt 3004.2, then compare the failure with the related issue 56660 and its proposed fix. Done means the artifact downloads successfully without the “expected bytes-like object” error; the issue does not name a source file or test to update.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.