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

[BUG] module 'os' has no attribute 'getcwdu' #62281

Closed
gbarreiro opened this issue Jul 6, 2022 · 1 comment · Fixed by #62326
Closed

[BUG] module 'os' has no attribute 'getcwdu' #62281

gbarreiro opened this issue Jul 6, 2022 · 1 comment · Fixed by #62326
Labels
Bug broken, incorrect, or confusing behavior needs-triage python3 regarding Python 3 support SPM

Comments

@gbarreiro
Copy link

Description
Salt Package Manager (SPM) is using a deprecated Python method called os.getcwdu(), which used to exist in Python 2.x, but not anymore on Python 3.x. This causes the following exception when calling spm create_repo . on SPM version 3004:

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
AttributeError: module 'os' has no attribute 'getcwdu'
Traceback (most recent call last):
  File "/usr/bin/spm", line 11, in <module>
    salt_spm()
  File "/usr/lib/python3.6/site-packages/salt/scripts.py", line 533, in salt_spm
    spm.run()
  File "/usr/lib/python3.6/site-packages/salt/cli/spm.py", line 38, in run
    client.run(self.args)
  File "/usr/lib/python3.6/site-packages/salt/spm/__init__.py", line 129, in run
    self._create_repo(args)
  File "/usr/lib/python3.6/site-packages/salt/spm/__init__.py", line 750, in _create_repo
    repo_path = os.getcwdu()
AttributeError: module 'os' has no attribute 'getcwdu'
Traceback (most recent call last):
  File "/usr/bin/spm", line 11, in <module>
    salt_spm()
  File "/usr/lib/python3.6/site-packages/salt/scripts.py", line 533, in salt_spm
    spm.run()
  File "/usr/lib/python3.6/site-packages/salt/cli/spm.py", line 38, in run
    client.run(self.args)
  File "/usr/lib/python3.6/site-packages/salt/spm/__init__.py", line 129, in run
    self._create_repo(args)
  File "/usr/lib/python3.6/site-packages/salt/spm/__init__.py", line 750, in _create_repo
    repo_path = os.getcwdu()
AttributeError: module 'os' has no attribute 'getcwdu'

Setup

Docker container. Image is build with the following Dockerfile:

FROM opensuse/leap

RUN zypper refresh && zypper install -y salt-master

ENTRYPOINT ["sleep","infinity"]

Steps to Reproduce the behavior

  1. Install salt-master
  2. Run spm create_repo . on any directory

Expected behavior
The repository is correctly initialized on the current working directory.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3004
 
Dependency Versions:
          cffi: 1.13.2
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: 0.38.0
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.17
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.3
 
System Versions:
          dist: opensuse-leap 15.4 
        locale: UTF-8
       machine: x86_64
       release: 5.13.0-51-generic
        system: Linux
       version: openSUSE Leap 15.4 
@gbarreiro gbarreiro added Bug broken, incorrect, or confusing behavior needs-triage labels Jul 6, 2022
@welcome
Copy link

welcome bot commented Jul 6, 2022

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@OrangeDog OrangeDog added python3 regarding Python 3 support SPM labels Jul 7, 2022
@itspooya itspooya mentioned this issue Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage python3 regarding Python 3 support SPM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants