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

CP-50100: backup-sr-metadata,restore-sr-metadata: 2to3, fix pytype, pyright #5795

Conversation

ashwin9390
Copy link
Contributor

Main ticket CP-49100 :Move python3 scripts from scripts directory to python3 directory.

Sub task CP-50100:

2to3 and warning fixes to prepare its to move to python3 dirrectory:

Commit 1:

  • apply 2to3 -w and update shebang

Commit 2:

  • pyright:

    • Add VDI to the XenAPI typing stub as we don't do type checking of VDI attributes yet.
    • move sys.exit() from inside usage() to after to make pyright aware of the exit.
  • apply isort to sort the imports

  • update the logout() handler to:

    • use contextlib.suppress()
    • move it into main() to fix the undeclared session warning.
  • remove the unused variable vdis: vdis = session.xenapi.SR.get_all_records()

  • remove trailing whitespace

Author : Signed-off-by: Bernhard Kaindl bernhard.kaindl@cloud.com

Committed by: Signed-off-by: Ashwinh ashwin.h@cloud.com

…hon3

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
… it)

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Copy link
Collaborator

@bernhardkaindl bernhardkaindl left a comment

Choose a reason for hiding this comment

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

@psafont: Please see the PR description on info about the fixes.

@bernhardkaindl bernhardkaindl force-pushed the backup-sr-metadata-2to3-and-warningfixes branch from 99f7e25 to 16e37e6 Compare July 9, 2024 11:33
@bernhardkaindl bernhardkaindl changed the title CP-50100- Convert backup-sr- metadata from python2 to 3 and warningfixes CP-50100: backup-sr-metadata,restore-sr-metadata: 2to3, fix pytype, pyright Jul 9, 2024
@psafont
Copy link
Member

psafont commented Jul 9, 2024

There are a few warnings remaining in scripts/restore-sr-metadata.py

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
@bernhardkaindl bernhardkaindl force-pushed the backup-sr-metadata-2to3-and-warningfixes branch from 77d7bb2 to c8a1b5e Compare July 9, 2024 13:26
Copy link
Collaborator

@bernhardkaindl bernhardkaindl left a comment

Choose a reason for hiding this comment

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

@psafont: Applied the minimal fixes for the pylint warnings from reviewdog:

This fixes the warnings show in by GitHub CI (using reviewdog):

  • Removed unused imports of os and time
  • Applied folding the too long line from the changes that black would make.

Any remaining formatting and pylint fixes can be applied later as well.

@bernhardkaindl bernhardkaindl merged commit 8095204 into xapi-project:feature/py3 Jul 10, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants